本文最后更新于 621 天前,其中的信息可能已经有所发展或是发生改变。
整这个东西的起因,还是因为校园网ssh
出口流量被禁,不能远程ssh
连接我家里的服务器,打算组个内网,实现校园网ssh
Install WireGuard
apt install openresolv wireguard
GenKey
wg genkey | tee server_privatekey | wg pubkey > server_publickey
wg genkey | tee client_privatekey | wg pubkey > client_publickey
Server Config
- path: /etc/wireguard/wg0.conf
[Interface]
PrivateKey = server_privatekey
Address = 10.10.10.1/24
DNS = 8.8.8.8
MTU = 1420
ListenPort=50505
[Peer]
PublicKey = client_publickey
AllowedIPs = 10.10.10.2/32
Client Config
- path: /etc/wireguard/wg0.conf
[Interface]
PrivateKey = client_privatekey
Address = 10.10.10.2/24
DNS = 8.8.8.8
MTU = 1420
[Peer]
PublicKey = server_publickey
AllowedIPs = 10.10.10.1/32
Endpoint = ip:port
Start and Stop
systemctl start wg-quick@wg0
systemctl stop wg-quick@wg0