Xiaomi 4a router (gigabit edition) Internet not working

I uploaded the sysupgrade file and connected to the router. It gave me an internet connection for around 30 sec (It happened the first time I booted openwrt) through ethernet and it does not work again.

should I flash the stock firmware and try to install openwrt again ?

btw, it is the global version

root@OpenWrt:/etc/config# cat 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 packet_steering '1'
        option ula_prefix 'fda3:1de9:00c3::/48'

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

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 'wan'
        option device 'wan'
        option proto 'dhcp'

config interface 'wan6'
        option device 'wan'
        option proto 'dhcpv6'

root@OpenWrt:/etc/config# 

Screenshot_2022-02-24_13-24-14

Openwrt 21.02.1 sha256 checksum matches openwrt downloads page for R4AG

71f031952c83fee2d2afaef418908264fd1fdb1e62b08c95635dbf0f1c7f6644

should I flash the stock firmware and try to install openwrt again ?

yes..........

I tried two methods to flash the stock firmware and it did not work (the mi wifi repair tool and a PXE server).

I think the method puts the xiaomi router to fail safe mode in openwrt

Did you see the stock firmware file transfer using the tools?

Also, have you tried using the chinese firmware?

no

no, I thought it was not compatible

Did you study the Debrick PDF guide for the Mi Wifi Repair Tool to ensure you followed all the steps correctly?
https://www.dropbox.com/s/bwkc11ntp2t8ryc/How%20to%20use%20MIWIFIRepairToolx86.pdf?dl=0

From MIUI.com:

Press and hold the Reset button and then turn on the power until the
orange light flashes and release the Reset button;

If you are not seeing the file transfer popup box appear, could it be a firewall issue with your Windows computer?
0transfer

Do you have a 3rd party security software installed on your Windows computer which may be blocking the tools?

Also, see the link in last paragraph of this Debricking section about using chinese firmware followed by global firmware.
https://forum.openwrt.org/t/mi-router-4a-gigabit-extremely-slow/117975/31
which links to
https://forum.openwrt.org/t/mi-router-4a-gigabit-extremely-slow/117975/31

is there a way to do it in linux ?

Hi,

I used the custom pxe server and flashed the global version of the stock firmware on windows 10 and used kali linux with openwrt invasion to flash openwrt 21.02.2 (I verified the sha256sum).

does this look correct ?

BusyBox v1.33.2 (2022-02-16 20:29:10 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 21.02.2, r16495-bf0c965af0
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
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 packet_steering '1'
        option ula_prefix 'fd9e:2370:f9d8::/48'

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

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 'wan'
        option device 'wan'
        option proto 'dhcp'

config interface 'wan6'
        option device 'wan'
        option proto 'dhcpv6'

root@OpenWrt:~# 



I think I have an internet connection because I can ping 1.1.1.1 and use the LuCI interface and ping openwrt (I did not change the ip to 192.168.2.1)

PING openwrt.org (139.59.209.225): 56 data bytes
64 bytes from 139.59.209.225: seq=0 ttl=52 time=186.429 ms
64 bytes from 139.59.209.225: seq=1 ttl=52 time=166.916 ms
64 bytes from 139.59.209.225: seq=2 ttl=52 time=152.740 ms
64 bytes from 139.59.209.225: seq=3 ttl=52 time=147.115 ms

--- openwrt.org ping statistics ---
5 packets transmitted, 4 packets received, 20% packet loss
round-trip min/avg/max = 147.115/163.300/186.429 ms

Apart from LAN IP address, and high ping times to openwrt.org, the LuCI image looks OK to me.

The /etc/config/network is missing MAC addresses for WAN and LAN interfaces.

Update

I just flashed 21.02.1 onto a R4AG and the file contents is same as yours. No MAC address definitions for LAN or WAN interfaces. I don't know if this is considered normal for a DSA device.


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 packet_steering '1'
	option ula_prefix 'fd37:a39e:71ed::/48'

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

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 'wan'
	option device 'wan'
	option proto 'dhcp'

config interface 'wan6'
	option device 'wan'
	option proto 'dhcpv6'

fwiw, I loaded snapshot for HH5a which uses DSA, and I see these extra lines for the LAN interface

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

config device
	option name 'lan1'
	option macaddr '10:d7:b0:45:7f:f0'

config device
	option name 'lan2'
	option macaddr '10:d7:b0:45:7f:f0'

config device
	option name 'lan3'
	option macaddr '10:d7:b0:45:7f:f0'

config device
	option name 'lan4'
	option macaddr '10:d7:b0:45:7f:f0'

The internet was bad

Should I try to flash the snapshot version ?

No I would not use snapshot at this time unless you wish to fix a problem. (HH5a 21.02 does not use DSA, which is why I had to install snapshot which uses DSA)

Power off and on the R4AG and just check the MAC addresses reported in LuCI remain unchanged between reboots.

If the MAC addresses were changing, surely other R4AG users would have reported it as a bug?

It is possible those sections defining MAC addresses are not required for MT76 devices, such as the R4AG? I do not know for sure.

It looks like the internet is working on both lan ports and I configured the wifi (both 2.4g and 5g) to access the internet.

 OpenWrt 21.02.2, r16495-bf0c965af0
 -----------------------------------------------------
root@OpenWrt:~# 

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 packet_steering '1'
        option ula_prefix 'fd9e:2370:f9d8::/48'

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

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 'wan'
        option device 'wan'
        option proto 'dhcp'
        option type 'bridge'

config interface 'wan6'
        option device 'wan'
        option proto 'dhcpv6'
        option type 'bridge'
 OpenWrt 21.02.2, r16495-bf0c965af0
 -----------------------------------------------------
root@OpenWrt:~# cat /etc/config/dhcp

config dnsmasq
        option domainneeded '1'
        option boguspriv '1'
        option filterwin2k '0'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option nonegcache '0'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option nonwildcard '1'
        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'
        option ra_slaac '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

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

root@OpenWrt:~#

edit - I changed the ip to 192.168.2.1 and it seems to be working but when I type (192.168.1.1) the url changes to a openwrt link. is there any way to stop it ?

(I want the ip to access my isp router because I can't change the ip in that router)

I presume you posted this was BEFORE you changed the LAN IP address to 192.168.2.1?

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'

If you use chrome and open an incognito session for example, 192.168.1.1 should take you to your modem web page.

Delete your web cache in your web browser to resolve problem in normal web browser mode.

yes

it does not work

I'm not sure if it is significant, but your 21.02.2 config differs from my 21.02.1 openwrt default. Specifically:

ie. 'bridge' is enabled ?

edit - I changed the ip to 192.168.2.1 and it seems to be working but when I type (192.168.1.1) the url changes to a openwrt link. is there any way to stop it ?

Do you witness same problem when using another device such as a phone?

yes.

the internet is not working again.

If you reboot the router, does the Network > interfaces page report IP address on WAN port?

If yes, can you ping 192.168.1.1 ?

Is the WAN port faulty or suffering from poor ethernet cable connection?
https://openwrt.org/inbox/toh/xiaomi/xiaomi_mi_router_4a_gigabit_edition#rj45_socket_diy_modification
Try wiggling the cable and see if the plug comes out....

I notice the OpenWRTInvasion had been amended in last 30 days. It may have introduced a bug in the linux install method?

Did you remove the bridge setting from the WAN and WAN6 interfaces?

it says that the network is unreachable

no. Even if it is a bad wan port or a ethernet cable, it should not randomly loose the connection without me touching/moving it.

How do you do it ?

I can't find the 'Bridge' settings in LUCI within 21.02.2, or it's been 'moved'. It exists in 19.07. I've not checked 21.02.1.

ssh into the router and use VI to edit /etc/config/network, or use WinSCP

https://openwrt.org/docs/guide-quick-start/sshadministration#winscp

I tested adding the 'bridge' line, and it caused the MAC address for the WAN and WAN6 interfaces to disappear on my HH5a.
0nomac

How did the line get added to your config?

(If you return openwrt to default settings, does the 'bridge' line appear?)

Is this correct ?

I verified with ssh.

After the edit, I rebooted the router and I could not connect to the router (Both lan and 5G).
Even using the reset button on the router did nothing. (There was no dynamic ip when I ran arp -a and I could not acces the gui)

It was there by default.

Btw, the internet connection status led blinks randomly which normally means that there is internet.