WireGuard Peers: Understanding Clients and Servers
In order to set up WireGuard on a router running OpenWRT, it is essential to understand the terms "client" and "server".
Client
A client is a device that connects to a server to request and receive services. In the context of WireGuard, a client is a device that initiates a connection to a server to establish a secure VPN tunnel.
Server
A server is a device that provides services to other devices. In WireGuard, a server is a device that listens for incoming connection requests from clients and establishes VPN tunnels.
Here's a simple example of a WireGuard configuration for a client and a server:
Client Configuration
[Interface]
Address = 10.0.0.2/24
PrivateKey = <Client Private Key>
[Peer]
PublicKey = <Server Public Key>
Endpoint = <Server IP Address>:51820
AllowedIPs = 0.0.0.0/0
Server Configuration
[Interface]
Address = 10.0.0.1/24
PrivateKey = <Server Private Key>
ListenPort = 51820
[Peer]
PublicKey = <Client Public Key>
Endpoint = <Client IP Address>:51820
AllowedIPs = 10.0.0.2/32
In this example, the client has the IP address 10.0.0.2 and the server has the IP address 10.0.0.1. The client's configuration includes the server's public key, endpoint (IP address and port), and allows all IP addresses (0.0.0.0/0) as it is a client. The server's configuration includes the client's public key, endpoint, and allows the client's IP address (10.0.0.2/32) as it is a server.
References:
- "WireGuard Router on OpenWRT". WireGuard Wiki. https://www.wireguard.com/docs/routers/openwrt/
- "WireGuard". The WireGuard Wiki. https://www.wireguard.com/
- "WireGuard Configuration". WireGuard Documentation. https://www.wireguard.com/docs/configuration/
- "OpenWRT". OpenWRT Documentation. https://openwrt.org/docs/