# Wireguard server

**URL:** <https://forum.openwrt.org/t/wireguard-server/148902>\
**Category:** Installing and Using OpenWrt\
**Created:** [January 20, 2023, 10:00am UTC](https://forum.openwrt.org/t/wireguard-server/148902 "2023-01-20T10:00:11Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neverrr](https://forum.openwrt.org/letter_avatar/neverrr/32/6_449c533f586939b6e5f246632a46421f.png) [@Neverrr](https://forum.openwrt.org/u/Neverrr)\
**Post date:** [January 20, 2023, 10:00am UTC](https://forum.openwrt.org/t/wireguard-server/148902/1 "2023-01-20T10:00:12Z")

</div>

Hello, need help in configuring wireguard server in openwrt, there are isp to the router via cable to wan pppoe, need to be connected from the phone outside through wireguard to have access to the lan devices and use internet also from router. I have configured wg server from [https://openwrt.org/docs/guide-user/services/vpn/wireguard/server](https://openwrt.org/docs/guide-user/services/vpn/wireguard/server)  
Have **interface - VPN WG** :  
**---General settings---**

- Protocol: WG-VPN
- Bring up on boot: V
- Private Key: \*\*\*
- Public Key: \*\*\*
- Listen Port: 51820
- IP Addresses: 192.168.9.1/24  
**--- Firewall Settings ---**  
Create / Assign firewall-zone: Lan, VPN  
**---Peers---**
- Description: home
- Private Key: \*\*\*
- Public Key: \*\*\*
- Preshared Key: \*\*\*
- Allowed IPs: 192.168.9.2/32

In **firewall I opened port forwards:**

- name: WG
- protocol: UDP
- Source zone: wan
- External port: 51820
- Destination zone: lan, vpn
- Internal ip address: 192.168.1.1 (openwrt.lan)
- internal port: any

In my phone I added peer:  
**---interface---**

- name: home
- public key: \*\*\*
- ip address: 192.168.9.3/24  
**---peer---**
- public key: \*\*\*
- preshared key: \*\*\*
- ip-address of the server: \*\*\*[ddns.net:51820](http://ddns.net:51820)
- allowed ip address: 0.0.0.0/0, ::/0

It's connected but not oppening anything, also not opening 192.168.1.1

---

<div class="post-metadata">

**Author:** ![lleachii](https://forum.openwrt.org/letter_avatar/lleachii/32/6_449c533f586939b6e5f246632a46421f.png) [@lleachii](https://forum.openwrt.org/u/lleachii)\
**Post date:** [January 20, 2023, 2:31pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/2 "2023-01-20T14:31:41Z")

</div>

> [@Neverrr](#):
>
> Destination zone: lan, vpn

Make it a traffic rule, destination WAN.

---

<div class="post-metadata">

**Author:** ![Neverrr](https://forum.openwrt.org/letter_avatar/neverrr/32/6_449c533f586939b6e5f246632a46421f.png) [@Neverrr](https://forum.openwrt.org/u/Neverrr)\
**Post date:** [January 20, 2023, 3:17pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/3 "2023-01-20T15:17:32Z")

</div>

The same, can’t open anything

---

<div class="post-metadata">

**Author:** ![mk24](https://forum.openwrt.org/letter_avatar/mk24/32/6_449c533f586939b6e5f246632a46421f.png) [@mk24](https://forum.openwrt.org/u/mk24)\
**Post date:** [January 20, 2023, 3:21pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/4 "2023-01-20T15:21:04Z")

</div>

The server's allowed\_ips don't match the phone tunnel IP. Change allowed\_ips to 192.168.9. **3** /32.

If the tunnel is working you should be able to ping from the router to the phone through the tunnel using its 9.3 address.

Also to set the firewall to allow external connections to a service running inside the OpenWrt router (as this Wireguard server is), open the port directly. Don't forward it to 192.168.1.1

The VPN tunnel should be in its own firewall zone and firewall rules set up to forward from the vpn zone to wan and lan as desired.

---

<div class="post-metadata">

**Author:** ![Neverrr](https://forum.openwrt.org/letter_avatar/neverrr/32/6_449c533f586939b6e5f246632a46421f.png) [@Neverrr](https://forum.openwrt.org/u/Neverrr)\
**Post date:** [January 20, 2023, 4:33pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/5 "2023-01-20T16:33:07Z")

</div>

Now changed to these settings still not works:

> **Interfaces**
>
> ![Screenshot_1](https://forum.openwrt.org/uploads/default/original/3X/d/f/df11c47462592c70a73b29902580b26e44e51dd9.png)

> **VPN**
>
> ![Screenshot_2](https://forum.openwrt.org/uploads/default/original/3X/c/c/cc765ca9049fd3a4c163f474bfcd46b8454f9dd9.png)  
> ![Screenshot_3](https://forum.openwrt.org/uploads/default/original/3X/2/e/2e5c64e0409544bdc2d82a8b648728cfa0230238.png)  
> ![Screenshot_4](https://forum.openwrt.org/uploads/default/original/3X/a/5/a59754446ec8007389f10f6a921620aef67997c9.png)  
> ![Screenshot_5](https://forum.openwrt.org/uploads/default/original/3X/2/b/2b4397c56f251ca25145814a56ac34109437b15c.png)  
> ![Screenshot_6](https://forum.openwrt.org/uploads/default/original/3X/6/0/60a00ea5abb4aa420bfe461e1e4f89c06e895744.png)

> **Firewall**
>
> ![Screenshot_7](https://forum.openwrt.org/uploads/default/original/3X/d/f/df087108e6462ffb8c1fc0f8008c79acaa67dc9a.png)  
> ![Screenshot_8](https://forum.openwrt.org/uploads/default/original/3X/c/d/cd9bbef782358a5f992251d70cfeaff09c4a95e8.png)

> **Port Forwards**
>
> ![Screenshot_9](https://forum.openwrt.org/uploads/default/original/3X/2/4/24828d0802f58cb34d4f5aaa072a65f5879e687c.png)  
> ![Screenshot_10](https://forum.openwrt.org/uploads/default/original/3X/f/1/f129a17ffcb82b353e6869f924537df37ccaadc5.png)

When doing ping from router have this:

```plaintext
PING 192.168.9.3 (192.168.9.3): 56 data bytes
ping: sendto: Destination address required

```

---

<div class="post-metadata">

**Author:** ![psherman](https://forum.openwrt.org/letter_avatar/psherman/32/6_449c533f586939b6e5f246632a46421f.png) [@psherman](https://forum.openwrt.org/u/psherman)\
**Post date:** [January 20, 2023, 4:52pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/6 "2023-01-20T16:52:03Z")

</div>

let's see your configs in text form...

Please copy the output of the following commands and post it here using the "Preformatted text `</>` " button:  
 ![grafik](https://forum.openwrt.org/uploads/default/original/2X/3/3396953c05b720cafad6df6dec38534c63580b9e.png)  
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

```plaintext
cat /etc/config/network
cat /etc/config/firewall

```

---

<div class="post-metadata">

**Author:** ![psherman](https://forum.openwrt.org/letter_avatar/psherman/32/6_449c533f586939b6e5f246632a46421f.png) [@psherman](https://forum.openwrt.org/u/psherman)\
**Post date:** [January 20, 2023, 4:56pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/7 "2023-01-20T16:56:41Z")

</div>

Btw, it looks like you have a CG-NAT address on your WAN. This means that you will not be able to get a Wireguard 'server' (or any incoming connections) unless you have a public IPv6 address.

---

<div class="post-metadata">

**Author:** ![Neverrr](https://forum.openwrt.org/letter_avatar/neverrr/32/6_449c533f586939b6e5f246632a46421f.png) [@Neverrr](https://forum.openwrt.org/u/Neverrr)\
**Post date:** [January 20, 2023, 5:40pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/8 "2023-01-20T17:40:28Z")

</div>

IPv6 doesn't need, maybe it's configured automated when I installed openwrt.  
When I had keenetic router I could setting up wireguard server with this isp.

```plaintext
root@OpenWrt:~# 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 'fda9:5c8b:63a6::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan1'
        list ports 'lan2'
        list ports 'lan3'
        option ipv6 '0'

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 'XXX'
        option ipv6 '0'

config interface 'wan'
        option device 'wan'
        option type 'bridge'
        option proto 'pppoe'
        option username 'XXX'
        option password 'XXX'
        option ipv6 'auto'

config device
        option name 'wlan1-1'
        option ipv6 '0'

config device
        option name 'wlan0'
        option ipv6 '0'

config device
        option name 'eth0'
        option ipv6 '0'

config interface 'wwan'
        option proto 'dhcp'

config device
        option name 'wwan1-5G'

config wireguard_wg0 'wg'
        option public_key 'XXXX'
        option preshared_key 'XXX'
        list allowed_ips 'xxx.xxx.xxx.0/24'

config interface 'vpn'
        option proto 'wireguard'
        option private_key 'XXX'
        option listen_port '51820'
        list addresses '192.168.9.1/24'
        list addresses 'fdf1:e8a1:8d3f:9::1/64'

config wireguard_vpn 'wgclient'
        option preshared_key 'XXX'
        option public_key 'XXX'
        option private_key 'XXX'
        option description 'Phone'
        list allowed_ips '192.168.9.3/32'
        list allowed_ips 'fdf1:e8a1:8d3f:9::2/128'
        option route_allowed_ips '1'

```

```plaintext
root@OpenWrt:~# cat /etc/config/firewall

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

config zone 'lan'
        option name 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        list device 'tun+'
        list network 'lan'

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

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 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 redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'Luci'
        option src 'wan'
        option src_dport '80'
        option dest_ip '192.168.1.1'
        option dest_port '80'

config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'openvpn'
        list proto 'udp'
        option src 'wan'
        option src_dport '1194'
        option dest_ip '192.168.1.1'

config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'ssh'
        list proto 'tcp'
        option src 'wan'
        option src_dport '22'
        option dest_ip '192.168.1.1'

config redirect
        option target 'DNAT'
        option name 'wg'
        list proto 'udp'
        option src 'wan'
        option src_dport '51820'
        option dest 'lan'

config zone
        option name 'wg'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        list network 'vpn'

config forwarding
        option src 'wg'
        option dest 'lan'

config forwarding
        option src 'wg'
        option dest 'wan'

```

---

<div class="post-metadata">

**Author:** ![psherman](https://forum.openwrt.org/letter_avatar/psherman/32/6_449c533f586939b6e5f246632a46421f.png) [@psherman](https://forum.openwrt.org/u/psherman)\
**Post date:** [January 20, 2023, 6:18pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/9 "2023-01-20T18:18:13Z")

</div>

You do have several errors, but before we spend time trying to fix those, we need to determine the cg-nat situation. Currently, you do not have a public ip address on your wan.

What, if anything, is upstream of your openwrt device? Do you have any control over it?

---

<div class="post-metadata">

**Author:** ![Neverrr](https://forum.openwrt.org/letter_avatar/neverrr/32/6_449c533f586939b6e5f246632a46421f.png) [@Neverrr](https://forum.openwrt.org/u/Neverrr)\
**Post date:** [January 20, 2023, 6:37pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/10 "2023-01-20T18:37:02Z")

</div>

From isp I have private ip (100.xx.xx.xx) and public ip185.xx.xx.xx, inside my country with local isp I able to connect directly using private ip. I also configured ddns. Now I can connect to the router otside via ssh, web, scp through the ddns also.

---

<div class="post-metadata">

**Author:** ![psherman](https://forum.openwrt.org/letter_avatar/psherman/32/6_449c533f586939b6e5f246632a46421f.png) [@psherman](https://forum.openwrt.org/u/psherman)\
**Post date:** [January 20, 2023, 6:39pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/11 "2023-01-20T18:39:24Z")

</div>

> [@Neverrr](#):
>
> public ip186.xx.xx.xx

Where do you see this? I only see your wan with 100.70 which is cg-nat.

---

<div class="post-metadata">

**Author:** ![Neverrr](https://forum.openwrt.org/letter_avatar/neverrr/32/6_449c533f586939b6e5f246632a46421f.png) [@Neverrr](https://forum.openwrt.org/u/Neverrr)\
**Post date:** [January 20, 2023, 7:00pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/12 "2023-01-20T19:00:19Z")

</div>

Sorry, edited previous message, private ip is 100.70.xx.xx, public ip I can see only when I opening outside of my country web sites, when I use local services, web site and etc which are located in my country its used private ip.  
Btw, I could configured openvpn server in linux on my laptop with previous router not with openwrt firmware and it's worked when I used isp's dns instead of another dns (google and etc), it's worked but not comfortably to use because it’s need to be always turned on laptop for that comfortably set up in my router any vpn server.

---

<div class="post-metadata">

**Author:** ![mk24](https://forum.openwrt.org/letter_avatar/mk24/32/6_449c533f586939b6e5f246632a46421f.png) [@mk24](https://forum.openwrt.org/u/mk24)\
**Post date:** [January 20, 2023, 7:09pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/13 "2023-01-20T19:09:53Z")

</div>

Does an incoming connection on the 186 IP route back to the 100 IP? This can be tested by starting a TCP-based service such as ssh on a particular port then using a port scan site to see if the port is open on your 186 IP.

If this is a state-controlled ISP where everyone in the country has a 100 IP, they may allow connections among them as if they were "public" IPs. But your home server would not work from outside the country.

---

<div class="post-metadata">

**Author:** ![Neverrr](https://forum.openwrt.org/letter_avatar/neverrr/32/6_449c533f586939b6e5f246632a46421f.png) [@Neverrr](https://forum.openwrt.org/u/Neverrr)\
**Post date:** [January 20, 2023, 7:26pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/14 "2023-01-20T19:26:54Z")

</div>

Just need to use in my country, don’t need to be used outside. To 186 IP can’t access, no ping.  
Now have access to ssh, scp, ping, Luci when connecting to my private ip and also with ddns (configured private ip to ddns because of dynamic private ip) both working.  
Yes we all have among 100.xx.xx ip connections.

---

<div class="post-metadata">

**Author:** ![psherman](https://forum.openwrt.org/letter_avatar/psherman/32/6_449c533f586939b6e5f246632a46421f.png) [@psherman](https://forum.openwrt.org/u/psherman)\
**Post date:** [January 20, 2023, 8:16pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/15 "2023-01-20T20:16:19Z")

</div>

So you are positive that you can connect to your WAN address (100.70) from outside your network (and from a practical sense, from anywhere/everywhere you need)? If so, that would imply that your country (or at least the common ISP(s) are all on one CG-NAT network.

---

<div class="post-metadata">

**Author:** ![mk24](https://forum.openwrt.org/letter_avatar/mk24/32/6_449c533f586939b6e5f246632a46421f.png) [@mk24](https://forum.openwrt.org/u/mk24)\
**Post date:** [January 20, 2023, 8:30pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/16 "2023-01-20T20:30:14Z")

</div>

Thus the 100.x IP should be the one registered in the DDNS system.

Do you see a recent handshake from the phone when running `wg show` on the router?

---

<div class="post-metadata">

**Author:** ![psherman](https://forum.openwrt.org/letter_avatar/psherman/32/6_449c533f586939b6e5f246632a46421f.png) [@psherman](https://forum.openwrt.org/u/psherman)\
**Post date:** [January 20, 2023, 8:44pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/17 "2023-01-20T20:44:49Z")

</div>

I’d be surprised if the handshake works - I think there are many other errors in the config. I’ll get to that shortly.

---

<div class="post-metadata">

**Author:** ![psherman](https://forum.openwrt.org/letter_avatar/psherman/32/6_449c533f586939b6e5f246632a46421f.png) [@psherman](https://forum.openwrt.org/u/psherman)\
**Post date:** [January 20, 2023, 9:01pm UTC](https://forum.openwrt.org/t/wireguard-server/148902/18 "2023-01-20T21:01:57Z")

</div>

These should be deleted from the network config file:

> [@Neverrr](#):
>
> ```plaintext
> config device
> option name 'wlan1-1'
> option ipv6 '0'
> 
> config device
> option name 'wlan0'
> option ipv6 '0'
> 
> ```

This look like a vestigial fragment and should be removed.

> [@Neverrr](#):
>
> ```plaintext
> config wireguard_wg0 'wg'
> option public_key 'XXXX'
> option preshared_key 'XXX'
> list allowed_ips 'xxx.xxx.xxx.0/24'
> 
> ```

Is there an OpenVPN or other (non Wireguard) tunnel running? If so, that might cause complication.s If not, delete the tun+ device from the lan firewall zone.

> [@Neverrr](#):
>
> ```plaintext
> config zone 'lan'
> option name 'lan'
> option input 'ACCEPT'
> option output 'ACCEPT'
> option forward 'ACCEPT'
> list device 'tun+'
> list network 'lan'
> 
> ```

It is not recommended to open the LuCI web admin to the internet (even if it is on CG-NAT) - it is not hardened for general internet exposure. I'd recommend removing this rule, but if you must keep it, it should be a traffic rule, not a redirect.

> [@Neverrr](#):
>
> ```plaintext
> config redirect
> option dest 'lan'
> option target 'DNAT'
> option name 'Luci'
> option src 'wan'
> option src_dport '80'
> option dest_ip '192.168.1.1'
> option dest_port '80'
> 
> ```

same deal with the ssh server(although that is more secure, still not recommended for internet exposure)

> [@Neverrr](#):
>
> ```plaintext
> config redirect
> option dest 'lan'
> option target 'DNAT'
> option name 'ssh'
> list proto 'tcp'
> option src 'wan'
> option src_dport '22'
> option dest_ip '192.168.1.1'
> 
> ```

And do you have an OpenVPN server running? This should also be a rule, not a redirect (or delete it if unused):

> [@Neverrr](#):
>
> ```plaintext
> config redirect
> option dest 'lan'
> option target 'DNAT'
> option name 'openvpn'
> list proto 'udp'
> option src 'wan'
> option src_dport '1194'
> option dest_ip '192.168.1.1'
> 
> ```

And on this, again it should be a rule, not a redirect.

> [@Neverrr](#):
>
> ```plaintext
> config redirect
> option target 'DNAT'
> option name 'wg'
> list proto 'udp'
> option src 'wan'
> option src_dport '51820'
> option dest 'lan'
> 
> ```

---

<div class="post-metadata">

**Author:** ![Neverrr](https://forum.openwrt.org/letter_avatar/neverrr/32/6_449c533f586939b6e5f246632a46421f.png) [@Neverrr](https://forum.openwrt.org/u/Neverrr)\
**Post date:** [January 21, 2023, 8:40am UTC](https://forum.openwrt.org/t/wireguard-server/148902/19 "2023-01-21T08:40:59Z")

</div>

No, sorry my bad, it's worked before with another configs.

---

<div class="post-metadata">

**Author:** ![Neverrr](https://forum.openwrt.org/letter_avatar/neverrr/32/6_449c533f586939b6e5f246632a46421f.png) [@Neverrr](https://forum.openwrt.org/u/Neverrr)\
**Post date:** [January 21, 2023, 9:00am UTC](https://forum.openwrt.org/t/wireguard-server/148902/20 "2023-01-21T09:00:50Z")

</div>

Sorry, my bad, it's not handshaked now with these configs, before with another configs and firewall configs it could handshaked don't remember what configs was.

Deleted redirect:

> **config redirect**
>
> ```plaintext
> config redirect
> option dest 'lan'
> option target 'DNAT'
> option name 'Luci'
> option src 'wan'
> option src_dport '80'
> option dest_ip '192.168.1.1'
> option dest_port '80'
> 
> ```

Made traffic rule LuCI web admin

> **Config rule**
>
> ```plaintext
> config rule
> option name 'luci'
> list dest_ip '192.168.1.1'
> option target 'ACCEPT'
> list proto 'tcp'
> option src 'wan'
> option src_port '80'
> 
> ```

Now can't access to LuCI web admin, with port forwards redirect it's working.

Has changed in configs and firewall:

> **network, firewall**
>
> ```plaintext
> login as: root
> root@192.168.1.1's password:
> 
> BusyBox v1.35.0 (2023-01-06 18:38:22 UTC) built-in shell (ash)
> 
> _________________
> | |.-----.-----.-----.| | | |.----.| |_
> | - || _ | -__| || | | || _|| _|
> | _______||__ | _____|__ | __||________ || __| |____ |
> |__| W I R E L E S S F R E E D O M
> -----------------------------------------------------
> OpenWrt 22.03.0, r19685-512e76967f
> -----------------------------------------------------
> root@OpenWrt:~# 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 'fda9:5c8b:63a6::/48'
> 
> config device
> option name 'br-lan'
> option type 'bridge'
> list ports 'lan1'
> list ports 'lan2'
> list ports 'lan3'
> option ipv6 '0'
> 
> 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 'XXX'
> option ipv6 '0'
> 
> config interface 'wan'
> option device 'wan'
> option type 'bridge'
> option proto 'pppoe'
> option username 'XXX'
> option password 'XXX'
> option ipv6 'auto'
> 
> config device
> option name 'eth0'
> option ipv6 '0'
> 
> config interface 'wwan'
> option proto 'dhcp'
> 
> config device
> option name 'wwan1-5G'
> 
> config interface 'vpn'
> option proto 'wireguard'
> option private_key 'XXX='
> option listen_port '51820'
> list addresses '192.168.9.1/24'
> list addresses 'fdf1:e8a1:8d3f:9::1/64'
> 
> config wireguard_vpn 'wgclient'
> option preshared_key 'XXX'
> option public_key 'XXX='
> option private_key 'XXX='
> option description 'Phone'
> list allowed_ips '192.168.9.3/32'
> list allowed_ips 'fdf1:e8a1:8d3f:9::2/128'
> option route_allowed_ips '1'
> 
> root@OpenWrt:~# cat /etc/config/firewall
> 
> config defaults
> option input 'ACCEPT'
> option output 'ACCEPT'
> option forward 'REJECT'
> 
> config zone 'lan'
> option name 'lan'
> option input 'ACCEPT'
> option output 'ACCEPT'
> option forward 'ACCEPT'
> list network 'lan'
> 
> config zone 'wan'
> option name 'wan'
> option input 'REJECT'
> option output 'ACCEPT'
> option masq '1'
> option mtu_fix '1'
> option forward 'REJECT'
> list network 'wan'
> list network 'wwan'
> 
> 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 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 redirect
> option dest 'lan'
> option target 'DNAT'
> option name 'ssh'
> list proto 'tcp'
> option src 'wan'
> option src_dport '22'
> option dest_ip '192.168.1.1'
> 
> config zone
> option name 'wg'
> option input 'ACCEPT'
> option output 'ACCEPT'
> option forward 'ACCEPT'
> list network 'vpn'
> 
> config forwarding
> option src 'wg'
> option dest 'lan'
> 
> config forwarding
> option src 'wg'
> option dest 'wan'
> 
> config rule
> option name 'wg'
> list proto 'udp'
> list src_ip '192.168.1.1'
> option src_port '51820'
> option dest 'lan'
> option target 'ACCEPT'
> 
> config rule
> option name 'luci'
> list dest_ip '192.168.1.1'
> option target 'ACCEPT'
> list proto 'tcp'
> option src 'wan'
> option src_port '80'
> 
> root@OpenWrt:~#
> 
> ```

[Next page](https://forum.openwrt.org/t/wireguard-server/148902.md?page=2)
