WAN port on router acts as LAN

We can't even ssh into the router when WAN is connected because the IP of the router has been changed by the wired internet source. So I can't get that information unfortunately

That is not evident from the configuration.
LAN has 4.4 and WAN is set to dhcp, so it will get whatever the upstream router gives by dhcp.
LAN is bound to eth0.1 and WAN to eth0.2, so they are separated.
In any case the IP of the router doesn't change, but another one is added. So the router will have both 4.4 on the LAN and 0.2 on the WAN. You will however have problem if WAN network is also 192.168.4.0/24.

1 Like

You are very correct. The IP of the WAN is 192.168.0.1 range. There is no conflict. So why does the WAN IP always appear when you make connections over the LAN? It seems to be blocking out the LAN IP and taking precedence.

This is really puzzling

Check if the network mask of 192.168.0.X is the usual /24 (a.k.a 255.255.255.0) or something else which might create an overlap.

2 Likes

Post the output:

swconfig list; swconfig dev switch0 show; \
brctl show; ip address show; ip route show
2 Likes

Here is the output

###########################
#############swconfig list;#############
##################################
Found: switch0 - mt7620

###########################
############swconfig dev switch0 show;#########
#############################################
Global attributes:
	enable_vlan: 1
	mib: Switch MIB counters
PPE_AC_BCNT0: 0
PPE_AC_PCNT0: 0
PPE_AC_BCNT63: 0
PPE_AC_PCNT63: 0
PPE_MTR_CNT0: 0
PPE_MTR_CNT63: 0
GDM1_TX_GBCNT: 0
GDM1_TX_GPCNT: 0
GDM1_TX_SKIPCNT: 0
GDM1_TX_COLCNT: 0
GDM1_RX_GBCNT1: 0
GDM1_RX_GPCNT1: 0
GDM1_RX_OERCNT: 0
GDM1_RX_FERCNT: 0
GDM1_RX_SERCNT: 0
GDM1_RX_LERCNT: 0
GDM1_RX_CERCNT: 0
GDM1_RX_FCCNT: 0
GDM2_TX_GBCNT: 0
GDM2_TX_GPCNT: 0
GDM2_TX_SKIPCNT: 0
GDM2_TX_COLCNT: 0
GDM2_RX_GBCNT: 0
GDM2_RX_GPCNT: 0
GDM2_RX_OERCNT: 0
GDM2_RX_FERCNT: 0
GDM2_RX_SERCNT: 0
GDM2_RX_LERCNT: 3
GDM2_RX_CERCNT: 0
GDM2_RX_FCCNT: 0

Port 0:
	mib: Port 0 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

	pvid: 2
	link: port:0 link:down
Port 1:
	mib: Port 1 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

	pvid: 1
	link: port:1 link:down
Port 2:
	mib: Port 2 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

	pvid: 1
	link: port:2 link:down
Port 3:
	mib: Port 3 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

	pvid: 1
	link: port:3 link:down
Port 4:
	mib: Port 4 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

	pvid: 1
	link: port:4 link:down
Port 5:
	mib: Port 5 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

	pvid: 0
	link: port:5 link:down
Port 6:
	mib: Port 6 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 584
RxBOC      : 0
RxGOC      : 162790
RxEPC1     : 0
RxEPC2     : 584

	pvid: 0
	link: port:6 link:up speed:1000baseT full-duplex 
Port 7:
	mib: Port 7 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

	pvid: 0
	link: port:7 link:down
VLAN 1:
	vid: 1
	ports: 1 2 3 4 6t 
VLAN 2:
	vid: 2
	ports: 0 6t

#########################################
########brctl show;######################
#########################################
bridge name	bridge id		STP enabled	interfaces
br-lan		7fff.90505a57ae88	no		eth0.1
							wlan0
bridge name	bridge id		STP enabled	interfaces
br-lan		7fff.90505a57ae88	no		eth0.1
							wlan0

####################################################
##############ip address show;#####################
###################################################
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN qlen 1000
    link/ether 90:50:5a:57:ae:88 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::9250:5aff:fe57:ae88/64 scope link 
       valid_lft forever preferred_lft forever
3: ifb0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN qlen 32
    link/ether 06:61:cc:20:dd:89 brd ff:ff:ff:ff:ff:ff
4: ifb1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN qlen 32
    link/ether 52:99:78:b4:81:16 brd ff:ff:ff:ff:ff:ff
5: wwan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether b2:9f:1f:d9:e2:27 brd ff:ff:ff:ff:ff:ff
9: eth0.2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 90:50:5a:57:ae:88 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::9250:5aff:fe57:ae88/64 scope link 
       valid_lft forever preferred_lft forever
11: 3g-wan6: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN qlen 3
    link/ppp 
    inet 10.191.143.234 peer 10.64.64.64/32 scope global 3g-wan6
       valid_lft forever preferred_lft forever
24: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 90:50:5a:57:ae:88 brd ff:ff:ff:ff:ff:ff
    inet 192.168.4.4/24 brd 192.168.4.255 scope global br-lan
       valid_lft forever preferred_lft forever
    inet6 fd4a:226f:5b58::1/60 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::9250:5aff:fe57:ae88/64 scope link 
       valid_lft forever preferred_lft forever
25: eth0.1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP qlen 1000
    link/ether 90:50:5a:57:ae:88 brd ff:ff:ff:ff:ff:ff
26: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br-lan state UP qlen 1000
    link/ether 90:50:5a:57:ae:88 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::9250:5aff:fe57:ae88/64 scope link 
       valid_lft forever preferred_lft forever

################################################
###########ip route show ########################
################################################
default via 10.64.64.64 dev 3g-wan6 
10.64.64.64 dev 3g-wan6 scope link  src 10.191.143.234 
192.168.4.0/24 dev br-lan scope link  src 192.168.4.4 

1 Like

Nothing strange here. Your router has 2 IPs, one in the lan and one from the 3g/lte network. The 3g/lte interface was not available earlier.
If you connect the wan port, most likely the default route from wan will take precedence, so all traffic will be diverted there.
Verify that the wan subnet is not the same as the 192.168.4.0 you have in lan.

1 Like

If the issue persists, connect the WAN and repeat the diagnostics.
No need to run commands separately, you can copy-paste the whole code block.

Verify that the wan subnet is not the same as the 192.168.4.0 you have in lan.

How do i verify this?

ip route show | grep " src " | cut -d " " -f 3,1

Connect your PC on the internet line and verify the IP/MASK/Gateway it is acquiring from DHCP.

1 Like

Here is the output

###########################################################
###############   ip route show | grep " src " | cut -d " " -f 3,1  ####
######################################################################

10.64.64.64 3g-wan6
192.168.4.0/24 br-lan

Here is the output when I connected my computer to the internet source using an ethernet cable. From the enp0s25 interface you can see it is acquiring IP via DHCP.

##################################################
################ ifconfig #####################
#################################################

enp0s25   Link encap:Ethernet  HWaddr a4:5d:36:58:8e:e4  
          inet addr:192.168.0.132  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::d7a2:fabf:f429:d7c4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2488 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1329 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3410036 (3.4 MB)  TX bytes:117027 (117.0 KB)
          Interrupt:17 Memory:d4700000-d4720000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:8097 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8097 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:604442 (604.4 KB)  TX bytes:604442 (604.4 KB)

wlo1      Link encap:Ethernet  HWaddr 6c:88:14:bd:b8:64  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:255897 errors:0 dropped:0 overruns:0 frame:0
          TX packets:138170 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:337800157 (337.8 MB)  TX bytes:12232973 (12.2 MB)

The problem is here:

config interface 'wan6'
	option ifname 'eth0.2'
	option proto '3g'
	option device '/dev/ttyUSB2'
	option ipv6 'auto'

You are using the eth0.2 ifname on an interface which is used for 3G with a USB stick.

Change them into this:

config interface 'wan6'
	option ifname 'eth0.2'
        option proto 'dhcpv6'

config interface '3g'
	option proto '3g'
	option device '/dev/ttyUSB2'
	option ipv6 'auto'

and add new interface 3g in wan firewall zone.
I would also advise to reset the router to defaults, after you take a backup. wan and lan will work immediately and you'll only need to apply the configuration for 3G. This way you'll make sure that no other wrong configuration is still in the router.

2 Likes

Changes have been done but it still has the same old behaviour. See output below. This is really strange

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 'fd4a:226f:5b58::/48'

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

config device 'lan_dev'
	option name 'eth0.1'

config interface 'wan'
	option ifname 'eth0.2'
	option proto 'dhcp'

config device 'wan_dev'
	option name 'eth0.2'

config interface 'wan6'
	option ifname 'eth0.2'
	option proto 'dhcpv6'

config interface '3g'
	option proto '3g'
	option device '/dev/ttyUSB2'
	option ipv6 'auto'

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

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

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

Then proceed with backup, reset, and reconfigure.

After the reset the router will work without any additional setting. The lan will have 192.168.1.1/24 and wan will acquire some IP from the 192.168.0.0/24 subnet.
After you make sure it works, you can add the configuration for the 3g.

1 Like

So we backedup, reset and configured and still it behaves the same way.

We noticed that if you switch WAN ifname to eth0.1 and LAN ifname to eth0.2, the WAN starts working but the LAN stops and if you switch it back, the LAN starts working and WAN stops.

This is a strange behaviour.

Connect the WAN and check the runtime switch and bridge configuration:

swconfig dev switch0 show; brctl show

Analyze which links are UP and compare with your port number assignment.

1 Like

Before reconfiguring, you should try it and verify it works. DHCP client on wan interface works out of the box.

1 Like

Once you connect WAN, you will be unable to SSH into the router because the router now receives IP of the WAN connection.

1 Like