Linux – IP route ppp0 + eth0 access to outside network

linuxnetworking

I need some help in define a route I have two connections one from eth0 and other a ppp0 (a 3G card) Not having the ppp0 connection active my route table is:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         DD-WRT          0.0.0.0         UG    100    0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0

I can access my webserver from an outside network through ethernet interface Than I have also my ppp0 3G connection active havig the following route table:

D

estination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.64.64.64     0.0.0.0         UG    0      0        0 ppp0
10.64.64.64     *               255.255.255.255 UH    0      0        0 ppp0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0

Now I only can access my webserver in outside networks through the IP of the 3G connection Note that my server is serving at 0.0.0.0 IP (to all interfaces) But I need to get access to webserver to both interfaces ethernet and 3G connection I only can have access to both connection in local network

Any help to configure this network to have both interfaces with outside networks access is welcome


Can anyone give me an example to configure this network with 2 gateways to give outside networks access
One for IP 192.168.1.149 and other for the ppp0 IP 89.214.60.196

Tanks

Best Answer

You can only have 1 default route that in a routing table and and it be useful.

If you want to have multiple default routes in Linux, then you have to setup multiple route tables, and then setup rules that tell your system which table should be used.

Within a single route table you can still use both connections by creating routes for specific destination networks. You can say everything to 10.2.0.0/16 crosses one interlace and everything else uses over the other.

See the Linux Advanced Routing HOWTO.