> For the complete documentation index, see [llms.txt](https://documentation.hak5.org/lan-turtle-hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.hak5.org/lan-turtle-hub/payload-development/duckyscript-for-lan-turtle/wireguard.md).

# WIREGUARD

WireGuard is a modern VPN protocol which is highly efficient, especially on embedded devices.  Using the WireGuard VPN requires a WireGuard server on an accessible network.

## WIREGUARD\_CONFIGURE

A WireGuard configuration can often be complex. &#x20;

The simplest way to configure a WireGuard VPN with the WIREGUARD\_CONFIGURE command is to provide a configuration file.  Most VPN services and management systems can create a WireGuard configuration file, or one can be manually created with a text editor.

If a configuration file is not used, all options must be specified on the WIREGUARD\_CONFIGURE command line.

### Options

```
WIREGUARD_CONFIGURE disable
WIREGUARD_CONFIGURE enable [wg.conf]
WIREGUARD_CONFIGURE enable [server-ip] [server-port] [server-pubkey] 
    [server-psk | NONE] [private-key | AUTO] [local-ip] 
    [ipv4-networks | NONE] [ipv6-networks | NONE]
```

#### disable

Disable the WireGuard service.  This is the same as running `WIREGUARD_DISABLE`.

#### enable \[wg.conf]

Configure the WireGuard service using a configuration file.  The *wg.conf* parameter should be a path to the configuration file, such as `/usb/wg.conf`.

To enable an existing configuration, use the `WIREGUARD_ENABLE` command.

#### server-ip

The IP address of the WireGuard server

#### server-port

The port the WireGuard service is configured for on the server

#### server-pubkey

The WireGuard public key for the server.  This must match the public key used in the server, and will be provided by the VPN provider or can be found in the server configuration.

#### server-psk

The PSK (key) of the server, or *NONE* if public-key authentication is not used.

#### private-key

The private key of this client.  Private keys are generated with the *wg* command, or provided by the VPN server.  The private key must match the public key of this client in the VPN server records.

If *AUTO* is specified, a key will be automatically generated and the public key will be printed by the configuration command when the configuration is complete.

#### local-ip

The local (VPN) address assigned to this client.  This must match the IP assigned by the VPN server.

#### ipv4-networks

A comma-separated list of IPv4 networks which will be routed over this VPN connection, such as `192.168.99.0/24,192.168.100.0/24` . &#x20;

The VPN server must be configured to allow this network routing.

If no additional IPv4 networks are to be routed, specify *NONE*.

#### ipv6-networks

A comma-separated list of IPv6 networks which will be routed over this VPN connection.

The VPN server must be configured to allow this network routing.

If no IPv6 networks are to be routed, specify *NONE*.

## WIREGUARD\_ENABLE&#x20;

To enable an already-configured WireGuard server, use the `WIREGUARD_ENABLE` command.

This command will only succeed if WireGuard has already been configured.

## WIREGUARD\_DISABLE

To disconnect and disable WireGuard, use the `WIREGUARD_DISABLE` command.
