1

I have Two LAN

Local LAN: 172.30.30.0/24 with gw 172.30.30.254

Remote LAN : 192.168.2.0/24 with gw 192.168.2.1

both lan can communicate and ping each other devices.

i have introduce new machine 172.30.30.10 and set all 172.30.30.0/24 devices gateway to this ip.

I need to to forward all traffic to 172.30.30.10's eth0 >>> tun0 interface except there local inter-lan communication.

So what i have done till now is

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -i eth0 -o tun0 -j ACCEPT
iptables -A FORWARD -i tun0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
ip route add -net 192.168.2.0/24 gw 172.30.30.254 dev eth0 metric 101

So after this i am able to ping from 172.30.30.0/24 network to 192.168.2.0/24 and vice versa

but when the tun0 interface create after connecting to the vpn only one way ping happen 172.30.30.0/24 to 192.168.2.0/24 NOT vice versa.

What else can i do so that it can ping each other network even after connecting to vpn(tun0 interface)?

Robert
  • 11
  • 2

0 Answers0