cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
915
Views
5
Helpful
3
Replies

Configure Primary route preference for specific destination and use back route only if primary gateway fails

getaway51
Level 2
Level 2

Hi,

 

I am trying to configure primary and secondary route with pref 1 and 2.

The objective is to always use primary route gateway 10.1.1.1. and Only use secondary gateway 10.1.1.2 if primary is down.

On top of tht, I also have a default route 0.0.0.0/0 for all other traffic.

ip route 0.0.0.0/0 Vlan50 10.1.1.1
ip route 0.0.0.0/0 Vlan50 10.1.1.2

1)May I know is the config correct? Do i need this CLI--->ip route 172.30.1.10/32 Vlan50 10.1.1.2 2

Or the def ip route --->ip route 0.0.0.0/0 Vlan50 10.1.1.2 already does the job?

 

2)Also does the switch still forward the traffic to both gateway if either gateway is down? 

ip route 0.0.0.0/0 Vlan50 10.1.1.1
ip route 0.0.0.0/0 Vlan50 10.1.1.2

 

CX34765E# sh ip route 172.30.1.10
IP Route Table for VRF "default"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>

172.30.1.10/32, ubest/mbest: 1/0
*via 10.1.1.1, Vlan50, [1/0], 00:28:08, static
via 10.1.1.2, Vlan50, [2/0], 00:07:14, static

3 Replies 3

Harold Ritter
Cisco Employee
Cisco Employee

Hi,

 

Yes, if you want the first route to be used as a primary and the other one as a secondary, you need to use this syntax:

 

ip route 0.0.0.0/0 Vlan50 10.1.1.1
ip route 0.0.0.0/0 Vlan50 10.1.1.2 2

 

But in this scenario, the first route will never disappear as long as vlan50 remains up and the second routes will not be installed, even though the first next hop is not reachable. So the best approach would be to use ip sla to monitor the primary routes and to declare it down if its doesn't respond. It would look something like this:

 

track 1 ip sla 1

ip sla 1
icmp-echo 10.1.1.1
frequency 5
ip sla schedule 1 life forever start-time now

!

ip route 0.0.0.0/0 Vlan50 10.1.1.1 track 1

ip route 0.0.0.0/0 Vlan50 10.1.1.2 2

!

 

Regards,

Harold Ritter
Sr Technical Leader
CCIE 4168 (R&S, SP)
harold@cisco.com
México móvil: +52 1 55 8312 4915
Cisco México
Paseo de la Reforma 222
Piso 19
Cuauhtémoc, Juárez
Ciudad de México, 06600
México

Hi,

 

Thanks for yr great tips.

 

For config below, Will the switch still send traffic to 10.1.1.1 when 10.1.1.1 is down? 

ip route 0.0.0.0/0 Vlan50 10.1.1.1
ip route 0.0.0.0/0 Vlan50 10.1.1.2

If yes, Normally how to fix this kind of issue esp when 10.1.1.1 or 10.1.1.2 is down? This is to ensure traffic not effected and switch sending traffic to the right gateway.

Yes, if you configure the two static routes with equal admin metric, both will be used equally and traffic would be load balanced between  10.1.1.1 and 10.1.1.2 even though 10.1.1.1 is down. The way to fix it would be to assign a lower metric to the primary static route and to monitor it using ip sla as I recommended previously.

 

The other way would be to run HSRP on 10.1.1.1 and 10.1.1.2. You would then replace the two static routes with only one static route that would use the HSRP virtual address as the next hop.

 

Regards,

Harold Ritter
Sr Technical Leader
CCIE 4168 (R&S, SP)
harold@cisco.com
México móvil: +52 1 55 8312 4915
Cisco México
Paseo de la Reforma 222
Piso 19
Cuauhtémoc, Juárez
Ciudad de México, 06600
México
Review Cisco Networking products for a $25 gift card