LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   I want to configure multi defaultway in the linux kernel 2.6.16,is it OK? (https://www.linuxquestions.org/questions/linux-networking-3/i-want-to-configure-multi-defaultway-in-the-linux-kernel-2-6-16-is-it-ok-659165/)

kentcui 07-30-2008 12:05 AM

I want to configure multi defaultway in the linux kernel 2.6.16,is it OK?
 
So I can type the command in the CLI ;

route add default gw1
route add default gw2

and also I can see the routing table of multi gateway
with the command route -an;

but I want to make it sure that this kernel can support
the multi default gateway settings;

and the problem is how can I edit the /etc/sysconfig/network file
to make the multi default gateway settings will work after reboot
the system?

Thanks for your replies,and advices.

uncle_philip 07-30-2008 12:17 AM

sorry, if I'm wrong.
your computer can have multi-network cards to act as the gatway for different subnets. But your computer can only have single default gateway. Eg., when you type "yahoo.com" the computer will know how to get there, otherwise, the computer doesn't know where to go, from gw1 or gw2.

billymayday 07-30-2008 12:23 AM

Why are you trying to do this - is it because you think you need to (you don't) or are you trying to set up load sharing or something else?

kentcui 07-30-2008 12:40 AM

yeah, because I will have 2 ISP leasedlines,

and I want to configure the current linux gateway server with multi default gateways,

So It can running as a loardbalancing devices,,,I think,

and I tried in test environment,,the result is if just use the

route add default gw1
route add default gw2

the traffic can only go throuh the first gateway,,,

kentcui 07-30-2008 12:42 AM

The second question is how to balance traffic going out over the twoproviders.
This is actually not hard if you already have set up split accessas above.
Instead of choosing one of the two providers as your default route, you nowset up the default route to be a multipath route. In the default kernel thiswill balance routes over the two providers.
It is done as follows (once morebuilding on the example in the section on split-access):

ip route add default scope global nexthop via $P1 dev $IF1 weight 1 \
nexthop via $P2 dev $IF2 weight 1

This will balance the routes over both providers.
The weight parameters canbe tweaked to favor one provider over the other.
Note that balancing will not be perfect, as it is route based, and routes are cached.
This means that routes to often-used sites will always be over the same provider.
Furthermore, if you really want to do this, you probably also want to look at Julian Anastasov's patches at http://www.ssi.bg/~ja/#routes , Julian's route patch page. They will make things nicer to work with

I find a webpage with the words above...
Is it will be OK....

kentcui 07-30-2008 09:23 PM

more informations about the multi default gateways;

Kernel Configuration

Linux kernels 2.2 and above support advanced routing techniques that are required to provide load balancing and multiple default routes on a Linux host. The following kernel networking options must be compiled into the kernel to support multiple connections to the Internet:


CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_MULTIPATH=y

To access the advanced routing features of the new kernel, the iproute toolset must be installed. (It is now distributed with Red Hat 7.1) The iproute toolset is available from:

ftp://ftp.inr.ac.ru/ip-routing/


All times are GMT -5. The time now is 05:57 PM.