cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1693
Views
0
Helpful
1
Replies

how to route n.n.n.n -> default DHCP route or n.n.n.n -> e.e.e.e when no default set (AD=253/254)

nlariguet
Level 1
Level 1

I would like to reach n.n.n.n over the internet with the default route in place
or with a static route when the default route is not set:

ip dhcp-client default-router distance 253

interface FastEthernet 0/0 ... internet gateway
ip address dhcp

... makes a default route like: ip route 0.0.0.0 0.0.0.0 FastEthernet 0/0 253

... now if I place:

ip route n.n.n.n 255.255.255.255 FastEthernet 0/1 e.e.e.e 254

... I suppose n.n.n.n will be reached with the default route (AD=253) if set or via the second interface (Fa0/1) if no default route is present right ?

... well; it's not working, it attempts to reach n.n.n.n via the second interface no matter whether a default route is set or not

show ip route is clearly showing both routes with proper ADs

what am I doing wrong ?

PS: what came first to mind was to use ip sla tracking for the default route to install the alternate but on second thought this seemed a simple and better solution

1 Accepted Solution

Accepted Solutions

ohassairi
Level 5
Level 5

the router uses the best route (not in sens of metric but in sens of the nearest) to route your traffic.

in your case the best route is n.n.n.n 255.255.255.255 even if it has a bad metric.

the router only use 0.0.0.0 route if no better route exists

for example:

if you have this in your ip route table

ip route 10.0.0.0 255.0.0.0  int s0

ip route 10.1.0.0 255.255.0.0  int s1    50

ip route 10.1.1.0 255.255.255.0  int s2    100

if your router will route one packet with IP destination 10.1.1.5 it will use the third route (via s2) because it is the nearest and the most close to the IP address

now if you have

ip route 10.0.0.0 255.0.0.0  int s0

ip route 10.1.0.0 255.255.0.0  int s1    50

ip route 10.1.1.0 255.255.255.0  int s2    100

ip route 10.1.1.0 255.255.255.0  int s3    150

if s2 fails then it will use s3

View solution in original post

1 Reply 1

ohassairi
Level 5
Level 5

the router uses the best route (not in sens of metric but in sens of the nearest) to route your traffic.

in your case the best route is n.n.n.n 255.255.255.255 even if it has a bad metric.

the router only use 0.0.0.0 route if no better route exists

for example:

if you have this in your ip route table

ip route 10.0.0.0 255.0.0.0  int s0

ip route 10.1.0.0 255.255.0.0  int s1    50

ip route 10.1.1.0 255.255.255.0  int s2    100

if your router will route one packet with IP destination 10.1.1.5 it will use the third route (via s2) because it is the nearest and the most close to the IP address

now if you have

ip route 10.0.0.0 255.0.0.0  int s0

ip route 10.1.0.0 255.255.0.0  int s1    50

ip route 10.1.1.0 255.255.255.0  int s2    100

ip route 10.1.1.0 255.255.255.0  int s3    150

if s2 fails then it will use s3

Review Cisco Networking for a $25 gift card