Question

OpenVPN with IPv4 and IPv6

  • Posted October 12, 2020
  • VPN

I’m creating a server with OpenVPN to mask my IP address using this [article](https://www.digitalocean.com/community/tutorials/how-to-set-up-and-configure-an-openvpn-server-on -ubuntu-20-04-en) from DigitalOcean.

The setup worked perfectly when I configure Redirect All Traffic Through the VPN, all my accesses on sites with IPv4 display the Droplet’s IP.

The problem occurs when I access sites that accept IPv6, in these cases the displayed address is that of my ISP.

Below the line

net.ipv4.ip_forward = 1

I added the value

net.ipv6.conf.all.forwarding = 1

but nothing happened.

How do I also enable the use of the Droplet’s IPv6?

Subscribe
Share

I made these changes to the configuration files and it worked. But are they correct and secure?

/etc/openvpn/server.conf

server-ipv6 fd00:b956:4dc2::/64
push "route-ipv6 2000::/3"
push "dhcp-option DNS 2001:4860:4860::8888"
push "dhcp-option DNS 2001:4860:4860::8844"

/etc/ufw/before6.rules

# START OPENVPN RULES
# NAT table rules
*nat
:POSTROUTING ACCEPT [0:0] 
# Allow traffic from OpenVPN client to eth0
-A POSTROUTING -s fd00:b956:4dc2::/64 -o eth0 -j MASQUERADE2a03:7720::1fe
COMMIT
# END OPENVPN RULES

/etc/sysctl.conf

net.ipv6.conf.all.forwarding = 1

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!