This walks you through setting up and managing three major VPN protocols: WireGuard, OpenVPN, and IPSec with strongSwan. You get installation commands for Debian and RHEL families, complete server and client configs, and certificate generation workflows. The WireGuard section is especially practical with key generation one-liners and a script for adding new users. It covers common scenarios like site-to-site tunnels and split tunneling, plus troubleshooting commands for when handshakes fail or routing breaks. If you're deploying VPNs on Linux and need working configs instead of theory, this gives you copy-paste starting points for all three stacks with the actual iptables rules and systemd commands you'll need.
- skills.sh installs
- 194
- GitHub stars
- 59
- last updated
- Aug 21, 2026
Install
$ npx -y skills add chaterm/terminal-skills --skill vpn --agent claude-codeInstalls into .claude/skills of the current project.
Files
VPN 配置与管理
概述
OpenVPN、WireGuard、IPSec VPN 配置与管理技能。
WireGuard
安装
# Debian/Ubuntu
apt install wireguard
# CentOS/RHEL
yum install epel-release elrepo-release
yum install kmod-wireguard wireguard-tools
# 验证安装
wg --version
生成密钥
# 生成私钥
wg genkey > privatekey
# 从私钥生成公钥
wg pubkey < privatekey > publickey
# 一步生成
wg genkey | tee privatekey | wg pubkey > publickey
# 生成预共享密钥(可选,增强安全)
wg genpsk > presharedkey
服务端配置
# /etc/wireguard/wg0.conf
[Interface]
Address = 10.0.0.1/24
ListenPort = 51820
PrivateKey = <server_private_key>
# 启用 IP 转发
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
[Peer]
PublicKey = <client_public_key>
AllowedIPs = 10.0.0.2/32
客户端配置
# /etc/wireguard/wg0.conf
[Interface]
Address = 10.0.0.2/24
PrivateKey = <client_private_key>
DNS = 8.8.8.8
[Peer]
PublicKey = <server_public_key>
Endpoint = server.example.com:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
管理命令
# 启动
wg-quick up wg0
systemctl start wg-quick@wg0
Sponsors
Details
- Repository
- github.com/chaterm/terminal-skills
- Category
- CLI & Terminal
- First seen
- Jun 3, 2026
