cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1053
Views
2
Helpful
6
Replies

IP ROUTE can't have dhcp AND track?

Tuc
Level 1
Level 1

Hi,

I currently have 3 connections -

 

ip route 0.0.0.0 0.0.0.0 Ethernet0/2/0 <ITS_GW_IP> 20 track 2
ip route 0.0.0.0 0.0.0.0 Cellular0/1/0 30 track 3
ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/2 dhcp

I want to change the Gig0/2 to be able to have a metric of 10 and track on 1. (Tracks are all now working thanks to this group.)

So I tried this -

C3945e-1(config)#ip route 0.0.0.0 0.0.0.0 gigabitEthernet0/2 ?
  <1-255>    Distance metric for this route
  A.B.C.D    Forwarding router's address
  DHCP       Default Gateway obtained from DHCP
  multicast  multicast route
  name       Specify name of the next hop
  permanent  permanent route
  tag        Set tag for this route
  track      Install route depending on tracked item
  <cr>       <cr>

Which says I have DHCP and track available. So, I do DHCP, but...

C3945e-1(config)#ip route 0.0.0.0 0.0.0.0 gigabitEthernet0/2 dhcp ?
  <1-255>  Distance metric for this route
  <cr>     <cr>

C3945e-1(config)#ip route 0.0.0.0 0.0.0.0 gigabitEthernet0/2 dhcp 10 ?
  <cr>  <cr>

It won't let me go past that. I was hoping to add a 2nd with a metric so that I can add it and then remove the current. I'd be more bold, but I'm 500 miles away, I'm "reload in 10 reason Lost_Control" before I do these things just incase.

So if I try to use track....

C3945e-1(config)#ip route 0.0.0.0 0.0.0.0 gigabitEthernet0/2 track ?
  <1-1000>  tracked object number

C3945e-1(config)#ip route 0.0.0.0 0.0.0.0 gigabitEthernet0/2 track 1 ?
  <1-255>    Distance metric for this route
  multicast  multicast route
  name       Specify name of the next hop
  tag        Set tag for this route
  <cr>       <cr>

C3945e-1(config)#ip route 0.0.0.0 0.0.0.0 gigabitEthernet0/2 track 1 10 ?
  multicast  multicast route
  name       Specify name of the next hop
  tag        Set tag for this route
  <cr>       <cr>

I lose the ability to DHCP. 

I'm fairly convinced that "config net" of 

no ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/2 dhcp
ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/2 dhcp 10 track 1

wouldn't work, as I tried setting another interface to dhcp and did 

ip route 0.0.0.0 gig0/3 dhcp 50 ?

and just got "<cr>  <cr>"

I'm a bit hung up on having the dhcp with the interface, I've heard more input that having it is belt and suspenders. But if it's not viable, then.......

Thanks, Tuc

 

1 Accepted Solution

Accepted Solutions

Hello
You can track dhcp interface, but you need to apply the client track on the isp facing interface BEFORE you enable for dhcp

Create the ipsla and track 1 accordingly then:

int gigabitEthernet0/2

description ISP
ip dhcp client route track 1
ip address dhcp

ip route 0.0.0.0 0.0.0.0 gigabitEthernet0/2 dhcp 10


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

View solution in original post

6 Replies 6

Enes Simnica
Spotlight
Spotlight

@Tuc hello there, and sick question!!! Alright basically, u can't use both dhcp and track in the same ip route command. Once u specify dhcp, the router gets the gateway dynamically and installs the default route BUT that route can't be tied to a track object directly. U also can’t apply a metric and track after dhcp in the syntax. BEcause the CLI just doesn’t support it, and as u saw, it stops parsing after the metric. 

And dont get me wrong my Cisco friend, because ur desire to try something like the ip route 0.0.0.0..... gig0/2 dhcp 10 track 1 is TOTALLY LOGICAL, but yeah, not supported by IOs (meaning that the moment u say dhcp, Ios owns that route and doesnt let u bind it to a track object......

But still, u have some options: 

If your DHCP gateway is fairly static (some setups use a reserved IP), u could manually enter the next-hop like: 

ip route 0.0.0.0 0.0.0.0 Gig0/2 x.x.x.x 10 track 1 .

And if the gateway changes regularly and u must stick with DHCP, then u're kind of stuck not being able to tie tracking to it directly. What you can do is track the interface status itself wiht the track 1 int gig0/2 line-protocol then this is going to work; IP ROUTE 0.0.0.0 0.0.0.0 GIG0/2 X.X.X 10 TRACK 1

so as a RECAP: U can use IP SLA to ping something (like 8.8.8.8) and track that, but u’ll still need to hardcode the next-hop, DHCP won't work with it. TL;DR: DHCP routes can't use track. If ur gateway isn't static, u're stuck letting DHCP handle it and relying on interface status for failover.

and this link it outlines how ip route ... dhcp works and stuff..: https://www.cisco.com/c/en/us/td/docs/ios/12_2sb/12_2sba/feature/guide/ddgtwy.html 

HOPE IT WASNT A LOOONG ANSWER, HOPE IT HELPS AND PEACE!

 

-Enes

more Cisco?!
more Gym?!



If this post solved your problem, kindly mark it as Accepted Solution. Much appreciated!

Hello
You can track dhcp interface, but you need to apply the client track on the isp facing interface BEFORE you enable for dhcp

Create the ipsla and track 1 accordingly then:

int gigabitEthernet0/2

description ISP
ip dhcp client route track 1
ip address dhcp

ip route 0.0.0.0 0.0.0.0 gigabitEthernet0/2 dhcp 10


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

Implemented. Didn't drop network. Nothing seems to be different, which is what I expected. But I guess I'll find out if it works when we drop ISP again Thanks

Hello
Please note even though its applied it may not work the client route needs to be applied before the interface obtains an ip allocation otherwise you will need either shutdown the interface and bring it back up or remove dhcp from the interface and have it re obtain an allocation  

To verify if the dhcp client route track taken correctly : 

sh ip route track-table 


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

Hi.

So we had this happen yesterday -

Aug 7 04:43:35 EDT: %DHCP-6-ADDRESS_ASSIGN: Interface
GigabitEthernet0/2 assigned DHCP address 192.168.1.133, mask
255.255.255.0, hostname C3945e-1

Hopefully this qualifies. Seems so -

C3945e-1# sh ip route track-table
ip route 0.0.0.0 0.0.0.0 192.168.1.1 254 track 1 state is [up]
ip route 1.0.0.1 255.255.255.255 GigabitEthernet0/2 192.168.1.1 track 1
state is [up]
ip route 192.168.100.1 255.255.255.255 GigabitEthernet0/2 192.168.1.1
track 1 state is [up]
ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/2 192.168.1.1 10 track 1
state is [up]
ip route 0.0.0.0 0.0.0.0 Ethernet0/2/0 20 track 2 state
is [up]
ip route 0.0.0.0 0.0.0.0 Cellular0/1/0 30 track 3 state is [up]


Hrm, just realized I have 2 routes now, one probably from the interface,
and another from ip route. I probably should get rid of

ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/2 dhcp 10

so now it's

ip route 0.0.0.0 0.0.0.0 192.168.1.1 254 track 1 state is [up]
ip route 1.0.0.1 255.255.255.255 GigabitEthernet0/2 192.168.1.1 track 1
state is [up]
ip route 192.168.100.1 255.255.255.255 GigabitEthernet0/2 192.168.1.1
track 1 state is [up]
ip route 0.0.0.0 0.0.0.0 Ethernet0/2/0 20 track 2 state
is [up]
ip route 0.0.0.0 0.0.0.0 Cellular0/1/0 30 track 3 state is [up]

Interesting though. only ip route statements associated with the
interface that has the ip dhcp client route track 1 shows in the table.
I have other ip routes that are associated with Ethernet0/2/0 and
Cellular0/1/0 but they don't show in this table.

Tuc

Can I see last config 

MHM