openvpn.is
English
简体中文繁體中文EnglishРусскийفارسی

HomeBlogError

Through the gate, and no road

OpenVPN is connected but pages do not open: tell DNS from routing, check forwarding, the NAT interface name, redirect-gateway and the firewall.

Compiled on

Over the bridge and through the gate, a road has to follow
Over the bridge and through the gate, a road has to follow Krzysztof Golik, CC BY-SA 4.0

The log says Initialization Sequence Completed and the icon is green, yet nothing loads. You are through the gate but the road is missing.

Connected only means the tunnel exists. Three more things must be right: the computer sends traffic into it, the server forwards, and names resolve. Three places, so take them one at a time.

First find out which

  1. ping 10.9.0.1Works: the tunnel is fine
  2. ping 1.1.1.1Fails: route, forwarding or NAT
  3. ping example.comThe one above works and this fails: DNS
Three commands
A dead end: connected but no internet usually means routing or forwarding is off
A dead end: connected but no internet usually means routing or forwarding is off Scotted400, CC0

Routes, forwarding, NAT

CheckCommand
Is forwarding onsysctl net.ipv4.ip_forward should be 1
Is there NATsudo iptables -t nat -S has 10.9.0.0/24
Is the interface rightip route get 1.1.1.1, see dev
Does ufw forwardSet DEFAULT_FORWARD_POLICY to ACCEPT

Most often eth0 was copied from a guide and the machine says ens3.

DNS

The server pushes DNS and the client does not use it:

  • Windows: add block-outside-dns to the client profile.
  • Linux command line: install openvpn-systemd-resolved.
  • An internal DNS server: check that it answers 10.9.0.0/24.
A hedge maze: check routes, forwarding, NAT and DNS in order
A hedge maze: check routes, forwarding, NAT and DNS in order Joseolgon, CC0

Only some sites fail

Small pages open and big ones spin: the packets are too large. Add one line on both sides:

Both ends
mssfix 1360

Routes on the computer

Windows
route print -4 | findstr "0.0.0.0"
ipconfig /all | findstr /i "dns 10.9.0"
macOS, Linux
netstat -rn | grep -E "default|^0/1|^128"
ip route

For all traffic there should be 0.0.0.0/1 and 128.0.0.0/1 through the tunnel. If not, the server did not push redirect-gateway or the client may not change routes; look for Access is denied in the log and check that OpenVPN Interactive Service runs.

Forwarding on the server

Server
sysctl net.ipv4.ip_forward                 # should be 1
ip route get 1.1.1.1                       # the name after dev
sudo iptables -t nat -S | grep -i masq     # the same name
sudo iptables -S FORWARD | head            # is the policy DROP

Docker sets the FORWARD policy to DROP, which costs many people an evening:

Server, interface as yours
sudo iptables -I FORWARD -i tun0 -j ACCEPT
sudo iptables -I FORWARD -o tun0 -m state --state RELATED,ESTABLISHED -j ACCEPT

With nftables look at sudo nft list ruleset; with firewalld allow forwarding and masquerade. Save the rules, or a restart loses them.

Four ways DNS breaks

SymptomCauseCure
Addresses work, no namesThe pushed DNS is unreachableAnother one
Some names slow or wrongLocal DNS still usedblock-outside-dns on Windows
Company names failNot the company's DNSHave it and the suffix pushed
Names fail after disconnectingNot restoredipconfig /flushdns, restart the adapter

The plain openvpn command on Linux does not touch the system's DNS.

Inside works, internet not, or the reverse

Only inside: the server is meant for that, or NAT is missing. Only internet: push "route ..." is missing, or devices inside do not know the way back, see into the office. Sending only the office through the tunnel is perfectly normal, and then your visible IP does not change.

On phones

  • The server pushes IPv6 routes without having IPv6: push "block-ipv6".
  • Android's private DNS is a fixed name: set it to automatic.
  • Seamless Tunnel in Connect blocks everything while reconnecting.
No internet after disconnecting?

The routes were not restored. Restart the adapter, or connect again and disconnect properly.

Internal network works, internet does not?

The server does not push redirect-gateway, or pushes it without NAT. Decide which you want.

The local printer stopped working?

Usually still reachable unless networks clash; change yours.

So slow it feels offline?

MTU, perhaps: mssfix 1360 on both ends.

It drops and returns?

Restart over and over in the log is usually one certificate on two devices.

Walk on

Nearby gates

Signposts: OpenVPN no internet, OpenVPN connected no internet, OpenVPN cannot ping