LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Multiple gateways for a host machiene (https://www.linuxquestions.org/questions/linux-networking-3/multiple-gateways-for-a-host-machiene-250971/)

Rajesh_Amma 11-04-2004 04:45 AM

Multiple gateways for a host machiene
 
Hi,

I have two different routers in my network. So for a host m/c some packets should be send thru one gateway and some packets in the othergateway. how can i specify multiple gateways in my host configuration. Pls help me in this regard

n0sr 11-04-2004 05:06 AM

You can use the route command to set up multiple routes. You need to know the router IP address and the interface it is connected to. For instance:

route add 192.168.1.1 eth0
route add 10.0.0.1 eth1
route add gw 192.168.1.1 metric 10
route add gw 10.0.0.1 metric 20

This will define the first router (with the IP address 192.168.1.1) as your first choice as a gateway using eth0. The second router (with the IP address 10.0.0.1) will be the second choice using eth1 if the first is unavailable. The "metric" value is arbitrary, whatever entry has the lowest number will be tried first. This would work if you have multiple routers connected to the Internet.

If you want to use the same network with two different routers you can do that as well using the same method above.

If you want to have different routers handle different protocols or ports then I think you'd have to use the firewall tools.

Does that help any?

Rajesh_Amma 11-04-2004 05:52 AM

Sorry my situation is slightly different , My proxy m/c is 192.168.1.1 this is the gw for accessing internet. To access my corporate network the gw is 192.168.1.5.
In this case how i will tell my client m/c to use the gw 192.168.1.1 for internet and for corporate network use thye gw 192.168.1.5 .Pls help

n0sr 11-04-2004 06:56 AM

Sorry, I don't deal with proxy configuration, so my knowledge is very limited. I know you can set the proxy settings on a "per application" basis, but if you use the same application (such as a web browser) you cannot set for both proxy and no-proxy situations unless you use Mozilla that allows for multiple profiles. Sorry I can't help further!


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