No Internet on dual router failover system

Hello everyone,

I am building a system with two routers, both of which have an internal QMI modem. Router A should be handling dhcp for local clients and router B should just provide internet access via the WAN port on router A. The intention is to create a multiWAN system where router A can use either it's internal modem or the router B to access the Internet. When tested separately, both can access the Internet via their respective modems and get an IP from the ISP. When connecting the two routers via Ethernet however, router B loses the IP from ISP and can't get online anymore.

My first instinct was to put the router on the same subnet and make router B a dumb AP that just provided the modem connection via a LAN bridge to router A. When that didn't work I made them separate networks and tried to provide the connection to A as a generic WAN connection, but that didn't work either. I can't get it to work with DHCP nor with static addresses. As a sanity check, I tried giving A internet access via the WAN from my commercial home router and that worked instantly.

I am running openWRT 23.05 on two mediatek mt7621's if that has any relevance. The intention is to use mwan3 for the failover, but obviously i haven't gotten that far.

Troubleshooting steps I have taken already:
Routers can see each other and can ping each other.
Both modems and routers work separately.
Tried creating specific LAN and WAN ports to ensure that the ports work.
Tried reinstalling OpenWRT several times on both devices.
Tried swapping A and B's roles

Any ideas on what could be causing the problem?

Can you provide a diagram?
Because you seem to have two modems

And are using wan ports to connect the routers.

So you have me thoroughly confused.

Please, just a diagram; that seems too complicated for words.

There isn't much of a diagram to draw since the modems are internal 5G modems. The modems are connected via the USB bus internally and not via WAN. Although the modems are listed as wwan0 in both devices.

How about this: Router A has two WAN ports, one is its WAN ethernet port which should connect to the LAN of Router B (Router B on a different subnet) and the second WAN is the USB modem.

Use MWAN3 on router A to setup which WAN to use and when

We have nomenclature we need to work out:

The USB modems are WAN; they may be called WWAN but you can call an interface anything, the firewall is the umpire.

So, using the wan ports for anything but WAN is going to confuse OpenWRT if set up with defaults.

Please connect to your OpenWrt device using ssh and 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:

ubus call system board
cat /etc/config/network
cat /etc/config/wireless
cat /etc/config/dhcp
cat /etc/config/firewall

I'm going to step aside for @egc to continue.

No need to step aside :slight_smile:

I think you have a better grasp.

I'm just going to lurk and learn.

This is router A's settings:

root@OpenWrt:~# ubus call system board
{
 "kernel": "5.15.134",
 "hostname": "OpenWrt",
 "system": "MediaTek MT7621 ver:1 eco:3",
 "model": "HiLink HLK-7621A evaluation board",
 "board_name": "hilink,hlk-7621a-evb",
 "rootfs_type": "squashfs",
 "release": {
  "distribution": "OpenWrt",
  "version": "23.05.0",
  "revision": "r23497-6637af95aa",
  "target": "ramips/mt7621",
  "description": "OpenWrt 23.05.0 r23497-6637af95aa"
 }
}
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 'fda5:48a7:6ff8::/48'
 option packet_steering '1'

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

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 interface '5G'
 option proto 'qmi'
 option device '/dev/cdc-wdm0'
 option apn 'internet'
 option pincode '****'
 option auth 'none'
 option pdptype 'ipv4'
 option metric '10'

config interface 'wanb'
 option proto 'dhcp'
 option device 'lan4'

config device
 option type '8021q'
 option ifname 'lan4'
 option vid '1'
 option name 'lan4.1'

root@OpenWrt:~# cat /etc/config/wireless
cat: can't open '/etc/config/wireless': No such file or directory
root@OpenWrt:~# cat /etc/config/dhcp

config dnsmasq
 option domainneeded '1'
 option localise_queries '1'
 option rebind_protection '1'
 option rebind_localhost '1'
 option local '/lan/'
 option domain 'lan'
 option expandhosts '1'
 option cachesize '1000'
 option readethers '1'
 option leasefile '/tmp/dhcp.leases'
 option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
 option localservice '1'
 option ednspacket_max '1232'

config dhcp 'lan'
 option interface 'lan'
 option start '100'
 option limit '150'
 option leasetime '12h'
 option dhcpv4 'server'
 option dhcpv6 'server'
 option ra 'server'
 list ra_flags 'managed-config'
 list ra_flags 'other-config'

config odhcpd 'odhcpd'
 option maindhcp '0'
 option leasefile '/tmp/hosts/odhcpd'
 option leasetrigger '/usr/sbin/odhcpd-update'
 option loglevel '4'

config dhcp 'wanb'
 option interface 'wanb'
 option ignore '1'
 option start '100'
 option limit '150'
 option leasetime '12h'

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

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

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

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

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

This is router B's settings:

root@OpenWrt:~# ubus call system board
{
 "kernel": "5.15.134",
 "hostname": "OpenWrt",
 "system": "MediaTek MT7621 ver:1 eco:3",
 "model": "HiLink HLK-7621A evaluation board",
 "board_name": "hilink,hlk-7621a-evb",
 "rootfs_type": "squashfs",
 "release": {
  "distribution": "OpenWrt",
  "version": "23.05.0",
  "revision": "r23497-6637af95aa",
  "target": "ramips/mt7621",
  "description": "OpenWrt 23.05.0 r23497-6637af95aa"
 }
}
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 'fd48:9eb5:3825::/48'
 option packet_steering '1'

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

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

config device
 option type '8021q'
 option ifname 'br-lan'
 option vid '1'
 option name 'br-lan.1'

config interface 'ext'
 option proto 'static'
 option device 'lan4'
 option ipaddr '192.168.2.2'
 option netmask '255.255.255.0'

config interface '5G'
 option proto 'qmi'
 option device '/dev/cdc-wdm0'
 option apn 'internet'
 option pincode '****'
 option auth 'none'
 option pdptype 'ipv4'

root@OpenWrt:~# cat /etc/config/wireless
cat: can't open '/etc/config/wireless': No such file or directory
root@OpenWrt:~# cat /etc/config/dhcp

config dnsmasq
 option domainneeded '1'
 option localise_queries '1'
 option rebind_protection '1'
 option rebind_localhost '1'
 option local '/lan/'
 option domain 'lan'
 option expandhosts '1'
 option cachesize '1000'
 option readethers '1'
 option leasefile '/tmp/dhcp.leases'
 option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
 option localservice '1'
 option ednspacket_max '1232'

config dhcp 'lan'
 option interface 'lan'
 option start '100'
 option limit '150'
 option leasetime '12h'
 option dhcpv4 'server'
 option dhcpv6 'server'
 option ra 'server'
 list ra_flags 'managed-config'
 list ra_flags 'other-config'

config odhcpd 'odhcpd'
 option maindhcp '0'
 option leasefile '/tmp/hosts/odhcpd'
 option leasetrigger '/usr/sbin/odhcpd-update'
 option loglevel '4'

config dhcp 'ext'
 option interface 'ext'
 option start '100'
 option limit '150'
 option leasetime '12h'
 option ignore '1'

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

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

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

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

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