In the following output, why does vpn1 route/ping to 10.100.0.1 instead of to 10.100.0.112?
10.100.0.1 is network gateway with no nat. 10.100.0.112 is dual home host with nat enabled.
root@vpn1:~# ip ro
8.8.8.8 via 10.100.0.112 dev eth0 src 10.100.0.5
10.100.0.0/24 dev eth0 proto kernel scope link src 10.100.0.5
default via 10.100.0.1 dev eth0 metric 100
root@vpn1:~# traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
1 10.100.0.1 (10.100.0.1) 0.287 ms 0.257 ms 0.317 ms
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * *^C
root@vpn1:~# ping 10.100.0.112
PING 10.100.0.112 (10.100.0.112) 56(84) bytes of data.
64 bytes from 10.100.0.112: icmp_req=1 ttl=127 time=0.321 ms
^C
--- 10.100.0.112 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.321/0.321/0.321/0.000 ms</br>
On the other side, 10.100.0.112 has a following configuration
boban@boban-desktop:~$ ip ro 10.100.0.114 dev ppp0 proto kernel scope link src 10.100.0.112 x.y.z.q/28 dev eth0 proto kernel scope link src x.y.z.56 metric 1 **10.100.0.0/16 dev ppp0 scope link** default via x.y.z.62 dev eth0 proto static
So, network 10.100.0.0/16
is on ppp0
interface, vpn (maybe this is of bigger importance than I think).
boban@boban-desktop:~$ sudo iptables -t nat -S -P PREROUTING ACCEPT -P INPUT ACCEPT -P OUTPUT ACCEPT -P POSTROUTING ACCEPT -A POSTROUTING -o eth0 -j MASQUERADE boban@boban-desktop:~$ sudo iptables -S -P INPUT ACCEPT -P FORWARD ACCEPT -P OUTPUT ACCEPT