adamwalach / openvpn-web-ui

Web interface (with golang backend) for monitoring and administration of OpenVPN server
MIT License
673 stars 274 forks source link

No Internet #45

Open sameerlike141 opened 1 year ago

sameerlike141 commented 1 year ago

Vpn is connected but internet is not working can you please tell me what is the issue

noamansaiyed commented 1 year ago

The initial issue of the VPN connection remaining active but not transmitting any data was resolved by incorporating a masquerade rule within the openvpn container. This was achieved by accessing the openvpn container using the command and then implementing the following iptables rules:

docker exec -it openvpn /bin/bash
iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 172.16.0.0/12 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -j MASQUERADE

These rules effectively resolved the connectivity issue and allowed the desired traffic to flow through the VPN connection successfully.