
Three lines on the server
push "redirect-gateway def1"
push "dhcp-option DNS 1.1.1.1"
push "block-ipv6"def1 adds two more specific routes over the default one, so it is back by itself when you disconnect. If the server has no IPv6, block-ipv6 keeps IPv6 traffic from slipping past.
Forwarding and rewriting
echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/99-ovpn.conf
sudo sysctl --system
sudo iptables -t nat -A POSTROUTING -s 10.9.0.0/24 -o eth0 -j MASQUERADEFind the interface name with ip route get 1.1.1.1.
DNS on Windows
Windows asks several DNS servers at once and takes the fastest. Add block-outside-dns to the client profile and the other adapters' DNS is no longer used.
Check it
| Look at | It should show |
|---|---|
| A what-is-my-IP site | The server's address |
| A DNS leak test | Only the one you pushed |
| An IPv6 test | No address, or the server's |
No internet once connected?
Usually the wrong interface in the NAT rule, or forwarding is off.
Only part of the traffic?
Remove redirect-gateway and push a few routes instead.
Walk onIssue and revoke papers