Distance Command on CISCO Router/Switch

Command

Distance

Use

This command allows your to change the administrative distance for select EIGRP routes.

Syntax

Router(config-router)#distance <AD> <source IP> <wildcard mask> <access-list>

Options

<Administrative Distance> Sets the administrative distance for the selected routes
<source IP> Source IP the route is received from
<wildcard mask> Specifies a wildcard mask. Allows you to specify multiple source IP addresses
<access-list> Specifies an access-list that selects which routes will have their AD changed

Example

In this example, we will change the administrative distance for EIGRP to 123 for any route that starts with 1.0.0.0. First we’ll look at the routing table before applying the changes.

R2(config-router)#do show ip route eigrp
1.0.0.0/32 is subnetted, 3 subnets
D 1.1.1.1 [90/156160] via 10.1.1.1, 00:00:12, FastEthernet0/0
D 1.3.3.3 [90/156160] via 10.1.1.1, 00:00:12, FastEthernet0/0
D 1.2.2.2 [90/156160] via 10.1.1.1, 00:00:12, FastEthernet0/0
192.168.13.0/30 is subnetted, 1 subnets
D 192.168.13.0 [90/2172416] via 10.1.1.1, 00:00:12, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
D 3.3.3.3 [90/156160] via 10.2.2.3, 00:00:14, FastEthernet1/0
111.0.0.0/32 is subnetted, 1 subnets
D 111.111.111.111 [90/156160] via 10.1.1.1, 00:00:12, FastEthernet0/0
10.0.0.0/24 is subnetted, 3 subnets
D 10.4.4.0 [90/2172416] via 10.2.2.3, 00:00:12, FastEthernet1/0
[90/2172416] via 10.1.1.1, 00:00:12, FastEthernet0/0
11.0.0.0/32 is subnetted, 1 subnets
D 11.11.11.11 [90/156160] via 10.1.1.1, 00:00:12, FastEthernet0/0

Now we will configure the distance command on R2’s EIGRP process.

R2(config)#access-list 25 permit 1.0.0.0 0.255.255.255
R2(config)#router eigrp 100
R2(config-router)#distance 156 10.1.1.1 255.255.255.255 25

Afer that, we see routes starting with 1.0.0.0 now have an AD of 156.

R2(config-router)#do show ip route eigrp
1.0.0.0/32 is subnetted, 3 subnets
D 1.1.1.1 [156/156160] via 10.1.1.1, 00:00:03, FastEthernet0/0
D 1.3.3.3 [156/156160] via 10.1.1.1, 00:00:03, FastEthernet0/0
D 1.2.2.2 [156/156160] via 10.1.1.1, 00:00:03, FastEthernet0/0

Related Articles

Leave a Reply

avatar