4

Does any one knows a way to configure a cisco router with multiple gateways - multiple gateways of last resort?

I've tried adding a gateway of last resort twice (with different metric) but only one is shown:

Router(config)# ip route 0.0.0.0 0.0.0.0 2.2.2.2 10
Router(config)# ip route 0.0.0.0 0.0.0.0 3.3.3.3 100

And the show ip route output was:

Router# show ip route
Gateway of last resort is 2.2.2.2 to network 0.0.0.0

     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, FastEthernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, FastEthernet0/1
     32.0.0.0/30 is subnetted, 1 subnets
C       32.2.2.0 is directly connected, Serial0/2/0
S*   0.0.0.0/0 [10/0] via 2.2.2.2

The point is that i cannot see the other route with higher distance metric?

Anyone has a sugestion?

I mean will this config work if the link on 2.2.2.2 fails? Will the router choose the other network 3.3.3.3, if the link 2.2.2.2 fails?

  • 1
    Please explain the downvote? – SpacemanSpiff Nov 25 '11 at 14:36
9

IIRC, if you put different metrics only the best route will be injected in the main routing table.

So you have three choices:

First choice, as @dkaragasidis said, don't put the metrics (to get per session load-balancig) but then the traffic will flow nearly 50% on both links

Second choice, use some sort of dynamic routing protocol (i suggest BGP) if possbile.

Third choice, use ip sla commands to costantly check for ip availability.

Keep in mind that if one FastEthernet interface (or the remote port with which is connected) fails (i.e. the status of the interface goes to down) then the router automatically injects the other default route, but NOT if the 2.2.2.2 router somehow doesn't work (in that case the ip sla commands will take care of this).

If BGP is not an option and you really don't wanto to balance the gateways, ip sla is your best solution. Take a look at this answer to a similar question for a link to some examples.

| improve this answer | |
  • Thank you MrShunz your answer was usefull.. I guess I will try the third one :) – Spirit Nov 28 '11 at 9:10
5

Consider checking out Cisco's Configuring a Gateway of Last Resort Using IP Commands.

If you use multiple ip route 0.0.0.0 0.0.0.0 commands to configure a default route, traffic is load-balanced over the multiple routes.

| improve this answer | |
1

With having multiple default routes you can load-balance the traffic ( session lb ).
If you want to keep one of the paths as backup , then you need to play with metric. Give a higher metric to the path you wanna use as backup and smaller metric to the main one. This will solve your issue.
By the way because main default route will be there although the next hop is lost , you need to configure a tracker and ip sla to check the availability. If Ip Sla is down and the route will be deleted and the backup route will be inserted to your routing table.

Another solution is to define the outgoing interface instead of next-hop. Here you dont need ip sla

 ip route 0.0.0.0 0.0.0.0 fa0/0 10  -->  main route
 ip route 0.0.0.0 0.0.0.0 fa0/1 100 -->  backup route
| improve this answer | |
-1

If you have a router/firewall and you are doing 'router on a stick' or have each subnet connected from the router via its own interface to the switch capable of Layer 3 also, then on the switch you can have multiple gateways of last resort.

Lets take a router with 2 x LAN Subnets of 10.0.1.0/24 and 10.0.2.0/24

Router LAN Interface is setup with:

Fa0/0.1 = 10.0.1.1 255.255.255.0

Fa0/0.2 = 10.0.2.1 255.255.255.0

Then you configure your first switch, which in a small business is often a L3 capable SB Cisco SG Series or a C1K switch, treated like a "Core".

Plug FastEthernet 0/0 from the Router/Firewall into your Switch, lets say Gi1/0/1:

On that switch, now you can configure interface Gi1/0/1 as:

switchport mode trunk

On the Switch, you will need to do the following

Switch> enable
Switch# conf t
Switch(config)#

interface vlan 1
ip address 10.0.1.10 255.255.255.0

interface vlan 2
ip address 10.0.2.10 255.255.255.0

ip routing
ip route 0.0.0.0 0.0.0.0 10.0.1.1
ip route 0.0.0.0 0.0.0.0 10.0.2.1

With the interfaces active and up, you will find that devices connected to their respective VLAN via Access ports on the switch will route just fine to the switch for inter-vlan routing, and for outside access or to move into another network or the Internet, the ip routes you set will permit that traffic to go to the firewall/router.

| improve this answer | |
  • You make a lot of assumptions about the OP's network topology and hardware. – Ron Trunk Oct 5 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.