Openvpn server not forwarding ping traffic from tun0 to eth0 for rest of the hosts in the subnet

Ok, I figured this out after a few hours of investigation.

The problem is with the forwarding setup. The packets forwarded to eth0 port does not have correct source ip address of the host within the network. The ip addressis from VPN.

05:07:43.991961 IP 10.8.0.6 > 10.10.146.8: ICMP echo request, id 3497, seq 499, length 64

You can switch that by enabling equivalent of NAT (on routers) in linux OS:

iptables -t nat -A POSTROUTING -o <eth0 or whatever else> -j MASQUERADE

This fixed the issue for me.

Tags:

Openvpn