VPN WireGuard
ΠΠ°ΡΡΡΠΎΠΉΠΊΠ°
link: https://www.wireguard.com/quickstart/
wg
β wireguard configure utility.
Configure
Add new interface:
ip link add dev wg0 type wireguard
(orwireguard-go wg0
)An IP address and peer can be assigned with ifconfig(8) or ip-address(8):
ip address add dev wg0 192.168.2.1/24
Or, if there are only two peers total, something like this might be more desirable:ip address add dev wg0 192.168.2.1 peer 192.168.2.2
The interface can be configured with keys and peer endpoints with the included wg(8) utility:
wg setconf wg0 myconfig.conf
orwg set wg0 listen-port 51820 private-key /path/to/private-key peer ABCDEF... allowed-ips 192.168.88.0/24 endpoint 209.202.254.14:8172
The interface can then be activated with ifconfig(8) or ip-link(8):
ip link set up dev wg0
There are also the wg show
and wg showconf
commands, for viewing the current configuration. Calling wg
with no arguments defaults to calling wg show
on all WireGuard interfaces.
Key Generation
Use configs
Generate key pairs for client and server:
Create server and client configs:
Server (/etc/wireguard/wg0.conf):
Client (/etc/wireguard/wg0.conf):
Up wireguard interface:
Server: sudo wg-quick up /etc/wireguard/wg0.conf
(we can use systemd
: sudo systemctl start wg-quick@wg0.service
)
Client: sudo wg-quick up /etc/wireguard/wg0.conf
ΠΡΠ΅ ΡΡΠ°ΡΡΠΈ ΠΏΡΠΎ wireguard
ΠΡΠΎ Π½Π°ΡΡΡΠΎΠΉΠΊΡ ΠΊΠ»ΠΈΠ΅Π½ΡΠΎΠ² Π·Π° NAT: https://habr.com/en/post/481838/
Last updated