cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
172076
Views
0
Helpful
6
Replies

show ip route / routing table

flokki123
Level 3
Level 3

hi all,

i have a question regarding the output of the "show ip route" command:

C         192.168.30.0/24 is directly connected, Ethernet0                                  

            172.16.0.0/24 is subnetted, 1 subnets

S          172.16.1.0 is directly connected, Ethernet0

               192.168.38.0/24 is variably subnetted, 2 subnets, 2 masks

S       192.168.38.0/24 is directly connected, Ethernet0

S       192.168.38.0/25 [1/0] via 192.168.30.40

     10.0.0.0/32 is subnetted, 1 subnets

C       10.1.1.1 is directly connected, Loopback1

I understand why lines 4,5 and 6 are present. Its cause the network 192.168.38.0 is supposed to have a /24 mask but there is also a network with a /25 mask and thus it says this network is variably subnetted.

But why doesnt it show the same for line 2 and 3? Shouldnt it say 172.16.0.0/16 is subnetted? I understand why is doesnt show "variably subnetted" as there is only on subnet but why not 172.16.0.0/16?

And the same for the last two lines. Why not 10.0.0.0/8 but /32? Even though its a loopback interface still the network 10.0.0.0 is supposed to have a /8 mask by nature.

And it might be a stupid question but does a static router always have a metric of 0? I guess so as they dont have to compete with other routes, right?

I mean a static route goes always straight into the routing table and the metric is actually just for comparison reasons within a routing protocol to see what is the best route which should be suggested for being written into the routing table.

Also i tried to put static routes permanently into the routing table with the "permanent" command but always when i detach the cable of the corresponding interface the routes get kicked out of the RT. Is there a trick or something i have to be aware of?

thanks for any help!

1 Accepted Solution

Accepted Solutions

I will take the easy part of the question first. One of the basic principles of IOS is that it will put routes into the routing table if the corresponding interface is in the up state. And that IOS will withdraw a route from the routing table if the corresponding interface is in the down state. So when you disconnect the interface then the route using that interface is withdrawn.

 

The more complex part of the question is the aspect of metrics with static routes. My explanation here would start from the point that the reason we use metrics is so that we can compare routes learned within a protocol and determine whether one is better than the other. This makes sense for RIP, it makes sense for OSPF, and it makes sense for EIGRP. But it does not make sense for static routes. To try to make it a bit more clear: if RIP or OSPF or EIGRP learn a route to a subnet that goes via FastEther0/0 and also learn a route to that subnet that goes via FastEther0/1 then we compare the routes and if one has a more attractive metric then that is the one that gets put into the routing table. But with static routes if there is a static route for a subnet that goes via FastEther0/0 and also a static route for that subnet that goes via FastEther0/1 then there is no comparison and both routes are put into the routing table. Since we do not do comparisons with static routes then there is no concept of metric associated with the static route and IOS puts a default value into the metric field of a static route.

 

HTH

 

Rick

HTH

Rick

View solution in original post

6 Replies 6

Richard Burts
Hall of Fame
Hall of Fame

Perhaps it will help you to understand the output if we make the point that the number following the prefix in the table does not reflect the "natural" mask of the network but reflects the subnetting of the prefix as found in the configuration and the routing updates.

This line happens to have the "natural" mask 192.168.30.0/24. But it uses /24 not really because 192.168 is a natural class C but because the interface configuration uses /24.

The output of 172.16.0.0/24 uses /24 because there is only a single reference to 172.16 and it happens to use a /24 mask.

And while you are correct that network 10 is a natural class A network there is only a single reference to 10 in the table and it uses mask /32.

So the output of the show ip route does not reflect the natural mask but reflects the mask that is actually used.

HTH

Rick

HTH

Rick

Hi Richard,

thanks for your reply and for your help!

I think i understand it now!

If i have an entry like this:

172.16.0.0/16 [1/0] via 192.168.30.50

It means that there is the 172.16.0.0 network with the default /16 mask and thats why nothing like "subnetted or variably subnetted" is stated.

then you have entries like this:

172.16.0.0/24 is subnetted, 1 subnets

S        172.16.1.0 [1/0] via 192.168.30.50

Now it states "subnetted" as not the normal mask /16 but /24 was applied to the network and it was subnetted!

And then you have entries like this:

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        10.0.1.50/32 is directly connected, Loopback1

S        10.0.20.0/24 [1/0] via 192.168.30.50

First it shows you that the network 10.0.0.0 should normally have a /8 mask BUT here it was "variably subnetted".

Two different mask were applied to the network /32 and /24.

Do you maybe have also an idea regarding my question about the static routing?

I will take the easy part of the question first. One of the basic principles of IOS is that it will put routes into the routing table if the corresponding interface is in the up state. And that IOS will withdraw a route from the routing table if the corresponding interface is in the down state. So when you disconnect the interface then the route using that interface is withdrawn.

 

The more complex part of the question is the aspect of metrics with static routes. My explanation here would start from the point that the reason we use metrics is so that we can compare routes learned within a protocol and determine whether one is better than the other. This makes sense for RIP, it makes sense for OSPF, and it makes sense for EIGRP. But it does not make sense for static routes. To try to make it a bit more clear: if RIP or OSPF or EIGRP learn a route to a subnet that goes via FastEther0/0 and also learn a route to that subnet that goes via FastEther0/1 then we compare the routes and if one has a more attractive metric then that is the one that gets put into the routing table. But with static routes if there is a static route for a subnet that goes via FastEther0/0 and also a static route for that subnet that goes via FastEther0/1 then there is no comparison and both routes are put into the routing table. Since we do not do comparisons with static routes then there is no concept of metric associated with the static route and IOS puts a default value into the metric field of a static route.

 

HTH

 

Rick

HTH

Rick

Rick

So when you disconnect the interface then the route using that interface is withdrawn.

I agree but from the options to the "ip route" command in the 12.4 command references -

permanent

(Optional) Specifies that the route will not be removed, even if the interface shuts down.

which suggests this overrides the default behaviour. I have seen this used with IP SLA but i have never really tested it in terms of shutting the interface.

Do you have any direct experience with using it and if so how did it behave ?

Jon

Jon

That is an interesting observation. I have never used the permanent parameter in configuring a static route and so have no experience to report on this aspect. It does seem logical that this parameter should over ride the default behavior.

HTH

Rick

HTH

Rick

Hi Richard and Jon,

sorry for my late reply and thanks for your answers!

I think the thing with static routes is that because you configure them yourself the device thinks well he will know what he does so i dont need a metric to compare, i just take them and put them into the routing table.

with dyn. routing protocols the device needs a certain method to decide which route is the best and will be put in the routing table, this method being metric.

Regarding the "permanent" keyword, i tried it out but couldnt make it work as even when configuring the route with the keyword "permanent" and then unplugging the cable the route would get kicked out of the routing table.

Regards

florian

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card