Xiaomi 4a router (gigabit edition) Internet not working

Hello,

I configured my router with openwrt 21.02.01 using OpenWRT Invasion and used a lan port on my isp's router to connect the xiaomi router to use internet and it did not work.

The ip of the isp router is (192.168.1.1) and the ip of the xiaomi router is (192.168.2.1).

The xiaomi router has two radios (2.4g and 5g) with a wan port and two lan ports.

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 'fd8e:9112:62e6::/48'

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

config interface 'wan'
        option device 'wan'
        option proto 'dhcp'

config interface 'LAN_1'
        option proto 'static'
        option device 'lan1'

config interface 'LAN_2'
        option proto 'static'
        option device 'lan2'

root@OpenWrt:~#

looks weird, the interfaces should show the IPs, at least for LAN and WAN.
try a reset

fwiw, the /etc/config/network file looks incomplete?

Factory reset openwrt to default settings.
Change it's LAN IP address to 192.168.2.1.
Check if WAN is working in OpenWrt.

1 Like

I factory reset the router with this command.

umount /overlay && jffs2reset && reboot now

and changed the lan ip using this command.

uci set network.lan.ipaddr="192.168.2.1"
uci commit network
/etc/init.d/network restart

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 'fd5c:2a3e:9be6::/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 netmask '255.255.255.0'
        option ip6assign '60'
        option ipaddr '192.168.2.1'

config interface 'wan'
        option device 'wan'
        option proto 'dhcp'

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

root@OpenWrt:~#

I tried to ping 1.1.1.1 (cloudflare DNS) and this is the result.

BusyBox v1.33.1 (2021-10-24 09:01:35 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 21.02.1, r16325-88151b8303
 -----------------------------------------------------
=== 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:~# ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1): 56 data bytes
ping: sendto: Network unreachable

The /etc/network/config is still missing sections for MAC address for WAN and LAN interfaces. Looks like a failed installation of OpenWrt ?

The image of the Network > Interfaces page also does not look correct as pointed out by @frolic

Try resetting again by turning on the router. Wait one minute. Then press and hold down the Reset button for 10 seconds.

Try re installing the sysupgrade.bin file using LuCI > System > Backup/Flash firmware.

If all fails, use the Mi Wifi repair tool and restore Xiaomi stock firmware if you are a Windows user.

Then install OpenWrt.

If you are a Windows user, consider the alternative instructions.
https://openwrt.org/inbox/toh/xiaomi/xiaomi_mi_router_4a_gigabit_edition#alternative_firmwares_for_4a_gigabit

Is this a chinese or global model and do you recall what firmware version was installed?

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