Router repeatedly turns on and off eth1

I'm not sure what I did to cause this. I was trying a bunch of iptables and program commands on the router. Then I rebooted it after I'm done just to clear out any stray iptables command.
But then my PC can't connect to the LuCI, and I notice the Ethernet port is powered on and off repeatedly.
I logged into LuCI with another PC, and sure enough in system log I see the eth1 is being brought up and down repeatedly:

Fri Jul  9 20:30:19 2021 daemon.notice netifd: Network device 'eth1' link is up
Fri Jul  9 20:30:20 2021 kern.info kernel: [  701.510960] mt7530 mdio-bus:1f eth1: Link is Down
Fri Jul  9 20:30:20 2021 kern.info kernel: [  701.520618] br-lan: port 1(eth1) entered disabled state
Fri Jul  9 20:30:20 2021 daemon.notice netifd: Network device 'eth1' link is down
Fri Jul  9 20:30:22 2021 kern.info kernel: [  703.559456] mt7530 mdio-bus:1f eth1: Link is Up - 1Gbps/Full - flow control rx/tx
Fri Jul  9 20:30:22 2021 kern.info kernel: [  703.574627] br-lan: port 1(eth1) entered blocking state
Fri Jul  9 20:30:22 2021 kern.info kernel: [  703.585183] br-lan: port 1(eth1) entered forwarding state
Fri Jul  9 20:30:22 2021 daemon.notice netifd: Network device 'eth1' link is up

Any way to fix this?
OpenWrt 21.02rc3, router: UBNT ER-X

Solved, phew...
I have the ip command to create custom table in startup script.
It was there for quite some time, but I guess it's a hidden bomb like suggested here:

I removed it and rebooted the router, all seems normal now.
I tried rebooting without removing them, didn't work...

Edit:
Use /etc/config/network for ip route and ip rule
For ip route there is also LuCI: Network --> Static Routes

2 Likes

To be fair, this doesn't look like a software issue.
The link up/down events are typically triggered by unstable L1 environment.

Also, I don't recommend using raw commands such as ip, iptables, etc.
Those aren't synchronized with netifd, so you're bound to run into race conditions.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.