cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5085
Views
10
Helpful
15
Replies

How to put Track on route with dhcp gateway ( Cisco 819 )

plussier1
Level 1
Level 1

Hi,

I would like to know if it's possible to do the same setting like this one but with dhcp gateway ?

 

ip route 0.0.0.0 0.0.0.0 xxx.xxx.xxx.xxx track 1  ( Used at the moment with Static ISP from ISP )

 

We have a second site with no Static IP from ISP.

 

Is there a way to put track on Route with DHCP gateway ?

 

I tried but look like when you type

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

you can't put track on this route

 

I need to put track because i use Ip sla to switch between ISP 1 and ISP 2 in case on failure of Main ISP, 1 on this case.

 

Please let my know !

 

Thank You!

 

Patrick Lussier

OrizonMobile

15 Replies 15

Chosebin
Level 1
Level 1

Hello folks,

I read since weeks on this problem and I finally figure out how to make that works great, tested on a 4321 runnin ios 16.9.8. I also read many solutions below but no one was completely operational and whitout any flaw under different ISPs or a complex configuration, so I hope this will help somebody. The backup link will work regardless running on DHCP, PPPoE, dialer, P2P, etc. The main issue is with the "ip route 0.0.0.0 0.0.0.0 int g0/0/0 track xxx" returning the %Default route without gateway, if not a point-to-point interface, may impact performance, because YES, it impacts 90% of providers working with dhcp setup! So, YES, this is a real problem to not be able to add the "track xxx" option after DHCP word.

I tried to be clear with a lot of informations, maybe too much, but it works, so let's go ahead:

!
### Tracks if g0/0/0 got an ip
track 144 interface GigabitEthernet0/0/0 ip routing
### Facultative, but helps with some providers that brings routing up too slowly
delay up 5
!
### Tracks reachability of a pingnable remote host later in config
track 155 ip sla 155
!
interface GigabitEthernet0/0/0
description PRIMARY - Fizz Internet DHCP
### MUST BE entered BEFORE the interface gets an ip; that's what the EEM tracking 155 will fix if isp fails while the interface doesn't loose the ip.
ip dhcp client route track 144
ip address dhcp
ip nat outside
ip virtual-reassembly
!
interface Cellular0/1/0
description BACKUP - Bell Mobility [NIM-LTEA-EA] DHCP
ip address negotiated
ip nat outside
dialer in-band
dialer idle-timeout 600
dialer-group 1
pulse-time 1
ip virtual-reassembly
dialer-list 1 protocol ip list 1
!
!
ip nat inside source route-map rm-isp1-primary interface GigabitEthernet0/0/0 overload
ip nat inside source route-map rm-isp2-backup interface Cellular0/1/0 overload
!
### We are not tracking the route because it just doesn't work 90% of time whitout a static gateway, that's why we're tracking the dhcp client straight on the interface, so just use regular routes.
ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/0 dhcp
ip route 0.0.0.0 0.0.0.0 Cellular0/1/0 10
!
!
### This checks the reachability of internet, because the dhcp interface cannot when we are tracking the route with "ip route 0.0.0.0 0.0.0.0 g0/0/0 track xxx" and the "g0/0/0 dhcp track xxx" syntax does not exist.
ip sla 155
icmp-echo 104.18.29.99 source-interface GigabitEthernet0/0/0
threshold 500
timeout 5001
frequency 10
ip sla schedule 155 life forever start-time now
!
### my routes
route-map rm-isp1-primary permit 10
match ip address acl-in2out acl-guest2out
match interface GigabitEthernet0/0/0
!
route-map rm-isp2-backup permit 10
match ip address acl-in2out acl-guest2out
match interface Cellular0/1/0
!
### my acl, strictly informational
ip access-list extended acl-guest2out
permit ip 10.3.40.0 0.0.0.255 any
ip access-list extended acl-in2out
permit ip 192.168.1.0 0.0.0.255 any
!
!
### Now, the magical happens with EEM on tracker 155 which is forcing to validate than the routing is really working and, in bonus, it will reset nat.
### Since I'm also using DMVPN, it will switch also my tunnel on the backup link with EEM on tracker 144.
!
!
event manager applet TRACK-155-DOWN
event track 155 state down
action 10 syslog msg "========== EEM --> IP Release on interface g0/0/0."
action 20 cli command "enable"
action 30 cli command "conf t"
action 40 cli command "int g0/0/0"
action 50 cli command "no ip add"
action 80 syslog msg "========== EEM --> Starting IP renewal on interface g0/0/0."
action 90 cli command "ip add dhcp"
!
event manager applet TRACK-155-UP
event track 155 state up
action 10 wait 3
action 20 syslog msg "========== EEM --> Force nat clearing to switch translation's sessions."
action 30 cli command "enable"
action 40 cli command "conf t"
action 50 cli command "do clear ip nat translation forced"
!
!
event manager applet TRACK-144-DOWN
event track 144 state down
action 10 syslog msg "========== EEM --> Switching Tunnel to cell0/1/0."
action 20 cli command "enable"
action 30 cli command "conf t"
action 40 cli command "int tunnel 1"
action 50 cli command "shut"
action 60 cli command "tunnel source cell 0/1/0"
action 70 cli command "no shut"
!
event manager applet TRACK-144-UP
event track 144 state up
action 10 syslog msg "========== EEM --> Switching Tunnel to giga0/0/0."
action 20 cli command "enable"
action 30 cli command "conf t"
action 40 cli command "int tunnel 1"
action 50 cli command "shut"
action 60 cli command "tunnel source giga 0/0/0"
action 70 cli command "no shut"
!
!
Enjoy!

 

Review Cisco Networking for a $25 gift card