Wireguard interface disappears when wan goes down

Hello,
I set up Cloudflare warp on my bt home hub 5a running openwrt, all works as expected until wan goes down (loss of dsl link), the wireguard interface disappears (wg show has no output) and the only way to get it back is to reboot the device.
Screenshot_20210109_124656

syslog
Sat Jan  9 12:40:43 2021 daemon.info pppd[3781]: LCP terminated by peer
Sat Jan  9 12:40:43 2021 daemon.info pppd[3781]: Connect time 1440.0 minutes.
Sat Jan  9 12:40:43 2021 daemon.info pppd[3781]: Sent 1064113744 bytes, received 874240258 bytes.
Sat Jan  9 12:40:43 2021 daemon.notice netifd: Network device 'pppoe-wan' link is down
Sat Jan  9 12:40:43 2021 daemon.notice netifd: Interface 'wan' has lost the connection
Sat Jan  9 12:40:43 2021 daemon.notice netifd: Interface 'warp' has lost the connection
Sat Jan  9 12:40:43 2021 daemon.notice netifd: Network device 'warp' link is down
Sat Jan  9 12:40:43 2021 daemon.notice netifd: Interface 'warp' is now down
Sat Jan  9 12:40:43 2021 daemon.notice netifd: Interface 'warp' is setting up now
Sat Jan  9 12:40:44 2021 daemon.notice netifd: Interface 'warp' is now down
Sat Jan  9 12:40:44 2021 daemon.notice pppd[3781]: Modem hangup
Sat Jan  9 12:40:44 2021 daemon.notice pppd[3781]: Connection terminated.
Sat Jan  9 12:40:44 2021 daemon.info pppd[3781]: Sent PADT
Sat Jan  9 12:40:44 2021 daemon.info pppd[3781]: Exit.
Sat Jan  9 12:40:44 2021 daemon.notice netifd: Interface 'wan' is now down
Sat Jan  9 12:40:44 2021 daemon.notice netifd: Interface 'wan' is disabled
Sat Jan  9 12:40:44 2021 daemon.notice netifd: Interface 'wan' is enabled
Sat Jan  9 12:40:44 2021 daemon.notice netifd: Interface 'wan' is setting up now
Sat Jan  9 12:40:45 2021 daemon.err insmod: module is already loaded - slhc
Sat Jan  9 12:40:45 2021 daemon.err insmod: module is already loaded - ppp_generic
Sat Jan  9 12:40:45 2021 daemon.err insmod: module is already loaded - pppox
Sat Jan  9 12:40:45 2021 daemon.err insmod: module is already loaded - pppoe
Sat Jan  9 12:40:45 2021 daemon.info pppd[6851]: Plugin rp-pppoe.so loaded.
Sat Jan  9 12:40:45 2021 daemon.info pppd[6851]: RP-PPPoE plugin version 3.8p compiled against pppd 2.4.7
Sat Jan  9 12:40:45 2021 daemon.notice pppd[6851]: pppd 2.4.7 started by root, uid 0
Sat Jan  9 12:40:45 2021 daemon.info pppd[6851]: PPP session is 213
Sat Jan  9 12:40:45 2021 daemon.warn pppd[6851]: Connected to *:*:*:*:*:* via interface dsl0
Sat Jan  9 12:40:45 2021 kern.info kernel: [86613.629818] pppoe-wan: renamed from ppp0
Sat Jan  9 12:40:45 2021 daemon.info pppd[6851]: Renamed interface ppp0 to pppoe-wan
Sat Jan  9 12:40:45 2021 daemon.info pppd[6851]: Using interface pppoe-wan
Sat Jan  9 12:40:45 2021 daemon.notice pppd[6851]: Connect: pppoe-wan <--> dsl0
Sat Jan  9 12:40:45 2021 daemon.info pppd[6851]: CHAP authentication succeeded: CHAP authentication success, unit 14765
Sat Jan  9 12:40:45 2021 daemon.notice pppd[6851]: CHAP authentication succeeded
Sat Jan  9 12:40:45 2021 daemon.notice pppd[6851]: peer from calling number 00:02:3B:10:04:0B authorized
Sat Jan  9 12:40:46 2021 daemon.notice pppd[6851]: local  IP address *.*.*.*
Sat Jan  9 12:40:46 2021 daemon.notice pppd[6851]: remote IP address *.*.*.*
Sat Jan  9 12:40:46 2021 daemon.notice pppd[6851]: primary   DNS address *.*.*.*
Sat Jan  9 12:40:46 2021 daemon.notice pppd[6851]: secondary DNS address 8.8.8.8
Sat Jan  9 12:40:46 2021 daemon.notice netifd: Network device 'pppoe-wan' link is up
Sat Jan  9 12:40:46 2021 daemon.notice netifd: Interface 'wan' is now up
Sat Jan  9 12:40:47 2021 user.notice firewall: Reloading firewall due to ifup of wan (pppoe-wan)
Sat Jan  9 12:41:04 2021 daemon.err dnscrypt-proxy[1211]: [2021-01-09 11:41:04] [NOTICE] Server with the lowest initial latency: cisco-familyshield (rtt: 77ms)
Sat Jan  9 12:43:01 2021 daemon.notice hostapd: wlan1: AP-STA-DISCONNECTED *:*:*:*:*:*
Sat Jan  9 12:43:01 2021 daemon.info hostapd: wlan1: STA *:*:*:*:*:* IEEE 802.11: disassociated
Sat Jan  9 12:43:02 2021 daemon.info hostapd: wlan1: STA *:*:*:*:*:* IEEE 802.11: deauthenticated due to inactivity (timer DEAUTH/REMOVE)
network
config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd94:a621:fb8b::/48'

config atm-bridge 'atm'
        option encaps 'llc'
        option payload 'bridged'
        option nameprefix 'dsl'
        option vci '38'
        option vpi '0'

config dsl 'dsl'
        option ds_snr_offset '0'
        option firmware '/lib/firmware/vr9-A-dsl.bin'
        option annex 'a2p'
        option xfer_mode 'atm'
        option line_mode 'adsl'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth0.1'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config device 'lan_eth0_1_dev'
        option name 'eth0.1'
        option macaddr '34:8a:ae:d6:6d:e2'

config interface 'wan'
        option ifname 'dsl0'
        option proto 'pppoe'
        option ipv6 '1'
        option username '***'
        option password '***'
        option keepalive '7,3'
        option keepalive_adaptive '1'
        option peerdns '0'
        option mtu '1452'

config device 'wan_dsl0_dev'
        option name 'dsl0'
        option macaddr '34:8a:ae:d6:6d:e3'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 4 6t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '5 6t'

config interface 'warp'
        option proto 'wireguard'
        option private_key '***'
        list addresses '172.16.0.2/32'
        option force_link '1'
        option mtu '1372'

config wireguard_warp
        option public_key '***'
        option persistent_keepalive '25'
        list allowed_ips '0.0.0.0/0'
        option route_allowed_ips '1'
        option endpoint_host 'engage.cloudflareclient.com'
        option endpoint_port '2408'
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 network 'lan'

config zone
        option name 'wan'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'
        option network '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 redirect
        option name 'Divert-DNS, port 53'
        option src 'lan'
        option proto 'tcp udp'
        option src_dport '53'
        option dest_port '53'
        option target 'DNAT'

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

config zone
        option name 'wgzone'
        option mtu_fix '1'
        option input 'REJECT'
        option forward 'REJECT'
        option masq '1'
        option output 'ACCEPT'
        option network 'warp'

config forwarding
        option dest 'wgzone'
        option src 'lan'

Increase metric on the WAN interface:
https://openwrt.org/docs/guide-user/services/vpn/wireguard/extras#dynamic_connection

If that doesn't help, create a hotplug script to reconnect the WG on WAN status change:

cat << "EOF" > /etc/hotplug.d/iface/50-warp
if [ "${INTERFACE}" = "wan" ] \
&& [ "${ACTION}" = "ifup" -o "${ACTION}" = "ifupdate" ]
then ifup warp
fi
EOF
1 Like

thank you for the reply.
increasing the metric won't be a viable solution for my use case since my routing isn't dynamic, all lan traffic is forwarded to wgzone only and not to wan.

the problem with the hotplug approach is that warp disappears completely whenever wan restarts so no command works on it including ifup/ifdown warp, wg set warp <>, ip link set warp <> even /etc/init.d/network restart doesn't bring warp back. the only solution that i found working is fully restarting the router.

1 Like

Changing the metric doesn't have to do with dynamic routing. Lower metric is preferred.
What is the output of ubus call system board ?

1 Like
{
        "kernel": "4.14.209",
        "hostname": "OpenWrt",
        "system": "xRX200 rev 1.2",
        "model": "BT Home Hub 5A",
        "board_name": "bt,homehub-v5a",
        "release": {
                "distribution": "OpenWrt",
                "version": "19.07.5",
                "revision": "r11257-5090152ae3",
                "target": "lantiq/xrx200",
                "description": "OpenWrt 19.07.5 r11257-5090152ae3"
        }
}

I tried it and still had the same problem.

1 Like

When the issue happens, check this and post the output:

/etc/init.d/log restart; ifup warp; sleep 5; logread; wg show
Thu Jan  1 01:00:00 1970 kern.emerg kernel:
1 Like

That's weird, try this:

uci -q delete network.warp.force_link
uci commit network
/etc/init.d/network restart

unfortunately removing force link doesn't help.

1 Like

Do you have any extra packages installed?
Can you run the following before and after the issue occurs? ip -s link; ip -4 addr; ip -4 ro; ip -4 ru

dnscrypt-proxy2, wireguard, simple-adblock, sqm

before:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    RX: bytes  packets  errors  dropped overrun mcast   
    3477046    35152    0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    3477046    35152    0       0       0       0       
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
    link/ether f6:9c:e9:76:12:44 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0       
3: ifb0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 32
    link/ether 86:fd:6e:50:eb:08 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0       
4: ifb1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 32
    link/ether be:b5:ea:83:51:8f brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0       
17: dsl0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 34:8a:ae:d6:6d:e3 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    1250338503 1141890  0       4       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    173504959  819219   0       0       0       0       
107: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 34:8a:ae:d6:6d:e2 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    22896918   198533   0       145     0       381     
    TX: bytes  packets  errors  dropped carrier collsns 
    201043131  216930   0       0       0       0       
108: eth0.1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br-lan state LOWERLAYERDOWN mode DEFAULT group default qlen 1000
    link/ether 34:8a:ae:d6:6d:e2 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0       
111: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP mode DEFAULT group default qlen 1000
    link/ether 34:8a:ae:d6:6d:e4 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    13988845   116207   0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    77264088   107356   0       0       0       0       
112: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP mode DEFAULT group default qlen 1000
    link/ether 34:8a:ae:d6:6d:e5 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    12058165   87131    0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    129509771  114104   0       0       0       0       
146: pppoe-wan: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1452 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 3
    link/ppp 
    RX: bytes  packets  errors  dropped overrun mcast   
    64287036   61052    0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    9677116    43971    0       0       0       0       
147: warp: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1374 qdisc cake state UNKNOWN mode DEFAULT group default qlen 1000
    link/none 
    RX: bytes  packets  errors  dropped overrun mcast   
    35474668   26327    0       34558   0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    8436752    43937    0       0       0       0       
150: ifb4warp: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc cake state UNKNOWN mode DEFAULT group default qlen 32
    link/ether a2:44:e3:31:e1:10 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    59687574   60195    0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    59687574   60195    0       0       0       0       
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
107: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    inet 192.168.1.1/24 brd 192.168.1.255 scope global br-lan
       valid_lft forever preferred_lft forever
146: pppoe-wan: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1452 qdisc fq_codel state UNKNOWN group default qlen 3
    inet 41.107.208.148 peer 41.107.128.1/32 scope global pppoe-wan
       valid_lft forever preferred_lft forever
147: warp: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1374 qdisc cake state UNKNOWN group default qlen 1000
    inet 172.16.0.2/32 brd 255.255.255.255 scope global warp
       valid_lft forever preferred_lft forever
default dev warp proto static scope link 
41.107.128.1 dev pppoe-wan proto kernel scope link src 41.107.208.148 
162.159.192.1 via 41.107.128.1 dev pppoe-wan proto static 
192.168.1.0/24 dev br-lan proto kernel scope link src 192.168.1.1 
0:      from all lookup local 
32766:  from all lookup main 
32767:  from all lookup default 

after:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    RX: bytes  packets  errors  dropped overrun mcast   
    3531091    35652    0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    3531091    35652    0       0       0       0       
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
    link/ether f6:9c:e9:76:12:44 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0       
3: ifb0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 32
    link/ether 86:fd:6e:50:eb:08 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0       
4: ifb1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 32
    link/ether be:b5:ea:83:51:8f brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0       
17: dsl0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 34:8a:ae:d6:6d:e3 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    1255181089 1146787  0       4       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    174508673  823383   0       0       0       0       
107: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 34:8a:ae:d6:6d:e2 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    23656993   204429   0       145     0       389     
    TX: bytes  packets  errors  dropped carrier collsns 
    206171068  222848   0       0       0       0       
108: eth0.1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br-lan state LOWERLAYERDOWN mode DEFAULT group default qlen 1000
    link/ether 34:8a:ae:d6:6d:e2 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0       
111: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP mode DEFAULT group default qlen 1000
    link/ether 34:8a:ae:d6:6d:e4 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    14509189   119902   0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    79219487   110458   0       0       0       0       
112: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP mode DEFAULT group default qlen 1000
    link/ether 34:8a:ae:d6:6d:e5 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    12401363   89557    0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    132851080  117124   0       0       0       0       
150: ifb4warp: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc cake state UNKNOWN mode DEFAULT group default qlen 32
    link/ether a2:44:e3:31:e1:10 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    64142493   65026    0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    64142493   65026    0       0       0       0       
153: pppoe-wan: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1452 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 3
    link/ppp 
    RX: bytes  packets  errors  dropped overrun mcast   
    792        7        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    3358       14       0       0       0       0       
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
107: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    inet 192.168.1.1/24 brd 192.168.1.255 scope global br-lan
       valid_lft forever preferred_lft forever
153: pppoe-wan: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1452 qdisc fq_codel state UNKNOWN group default qlen 3
    inet 41.104.137.183 peer 41.104.128.1/32 scope global pppoe-wan
       valid_lft forever preferred_lft forever
default via 41.104.128.1 dev pppoe-wan proto static 
41.104.128.1 dev pppoe-wan proto kernel scope link src 41.104.137.183 
192.168.1.0/24 dev br-lan proto kernel scope link src 192.168.1.1 
0:      from all lookup local 
32766:  from all lookup main 
32767:  from all lookup default 

I can see an MTU missmatch on the wireguard interface. You have configured 1372 but it eventually gets 1374. Where you told to configure it like by the administrator of the wg peer?
Also the 1452 mtu on the pppoe is rather unsual, were you instructed to configure it from your ISP?
Post also the uci export sqm

1 Like

the mismatch is just an error on my part, I change it to 1374 while I was troubleshooting, sorry for the red herring.
I set the mtu 80 bytes less than the pppoe mtu as per this link https://keremerkan.net/posts/wireguard-mtu-fixes/

A while ago I had an unstable dsl link and while I was trying to figure it out I settled on that value, it's rather arbitrary.
I think I found it here https://www.sonicwall.com/support/knowledge-base/how-can-i-optimize-pppoe-connections/170505851231244/

config queue
        option debug_logging '0'
        option verbosity '5'
        option interface 'warp'
        option qdisc 'cake'
        option linklayer 'ethernet'
        option overhead '60'
        option script 'layer_cake.qos'
        option qdisc_advanced '1'
        option squash_dscp '1'
        option squash_ingress '1'
        option ingress_ecn 'ECN'
        option egress_ecn 'NOECN'
        option qdisc_really_really_advanced '1'
        option iqdisc_opts 'diffserv4'
        option eqdisc_opts 'diffserv4 ack-filter'
        option enabled '1'
        option download '7950'
        option upload '440'

I had issues earlier with incorrect mtu, so I would suggest to calculate the mtu and set that value. In linux ping use -M do
The same applies for the wg mtu.
As a test, try to disable the sqm and check if it occurs.

1 Like

unfortunately neither of those solved the problem I'm facing.

upon further testing it seems that netifd removes the wireguard device when the link goes down but does not recreate it when wan is up again hence the Network device is not present error.

For now, as a workaround, I'm bringing warp down when wan is down to prevent the wireguard device from being deleted by netifd and then bringing it up again when wan returns using this hotplug script

[ "$INTERFACE" = wan ] || exit 0
[ "${ACTION}" = ifdown ] && ubus call network.interface.warp down
[ "${ACTION}" = ifup ] && ubus call network.interface.warp up

I have the same issue. Wireguard tunnel cannot be restored after pppoe is restarted. Same "Network device is not present" error. The hotplug script doesn't help.

OpenWrt 21.02+ supports upstream interface binding with tunlink.
You can also add a delay to the hotplug script.

2 Likes

I upgraded to 21.02. What exactly should I set as a tunlink value? The network interface name for WAN (which can be listed using ifconfig)? Or the OpenWRT interface name, which is visible in luci networks view?