跳转到内容
Ask AI

WireGuard Configuration

此内容尚不支持你的语言。

[Command] show wireguard statusid

[Purpose] Display wireguard status

[View] System view

[Use Cases]

sonic# show wireguard status 1
interface: Wg1
Public Key: YvzvpPNpUu9hKC1yxh2OOpSQM1hF6NOt0GAYXSaJdmo=
private key: (hidden)
listening port: 51820
peer: Ey1F+q49I6hPXGBoqryuATqgCyg2cNJWPFzi3jYfnjY=
endpoint: 20.0.0.153:51820->30.0.0.100:51820
allowed ips: 10.0.0.0/24,90.0.0.0/24

[Command] show wireguard configid

[Purpose] Display wireguard configuration

[View] System view

[Use Cases]

sonic# show wireguard config 1
ip4 listen_port 51820 private_key UFnTg/3VsDmc6QGimqiSL66FZcBnV/4UiSOcot+gkGw= intf_addr 10.0.0.1/24
peer ip4 public_key YZKmpdlJN+lFlsVFxy9zKdHsdzN8j5BpWjjEgoKucj8=
peer public_key YZKmpdlJN+lFlsVFxy9zKdHsdzN8j5BpWjjEgoKucj8= allowed_ip 0.0.0.0/0

[Command] genkey

[Purpose] Generate WireGuard keys

[View] Wireguard configuration view

[Use Cases]

sonic(config-wireguard-1)# genkey
Private Key: UFnTg/3VsDmc6QGimqiSL66FZcBnV/4UiSOcot+gkGw=
Public Key: YZKmpdlJN+lFlsVFxy9zKdHsdzN8j5BpWjjEgoKucj8=

[Command] ip4 listen_portportprivate_keystringintf_addrA.B.C.D/M no ip4

[Purpose] Configure WireGuard’s listening port, private key, and IPv4 address.

[View] Wireguard configuration view

[Parameter]

ParameterDescription
listen_portwireguard listening port
private_keyLocal private key
inft_addrIPv4 address of the WireGuard tunnel

[Use Cases]

sonic(config-wireguard-1)# ip4 listen_port 51820 private_key UFnTg/3VsDmc6QGimqiSL66FZcBnV/4UiSOcot+gkGw= intf_addr 10.0.0.1/24

[Command] ip6 listen_portportprivate_keystringintf_addrA::B/M no ip6

[Purpose] ip6 listen_port port private_key string intf_addr A::B/M

[View] Wireguard configuration view

[Parameter]

ParameterDescription
listen_portwireguard listening port
private_keyLocal private key
inft_addrIPv6 address of the WireGuard tunnel

[Use Cases]

sonic(config-wireguard-1)# ip6 listen_port 51820 private_key UFnTg/3VsDmc6QGimqiSL66FZcBnV/4UiSOcot+gkGw= intf_addr 2000::1/64

[Command] mtuvalue

[Purpose] Configuring the MTU for the WireGuard tunnel

[View] Wireguard configuration view

[Use Cases]

sonic(config-wireguard-1)# mtu 1000

[Command] nat-zoneid no nat-zone

[Purpose] Configuring NAT traversal for WireGuard tunnels

[View] Wireguard configuration view

[Parameter]

ParameterDescription
nat-zoneThe default value is 0, meaning NAT functionality is disabled. When configured as 1 to 3, NAT conversion functionality is enabled.

[Use Cases]

sonic(config-wireguard-1)# nat-zone 1

[Command] peer {ip4|ip6} public_keykey**[endpoint_ipA.B.C.Dendpoint_portport] [persistent_keepaliveint]** no peer {ip4|ip6} public_keykey

[Purpose] Configure the WireGuard peer’s public key and IP settings. When the endpoint_ip is not configured, it will passively receive peer requests and learn the peer’s IP and port.

[View] Wireguard configuration view

[Parameter]

ParameterDescription
public_keyThe public key of the remote end
endpoint_ipThe ip address of the remote end
endpint_portThe port of the remote end
persistent_keepaliveTunnel survival time

[Use Cases]

sonic(config-wireguard-1)# peer ip4 public_key YZKmpdlJN+lFlsVFxy9zKdHsdzN8j5BpWjjEgoKucj8= endpoint_ip 1.1.1.1 endpoint_port 51820 persistent_keepalive 300

[Command] peer public_keykeyallowed_ipA.B.C.D/M

[Purpose] Configure the WireGuard peer’s public key and allowed IP list

[View] Wireguard configuration view

[Parameter]

ParameterDescription
public_keyThe public key of the remote end
allowed_ipAllowed IP list for encryption and decryption

[Use Cases]

sonic(config-wireguard-1)# peer public_key YZKmpdlJN+lFlsVFxy9zKdHsdzN8j5BpWjjEgoKucj8= allowed_ip 10.0.0.0/24,20.0.0.0/24