Connect another device with WireGuard
If your router or system has no guide of its own, these steps work for any device that runs WireGuard. They are the same steps every guide follows.
Steps in Inbound only
Load the configuration
If your device accepts WireGuard files, import the
.confas it is. If not, create a WireGuard interface with your private key (thePrivateKeyline) and the tunnel address (theAddressline).Add your node as a peer
On that interface add a peer with your node’s public key (
PublicKey), the preshared key (PresharedKey), theEndpointfrom your file (your address and port51820), theAllowedIPsfrom your file and a keepalive of 25 seconds.Check the route into the tunnel
Some routers do not create routes from
AllowedIPs. If yours does not, add a route to10.77.0.0/24through the tunnel interface.Let the tunnel traffic through
In the device’s firewall, allow what arrives through the tunnel from
10.77.0.1to the devices and ports you are going to map. The rule goes before any rule that blocks.Check the handshake
In the panel, inside your site, the device shows its last handshake a few seconds ago. If it still says “Never connected” after a couple of minutes, see when there is no handshake.
If the site is not in Inbound only
When you add the device, the panel shows your router’s recipe for the site’s mode, with your values. This is what each mode does:
“Inbound, keeping the client’s address”: your file comes with AllowedIPs = 0.0.0.0/0, to accept the real IPs of whoever connects, and Table = off, so the device does not change its default route. The device also needs:
- To mark new connections that arrive through the tunnel.
- A separate routing table, whose only route is a default route into the tunnel, for the packets of those connections. That way only the replies go back through the tunnel.
- Its usual default route, through your provider, for everything else.
- The firewall rule from any source to the devices and ports you map.
“Outbound through the tunnel”, only with outbound through your address approved: AllowedIPs = 0.0.0.0/0, a route to your address through your provider, the default route through the tunnel and, where the device allows it, your provider’s at a lower priority, so the site keeps internet if the tunnel goes down. Your LAN’s networks must be in the device’s “Networks behind the router”.
In all three modes, no NAT or masquerade into the tunnel: it would hide the real IP of whoever connects.