Set two default gateway?

Posted on 2003-03-30
Medium Priority
Last Modified: 2007-12-19
I have 3 Linux boxes.Let me first define the specs:
1.pc A with kernel > 2.4, ext eth-->adsl connection,int eth -->
2.pc B with kernel > 2.4, ext eth-->adsl connection,int eth -->
3.pc C with kernel 2.0.x, eth-->, gw-->

I'm hosting a download service on pc C. Currently, any incoming packets from pc A are forwarded to pc C so that users can download via connection on pc A. I have another ppp connection on pc B.  I want to configure the connection on pc B as a backup line to pc A. How do I make it in such a way that users can download from both connections on pc A and pc B? I've found out that users can only download from connection on pc B if I swith the default gateway of pc C to refer to pc B. Is it possible to have two default gateways on pc C, so that download from both connections could happen at the same time? Or are there any other ways to solve this? Please advice.
Question by:viansoo
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 51

Expert Comment

ID: 8234788

i.g. you cannot do it, simply ...
Have seen a question here where it has been discussed, not shure if the solution works (no link either).

What you want to do is usually done by a load balancer infront of the servers.
There're several load balabcing software available:

Accepted Solution

sprinkmeier earned 150 total points
ID: 8235678
Load ballancing usually menad 2 connections to the same ISP and requires support at both ends.

Having a backup default gateway is easy, just set it upas a static route with a higher metric that the primary.

details vary from distro to distro, but in RH7.1 all you do is mangle


to add

eth0 net gw metric192.168.8.1  0
eth0 net gw metric192.168.8.2  5

(going from memory, YMMV). The box __should___ use .2 if .1 becomes unresponsive. Alternativley add B as a backup gateway to A, the changeover will then be transparent yo C.

Author Comment

ID: 8236009
what do u mean by 'mangle' the /etc/sysconfig/static-routes. is it equivalent to 'vi' the static-routes. after adding the 2 lines into the file, do i need to restart the pc?

Expert Comment

ID: 8236036
vi, emacs, I'm not getting into that holy war ;-)

Restart the PC? What do you think this is, Windos?

ifdown eth0
ifup eth0

should be enough. actually,
/etc/sysconfig/network-scripts/ifup-routes eth0
should do the trick.

/etc/init.d/network restart
works too.

(sorry, being LINUX I feel obliged to point out several ways to skin the same cat)

Expert Comment

ID: 9077566
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question