How to configure Wireguard on the LPS8N/DLOS8N/LG308N

1. Configuration via command line

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

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

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