Command
Distance
Use
Allows you to filter routes from the routing table. For CCNA purposes, this is usually done through access lists.
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 what routes will have their AD changed |
Example
In this example, we will apply a change to the administrative distance for OSPF to 123 for any route that starts with 1.0.0.0. First, we’ll look at the routing table.
R2(config)#do show ip route ospf |
Now, we will configure the distance command on R2’s OSPF process.
R2(config)#access-list 25 permit 1.0.0.0 0.255.255.255 |
Finally, we see routes starting with 1.0.0.0 now have an administrative distance of 123.
R2(config-router)#do show ip route ospf |