(wlan0 -> tun0) Ubuntu desktop "A" (eth0) -> (eth0) other Ubuntu desktop "B"

I have an OpenVPN connection on "A". OpenVPN server is from a Mikrotik RouterBoard.

I need to forward the OpenVPNs network to "B". So that "B" would get an IP from the OpenVPN server via DHCP.

"A" originally got the internet connection from wlan0. The OpenVPN goes through wlan0 to get to the OpenVPN server.

I am physically connecting the two ethX'es. I bring up IP on both ethX in the same subnet.

So on "A" I am doing:

pkill nm-applet
service iptables stop
iptables -t nat -I POSTROUTING -o tun0 -j MASQUERADE
echo '1' > /proc/sys/net/ipv4/ip_forward

But even from tcpdump I cannot see any traffic from "B" to "A" even if I do pings. Why?

  • MASQUERADE rule only does address translation when B already has an IP address. B does not get an IP address an IP address from OpenVPN server. That would require layer 2 bridging, so that DHCP packets could reach OpenVPN server. Or you could set up a DHCP relay on A to get IP address from the OpenVPN server. Jan 8 at 16:36


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.