← 返回命令列表

Linux command

wg 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Check

sudo wg

Generate

wg genkey

Generate

wg pubkey < [path/to/private_key] > [path/to/public_key]

Generate

wg genkey | tee [path/to/private_key] | wg pubkey > [path/to/public_key]

Show

sudo wg showconf [wg0]

说明

wg is the configuration utility for WireGuard, a modern VPN tunnel. It manages WireGuard interfaces including key generation, peer configuration, and status monitoring. WireGuard uses state-of-the-art cryptography and is designed to be simpler, faster, and more secure than traditional VPN protocols like OpenVPN or IPsec.

参数

show
Show current configuration and status
showconf _interface_
Show configuration in config file format
genkey
Generate a new private key
pubkey
Generate public key from private key on stdin
genpsk
Generate a preshared key
set _interface_ _options_
Change configuration of an interface
setconf _interface_ _file_
Apply configuration from file
addconf _interface_ _file_
Add configuration from file

FAQ

What is the wg command used for?

wg is the configuration utility for WireGuard, a modern VPN tunnel. It manages WireGuard interfaces including key generation, peer configuration, and status monitoring. WireGuard uses state-of-the-art cryptography and is designed to be simpler, faster, and more secure than traditional VPN protocols like OpenVPN or IPsec.

How do I run a basic wg example?

Run `sudo wg` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does show do in wg?

Show current configuration and status