I use a linux machine with two different internet connections as the default gateway of local network. Each internet conncetion has its own public ip address. I've used source routing with "ip rule" command to balance outgoing traffic between these two internet connections.
eth0 is the local network. eth1 and ppp0 are connected to the internet. the linux machine itself uses eth1 to connect to the internet.
Everything works fine except that I can't access ppp0 public IP from local network:
ping PPP0-PUBLIC-IP #works fine from the linux machine
ping PPP0-PUBLIC-IP #works fine from outside network
ping PPP0-PUBLIC-IP #**fails** from other machines on local network
Also:
$ip rule ls
0: from all lookup local
32763: from x.x.x.x lookup Home
32765: from 192.168.0.208/28 lookup Home
32766: from all lookup main
32767: from all lookup default
$ip route show table local
...
local x.x.x.x dev ppp0 proto kernel scope host src x.x.x.x
...
Where x.x.x.x is ppp0 public IP address. What am I doing wrong here? Why I can't ping ppp0 pulic IP address from local network but I can ping it from outside network?
Update: I use two iptables command to setup NAT. I'm not sure if it is the right way, but it works for me:
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
Update 2: When I ping the ppp0 public IP address from a machine on local network, tcpdump output on the gateway indicates that the packets arrives correctly from local network, but it seems that kernel is not delivering them to the application layer.