Install and configure Wireguard client on OpenWrt router

Hello !
Please help me to configure my Wireguard VPN server and client !
I worked a couple of days but still no results...
With current configuration both on the server and the client I managed to obtain only :
-Server can't ping the client;
-A PC from my LAN having 192.168.1.5 IP address, under the OPEN WRT router can ping both the VPN server on 10.6.0.1 address and the local OPEN WRT router on on 10.6.0.11 address.

I want to be able to redirect all the traffic of my LAN network through MVPS Wireguard Server and I also want to be able to connect to my LAN network through MVPS Wireguard Server from a remote location using a laptop with Wireguard client installed.
Please tell me the MTU value used on MVPS.NET servers and please tell me which is my server DNS address.

I attached a diagram of my LAN network and the configuration for the VPN server, the VPN client and the firewall from the server. The file is on this link : https://we.tl/t-zjlJ2BAh2U
The server is running Ubuntu 22, the router client is running OpenWRT 22 and the laptop is running Windows 10.
Please help me to solve my problem !
Thank You Very Much !

The file is on this link : https://we.tl/t-zjlJ2BAh2U

@lmax25 - a few things:

  1. Please post your images in the forum directly -- it is much better to have the images in-line than to use external links. Please remove those links.

  2. For your questions about mvps, you should look to them for support. This forum doesn't offer support for other services.

  3. It's not clear to me how mvps is involved here (maybe your diagram shows that, but I'm not willing to click on those links)... where is the ubuntu server in the equation?

  4. Is the laptop simply a host behind the OpenWrt router, or are you asking for support for that, too?

  5. If you have issues with wireguard (or any openwrt issue), you need to post your config so that people can understand the context.

Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

cat /etc/config/network
cat /etc/config/firewall

And you'll also need to post the 'server' configuration.

Sorry for the confusion !
I didn't know about the posibility to upload images here, on this forum !
Here is my network diagram, the OPENWRT client configuration, laptop configuration.
My Ubuntu 22 server is hosted by MVPS.NET.
Thank you for understanding !

#UBUNTU SERVER 22 WG0.CONF FILE
[Interface]
Address = 10.6.0.1/24
MTU = 1360
SaveConfig = true
PreUp = iptables --table nat --append POSTROUTING --jump MASQUERADE --out-interface eth0
PostUp = ufw route allow in on wg0 out on eth0
PostUp = iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
PostUp = ip6tables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
PreDown = ufw route delete allow in on wg0 out on eth0
PreDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
PreDown = ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
ListenPort = 33333
PrivateKey = SERVER PRIVATE KEY ZZZZZZZZZZZZZZZZZZZZZZZZ

#THIS IS THE OPENWRT ROUTER CLIENT
[Peer]
PublicKey = OPENWRT CLIENT PUBLIC KEY XXXXXXXXXXXXXXXXXXXXXXXX
AllowedIPs = 10.6.0.11/24


#THIS IS THE LAPTOP RUNNING WINDOWS CLIENT
[Peer]
PublicKey = WINDOWS CLIENT PUBLIC KEY YYYYYYYYYYYYYYYYYYYYYYYYYYY
AllowedIPs = 10.6.0.124/24

#Server UFW Status

root@vps:~# ufw status
Status: active

To                         Action      From
--                         ------      ----
33333/udp                  ALLOW       Anywhere
22/tcp                     ALLOW       Anywhere
OpenSSH                    ALLOW       Anywhere
53                         ALLOW       Anywhere
80                         ALLOW       Anywhere
443                        ALLOW       Anywhere
33333/udp (v6)             ALLOW       Anywhere (v6)
22/tcp (v6)                ALLOW       Anywhere (v6)
OpenSSH (v6)               ALLOW       Anywhere (v6)
53 (v6)                    ALLOW       Anywhere (v6)
80 (v6)                    ALLOW       Anywhere (v6)
443 (v6)                   ALLOW       Anywhere (v6)







Instead of screen shots from OpenWrt, please post your config in text form...

And since there is another system involved, you'll need to post the config of the windows laptop's WG setup.

Here are my configuration files :
Network.config.file.TXT

 OpenWrt 22.03.2, r19803-9a599fee93
 -----------------------------------------------------
root@OpenWrt-Linksys-WRT3200ACM:~# cat /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd91:a29d:833c::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config device
        option name 'wan'
        option macaddr 'c6:41:1e:36:be:b0'

config interface 'wan'
        option device 'wan'
        option proto 'pppoe'
        option password 'EDITED PASSWORD'
        option ipv6 'auto'
        option metric '1'
        option username 'EDITED USERNAME'
        option peerdns '0'
        list dns '8.8.8.8'
        list dns '8.8.4.4'

config interface 'wan6'
        option device 'wan'
        option proto 'dhcpv6'

config interface 'wanb'
        option proto 'dhcp'
        option device 'lan1'
        option metric '2'

config interface 'WG0'
        option proto 'wireguard'
        option private_key 'EDITED KEY'
        list addresses '10.6.0.2/24'
        list addresses 'fd42:190:190::2/128'
        option peerdns '0'
        list dns '8.8.8.8'
        list dns '8.8.4.4'

config wireguard_WG0
        option description 'OPENWRT ROUTER.conf'
        option public_key 'EDITED KEY'
        option preshared_key 'EDITED KEY'
        list allowed_ips '0.0.0.0/0'
        list allowed_ips '::/0'
        option endpoint_host 'EDITED IP'
        option endpoint_port '47676'
        option persistent_keepalive '25'
root@OpenWrt-Linksys-WRT3200ACM:~# cat /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd91:a29d:833c::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config device
        option name 'wan'
        option macaddr 'c6:41:1e:36:be:b0'

config interface 'wan'
        option device 'wan'
        option proto 'pppoe'
        option password 'EDITED password'
        option ipv6 'auto'
        option metric '1'
        option username 'EDITED username'
        option peerdns '0'
        list dns '8.8.8.8'
        list dns '8.8.4.4'

config interface 'wan6'
        option device 'wan'
        option proto 'dhcpv6'

config interface 'wanb'
        option proto 'dhcp'
        option device 'lan1'
        option metric '2'

config interface 'WG0'
        option proto 'wireguard'
        option private_key 'EDITED KEY'
        list addresses '10.6.0.2/32'
        list addresses 'fd42:190:190::2/128'
        option peerdns '0'
        list dns '8.8.8.8'
        list dns '8.8.4.4'

config wireguard_WG0
        option description 'OPENWRT ROUTER.conf'
        option public_key 'EDITED KEY'
        option preshared_key 'EDITED KEY'
        list allowed_ips '0.0.0.0/0'
        list allowed_ips '::/0'
        option endpoint_host 'EDITED UBUNTU VPN SERVER INTERNET IP'
        option endpoint_port '47676'
        option persistent_keepalive '25'
Firewall.config.file.TXT

root@OpenWrt-Linksys-WRT3200ACM:~# cat /etc/config/firewall

config defaults
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option synflood_protect '1'

config zone
        option name 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        option mtu_fix '1'
        list network 'lan'

config zone
        option name 'wan'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'
        list network 'wan'
        list network 'wan6'
        list network 'wanb'
        list network 'WG0'

config forwarding
        option src 'lan'
        option dest 'wan'

config rule
        option name 'Allow-DHCP-Renew'
        option src 'wan'
        option proto 'udp'
        option dest_port '68'
        option target 'ACCEPT'
        option family 'ipv4'

config rule
        option name 'Allow-Ping'
        option src 'wan'
        option proto 'icmp'
        option icmp_type 'echo-request'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-IGMP'
        option src 'wan'
        option proto 'igmp'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-DHCPv6'
        option src 'wan'
        option proto 'udp'
        option src_ip 'fc00::/6'
        option dest_ip 'fc00::/6'
        option dest_port '546'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-MLD'
        option src 'wan'
        option proto 'icmp'
        option src_ip 'fe80::/10'
        list icmp_type '130/0'
        list icmp_type '131/0'
        list icmp_type '132/0'
        list icmp_type '143/0'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Input'
        option src 'wan'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        list icmp_type 'router-solicitation'
        list icmp_type 'neighbour-solicitation'
        list icmp_type 'router-advertisement'
        list icmp_type 'neighbour-advertisement'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Forward'
        option src 'wan'
        option dest '*'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-IPSec-ESP'
        option src 'wan'
        option dest 'lan'
        option proto 'esp'
        option target 'ACCEPT'

config rule
        option name 'Allow-ISAKMP'
        option src 'wan'
        option dest 'lan'
        option dest_port '500'
        option proto 'udp'
        option target 'ACCEPT'

config rule
        option name 'Support-UDP-Traceroute'
        option src 'wan'
        option dest_port '33434:33689'
        option proto 'udp'
        option family 'ipv4'
        option target 'REJECT'
        option enabled 'false'

config include
        option path '/etc/firewall.user'



config redirect
        option target 'DNAT'
        option name 'PARADOX-IP150'
        option src 'wan'
        option src_dport '10000'
        option dest 'lan'
        option dest_ip '192.168.1.210'
        option dest_port '10000'

LAPTOP WG.CONF.FILE.TXT

[Interface]
PrivateKey = EDITED KEY
Address = 10.6.0.150/24

[Peer]
PublicKey = EDITED KEY
AllowedIPs = 0.0.0.0/0

Thank You !

I have a similar setup just made last week, it is between two routers running OpenWRT one configured as a server another as a WG client and wanted to connect both sides.
I believe it is sometimes referred as a site-to-site setup.

For that I needed to open up the firewall on the client side to allow traffic:

config zone
	option name 'VPN_s_to_s'
	option output 'ACCEPT'
	option input 'ACCEPT'
	option forward 'ACCEPT'
	list network 'wg0'
	option masq '1'

config forwarding
	option dest 'lan'
	option src 'VPN_s_to_s'

config forwarding
	option src 'lan'
	option dest 'VPN_s_to_s'

I added the Masq option for you although it is not necessary if you set a static return route on the Ubuntu server and as set the routers subnet under Allowed IPs.

Furthermore you sometimes have to open up the firewall of your local lan clients to allow traffic from 10.6.0.0/24 or alternatively Masquerade traffic from 10.6.0.0/24 going out of br-lan.

I am new to OpenWRT so maybe wait till the more experienced users chime in

To add, on your Ubuntu server use /32 instead of /24 for the Allowed IPs e.g. 10.6.0.11/32 but add in the routers Allowed IPs: its local subnet 192.168.1.0/24 this will also give you a (return) route to the routers local LAN clients e.g.
Allowed IPs: 10.6.0.11/32, 192.168.1.0/24

1 Like

Yes on the server the different client's allowed_ips cannot overlap. For an IPv4 road warrior, it is typical to allow a /32 for each client, with the server wireguard interface holding a /24 which covers all the clients. On the client use one IP in the /24 with a 24 netmask, this automatically installs a route to the other clients. Though that isn't necessary if (as is typical for a road warrior) the VPN is routing 0.0.0.0/0 anyway.

Here are my NEW configuration files :
I followed a tutorial and I changed the IP v4 addresses but still no success...
Network.config.file.TXT

OpenWrt 22.03.2, r19803-9a599fee93
-----------------------------------------------------
root@OpenWrt-Linksys-WRT3200ACM:~# cat /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd91:a29d:833c::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config device
        option name 'wan'
        option macaddr 'c6:41:1e:36:be:b0'

config interface 'wan'
        option device 'wan'
        option proto 'pppoe'
        option password 'editedtext'
        option ipv6 'auto'
        option metric '1'
        option username 'editedtext'
        option peerdns '0'
        list dns '8.8.8.8'
        list dns '8.8.4.4'

config interface 'wan6'
        option device 'wan'
        option proto 'dhcpv6'

config interface 'wanb'
        option proto 'dhcp'
        option device 'lan1'
        option metric '2'

config interface 'WG0'
        option proto 'wireguard'
        option private_key 'editedtext'
        option peerdns '0'
        list dns '8.8.8.8'
        list dns '8.8.4.4'
        list addresses '10.190.190.2/32'
        list addresses '192.168.1.0/24'
        list addresses 'fd42:190:190::2/128'

config wireguard_WG0
        option description 'OPENWRT ROUTER.conf'
        option public_key 'editedtext'
        option preshared_key 'editedtext'
        list allowed_ips '0.0.0.0/0'
        list allowed_ips '::/0'
        option endpoint_host 'editedtext'
        option endpoint_port 'editedtext'
        option persistent_keepalive '25'

root@OpenWrt-Linksys-WRT3200ACM:~#

Firewall.config.file.txt

root@OpenWrt-Linksys-WRT3200ACM:~# cat /etc/config/firewall

config defaults
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option synflood_protect '1'

config zone
        option name 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        option mtu_fix '1'
        list network 'lan'

config zone
        option name 'wan'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'
        list network 'wan'
        list network 'wan6'
        list network 'wanb'

config forwarding
        option src 'lan'
        option dest 'wan'

config rule
        option name 'Allow-DHCP-Renew'
        option src 'wan'
        option proto 'udp'
        option dest_port '68'
        option target 'ACCEPT'
        option family 'ipv4'

config rule
        option name 'Allow-Ping'
        option src 'wan'
        option proto 'icmp'
        option icmp_type 'echo-request'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-IGMP'
        option src 'wan'
        option proto 'igmp'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-DHCPv6'
        option src 'wan'
        option proto 'udp'
        option src_ip 'fc00::/6'
        option dest_ip 'fc00::/6'
        option dest_port '546'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-MLD'
        option src 'wan'
        option proto 'icmp'
        option src_ip 'fe80::/10'
        list icmp_type '130/0'
        list icmp_type '131/0'
        list icmp_type '132/0'
        list icmp_type '143/0'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Input'
        option src 'wan'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        list icmp_type 'router-solicitation'
        list icmp_type 'neighbour-solicitation'
        list icmp_type 'router-advertisement'
        list icmp_type 'neighbour-advertisement'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Forward'
        option src 'wan'
        option dest '*'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-IPSec-ESP'
        option src 'wan'
        option dest 'lan'
        option proto 'esp'
        option target 'ACCEPT'

config rule
        option name 'Allow-ISAKMP'
        option src 'wan'
        option dest 'lan'
        option dest_port '500'
        option proto 'udp'
        option target 'ACCEPT'

config rule
        option name 'Support-UDP-Traceroute'
        option src 'wan'
        option dest_port '33434:33689'
        option proto 'udp'
        option family 'ipv4'
        option target 'REJECT'
        option enabled 'false'

config include
        option path '/etc/firewall.user'


config zone
        option name 'VPN'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'
        list network 'WG0'

config forwarding
        option src 'lan'
        option dest 'VPN'

root@OpenWrt-Linksys-WRT3200ACM:~#

#UBUNTU SERVER 22 WG0.CONFIG.FILE.TXT

#UBUNTU SERVER 22 WG0.CONF FILE
[Interface]
Address = 10.190.190.1/24,fd42:190:190::1/64
ListenPort = 47676
PrivateKey = editedtext
PostUp = iptables -A FORWARD -i eth0 -o wg0 -j ACCEPT; iptables -A FORWARD -i wg0 -j ACCEP>
PostDown = iptables -D FORWARD -i eth0 -o wg0 -j ACCEPT; iptables -D FORWARD -i wg0 -j ACC>
#PostUp = ufw route allow in on wg0 out on eth0
PostUp = iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
#PreDown = ufw route delete allow in on wg0 out on eth0
PreDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE




# OPENWRT ROUTER
[Peer]
PublicKey = editedtext
PresharedKey = Su7Nr7z9gckPXCvtwENTDU064zDOCWvdD9CIx0Ym2AQ=
AllowedIPs = 10.190.190.2/32,192.168.1.1/24,fd42:190:190::2/128

# LAPTOP
[Peer]
PublicKey = editedtext
PresharedKey = editedtext
AllowedIPs = 10.190.190.3/32,fd42:190:190::3/128

OK good so far. Note that every node in your system must use its own unique private key. Do not share key pairs, it will not work. For best security, each private key should be locally generated and never copied outside of the one system that uses it.

I don't know why people keep including this, as it does nothing. peerdns is applicable to protocols like dhcp or pppoe that allow the other end to push a DNS server advertisement. Wireguard does not push configurations through the tunnel, so the concept of using or ignoring a pushed configuration is moot.

The system DNS is usually set on the wan interface. A road warrior will forward all Internet usage (including DNS) through the wireguard tunnel anyway.

  • Use 10.190.190.X/24 in the interfaces. (In the peers, allowed_ip is the /32 of only the one peer)
  • The second line is completely wrong, remove it. That subnet already exists on lan, you can't use overlapping IPs on two interfaces.
  • Like the v4 backbone IPs, use a /64 on the interface and /128 in the peer section.

Sorry, but I am confused !
The previous message from user egc told me :
"but add in the routers Allowed IPs: its local subnet 192.168.1.0/24 this will also give you a (return) route to the routers local LAN clients e.g.
Allowed IPs: 10.6.0.11/32, 192.168.1.0/24"

So, I added this line : list addresses '192.168.1.0/24' .

Can somebody provide some real help to solve my problem described in the first message and above images ?

Thank You Very Much !