cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Bookmark
|
Subscribe
|
2178
Views
0
Helpful
7
Replies

Second default route as primary for a specific subnet

M. Bryan
Level 1
Level 1

I have 2 default route.

ip route 0.0.0.0 0.0.0.0 1.1.1.1 250
ip route 0.0.0.0 0.0.0.0 2.2.2.1 251

 

I would like to use 2.2.2.1 default route for 1 subnet 10.10.9.0/24 and the rest of the subnets will use the 1.1.1.1 as their primary default route. 10.10.9.0/24 is the source and the traffic will be originating to this network.

 

Can this be done? If yes, what if 1.1.1.1 goes down, are the other subnets still be able to use 2.2.2.1 as their default route?

 

interface GigabitEthernet0/0/0

description Internet1
ip address 1.1.1.1 255.255.255.252

 

interface GigabitEthernet0/0/1

description Internet2
ip address 2.2.2.1 255.255.255.252

 

interface GigabitEthernet0/0/2

description Subnet
ip address 10.10.9.1 255.255.255.0

 

7 Replies 7

PBR with next-hop reachability, 
if it reachable then PBR will work if not then it will use RIB to forward traffic.

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello @M. Bryan ,

first of all IP of next-hops should not be the IP addresses of the local device but those of the neighbor !

Here I assume you have the final .2 on your local device.

 

You need to use PBR = Policy Based Routing applied inbound on interface where the subnet is connected

 

access-list 111 deny ip 10.10.9.0 0.0.0.255 10.0.0.0 0.255.255.255

access-list 111 pemit ip 10.10.9.0 0.0.0.255 any

 

route-map PBR permit 10

match address 111

set ip next-hop 2.2.2.1

 

interface gi0/0/0/2

ip policy route-map PBR

 

Hope to help

Giuseppe

 

next hop should be 1.1.1.2 and  2.2.2.2.

Hello @M. Bryan 

ok

so it becomes

route-map PBR permit 10

match address 111

set ip next-hop 2.2.2.2

 

nterface gi0/0/0/2

ip policy route-map PBR

 

Hope to help

Giuseppe

 

The original post asks 2 questions. The first question was about how to make traffic from a specific subnet use a different gateway and @Giuseppe Larosa has provided good answer about that. The other question was "what if 1.1.1.1 goes down, are the other subnets still be able to use 2.2.2.1 as their default route?" The answer to this is that configuring PBR does not have any impact on the ability of other subnets to use the second default route as a backup route (configuration like this is frequently called floating static default where a second default route is configured with a higher administrative distance).

HTH

Rick

What if 1.1.1.2 goes down, are the other subnets will still be able to use 2.2.2.2 as their default route if I made those changes?

Hello @M. Bryan ,

the answer to this part of the  question is yes if the local device realizes that 1.1.1.2 is no longer reachable and/ or the interface to 1.1.1.2 has gone down.

The explanation has been provided by @Richard Burts and it is based on the use of floating static routes when the primary static route is removed from the IP routing table the second one is used by every source subnet regardless of PBR that impacts only on clients of subnet 10.10.9.0/24

 

To be noted if there is a  switch or other L2 equipment between your device and the next-hop , next-hop failure does not cause local interface to go down in these cases the use of IP SLA to monitor the next-hop is a useful tool .

The idea is the same just it uses an IP SLA and tracking to decide if the primary static route is still valid or not.

 

Hope to help

Giuseppe