Tech Support > Computer Hardware > Routers > Distance command in Cisco IOS
Distance command in Cisco IOS
Posted by charset on May 10th, 2008


Dear group,

I am an MSc student in Electrotechnical Engineering and I am currently
researching configuration commands in Cisco IOS for my thesis.

In particular, I am interested in setting the administrative distance
of a route according to the route's destination prefix. I am aware of
the "distance" command in the form:

distance {ip-address {wildcard-mask}} [ip-standard-list] [ip-
extended-list]

which allows one to set the administrative distance of a route (within
the configuration of a particular routing protocol) according to what
Cisco's documentation [1] refers to as the "source of a route". The
documentation is not very clear on what this means, but my
interpretation is that it refers to the neighboring router from which
the route in question was received. On the other hand, the book "Cisco
IOS in a nutshell" says it refers to the route's destination address;
confusingly, it also describes the command's syntax as

distance distance [address mask] [access-list]

which is missing one argument relative to the version above.

Since the two sources contradict each other, I wonder if you could
provide me an answer to any of the following questions:

(i) What is the correct syntax of the "distance" command and, in
particular, what do the ip-address and wildcard-mask parameters mean;
(ii) Is there any way, using this command or another one, to set a
route's administrative distance based on the route's destination
prefix/address?

Thanks in advance.

Best regards,
Tiago


[1] Cisco IOS IP Command Reference, Volume 2 of 3: Routing Protocols,
Release 12.2

Posted by Merv on May 10th, 2008



The syntax for the distance command is

distance <admin-distance> {ip-address {wildcard-mask}} [ip-standard-
list]| [ip-extended-list]

example: distance 150 10.1.1.0 0.0.0.255

This distance command should not be confused with route metrics that
are used
by the various routing protocols - RIP, EIGRP, OSPF, ISIS, etc

Posted by John Agosta on May 11th, 2008


You can change the admin distance of a routing protocol
with the command:

distance xxx

this will affect all routes heard by the protocol.

You can get more granular by doing this:

distance xxx 0.0.0.0 255.255.255.255 99

With 99 being an access list that identifies a destination network.

The change in admin distance will only affect routes towards the destination
in access list 99,
recieved from any router.

Additionally, you can change the admin distance from a specific route
source:
distance xxx 10.1.1.1 0.0.0.0

This will cause a change in consideration for route heard from that specific
source.

And again, more granular:

distance xxx 10.1.1.1 0.0.0.0 99

This will affect the consideration only for routes identified in ACL 99,
but they must come from router sourse 10.1.1.1

HTH







"charset" <tiagoq@gmail.com> wrote in message
news:3cbec016-8a28-4ec1-ac21-604547e68087@a70g2000hsh.googlegroups.com...


Posted by charset on May 11th, 2008


Thanks, that's precisely what I wanted to know.

Best regards,
Tiago

On May 11, 3:22*am, "John Agosta" <jago...@wideopenwest.com> wrote: