Linux – Configure 2 gateways ppp0 + eth0

linuxnetworking

I have a server serving at 0.0.0.0 (for all interfaces)
And my machine has 2 connections one ethernet eth0 and other a ppp0 (3G card)
First without the ppp0 connection active I have the following route table:

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 server on local and outside networks

Next I have de ppp0 connection also active and have the following route table:

Destination     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 my server can be accessed by both IP'S (192.168.1.149(local IP) and 89.214.60.196 (3g card)) but only in local network, in an outside network only ppp0 interface can be reached.

I need some help to configure 2 gateways one for this 192.168.1.149 and other for the ppp0 interface

Any help is welcome
Regards

Best Answer

you'll need to configure policy-based routing so packets that are response to traffic comming via ppp0 will leave the box via ppp0 [with the ip assigned to it], and similarly for eth0.

take a look at: