Use Wireguard VPN in Dragino Gateways

Version 14.1 by Edwin Chen on 2023/12/30 18:28

Table of Contents:

1. What is Wireguard VPN?

WireGuard® is an extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more useful than IPsec, while avoiding the massive headache. It intends to be considerably more performant than OpenVPN. WireGuard is designed as a general purpose VPN for running on embedded interfaces and super computers alike, fit for many different circumstances. Initially released for the Linux kernel, it is now cross-platform (Windows, macOS, BSD, iOS, Android) and widely deployable. It is currently under heavy development, but already it might be regarded as the most secure, easiest to use, and simplest VPN solution in the industry.

Network Structure for WireGuard VPN:

image-20231121160528-1.png

2. Run WireGuard VPN in PC

There are many methods to install and set WireGuard server. Below is an example for reference to set up WireGuard Server in Windows.

Video Instruction: Install WireGuard Server in Windows.

For other OS and method, please search google for more.

3. Configure Wireguard VPN on Gatewaythe LPS8N/DLOS8N/LG308N

3.1 For LPS8N/DLOS8N/LG308N

Due to the size of Wireguard packages. We didn't add it as a default feature of gateways. If the user wants to use Wireguard Please upgrade your gateway firmware with the special firmware.

3.1.1 Configuration via command line

3.1.1.1 Key Management

#Generate keys

umask go=

wg genkey | tee wgserver.key | wg pubkey > wgserver.pub

wg genkey | tee wgclient.key | wg pubkey > wgclient.pub

wg genpsk > wgclient.psk

image-20231110150147-1.png

3.1.1.2 Firewall configuration

#Configure firewall

uci del_list firewall.wan.network="vpn"

uci add_list firewall.wan.network="vpn"

uci commit firewall

image-20231110151524-2.png

#Reload firewall

/etc/init.d/firewall

3.1.1.3 Network configuration

#Configure network

 uci -q delete network.vpn
 uci set network.vpn="interface"
 uci set network.vpn.proto="wireguard"
 uci set network.vpn.private_key="{VPN_KEY}"
 uci add_list network.vpn.addresses="{VPN_ADDRESS}"

image-20231110152122-4.png

#Add VPN peers

 uci -q delete network.wgserver
 uci set network.wgserver="wireguard_vpn"
 uci set network.wgserver.public_key="{VPN_PUB}"
 uci set network.wgserver.endpoint_host="{VPN_SERVER}"
 uci set network.wgserver.preshared_key="{VPN_PSK}"
 uci set network.wgserver.endpoint_port="{VPN_PORT}"
 uci set network.wgserver.persistent_keepalive="25"
 uci set network.wgserver.route_allowed_ips="1"
 uci add_list network.wgserver.allowed_ips="0.0.0.0/0"
 uci add_list network.wgserver.allowed_ips="::/0"
 uci commit network

image-20231110152109-3.png

#reload network service

/etc/init.d/network reload

 

Tags:
    
Copyright ©2010-2024 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0