Can't connect to internet

Hey guys
I recently installed OpenWRT on my Xiaomi 3G router. However I don't know what to do now and im lost. Already tried to get to a solution for hours but couldn't figure it out.
So my problem is that I don't get an internet connection with Wifi but over LAN. If I plug in my router to my modem through the WAN port, I can access the Internet through LAN, however not through Wifi. My modem is like a router/modem combination I think because it has the IP:192.168.1.1
This is why I set my own router to 192.168.2.1. but that's kind of all I got RN.
I'll post my /etc/config/network output below(might help you to see what I did wrong)

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

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 'fdd1:1d36:ef6d::/48'

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

config device 'lan_dev'
	option name 'eth0.1'
	option macaddr '40:31:3c:de:c5:1a'

config interface 'wan'
	option ifname 'eth0.2'
	option proto 'static'
	option gateway '192.168.1.1'

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

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

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

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

I hope someone can help. Thanks in advance

What is the contents of "/etc/config/wireless"?

Well, you have not specified an ip address for your WAN interface...

you should add there something like

option ipaddr '192.168.1.2'

if you want to have it in the same subnet as your modem (that is supposed to be 192.168.1.1

cat /etc/config/wireless 

config wifi-device 'radio0'
	option type 'mac80211'
	option channel '11'
	option hwmode '11g'
	option path 'pci0000:00/0000:00:00.0/0000:01:00.0'
	option htmode 'HT20'
	option country 'CN'
	option disabled '0'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'my-SSID'
	option encryption 'psk2'
	option key 'my-password'

config wifi-device 'radio1'
	option type 'mac80211'
	option channel '36'
	option hwmode '11a'
	option path 'pci0000:00/0000:00:01.0/0000:02:00.0'
	option htmode 'VHT80'
	option country 'CN'
	option disabled '1'

config wifi-iface 'default_radio1'
	option device 'radio1'
	option network 'lan'
	option mode 'ap'
	option ssid 'OpenWrt'
	option encryption 'none'

This is what I get

Well, you have not specified an ip address for your WAN interface...

I am a beginner with OpenWRT but isn't option ipaddr '192.168.2.1' the same as what you are suggesting? If not what exactly is the difference and how do I add the option ipaddr '192.168.1.2' which you recommended to do?

Generally you would set WAN as a DHCP client (which is the default configuration) and have it obtain a 192.168.1.X address from the modem/router. To configure a static WAN address you need not only the IP but also the netmask, gateway, and DNS server. Those will be automatically pushed to your router if it uses DHCP.

It is correct to use 192.168.2.1 for the LAN. The LAN and the WAN must be in different ranges. The LAN netmask is wrong though. A 255.255.0.0 reserves the entire 192.168.X.X range for the LAN. That means there is no difference between 2.1 and 1.1. Use 255.255.255.0 so that only 192.168.2.X is in the LAN.

Take "option disabled 1" out of /etc/config/wireless, obviously it is killing your wifi, that is what that option does.

1 Like
option disable 1

Isn't that just set for the 5G Network? Because I can see a 2.4G network as AP on my laptop/phone

Okay I think I've done everything you said and those are my new config files. However I still don't get a connection on my wireless.

cat /etc/config/network 

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 'fdd1:1d36:ef6d::/48'

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

config device 'lan_dev'
	option name 'eth0.1'
	option macaddr '40:31:3c:de:c5:1a'

config interface 'wan'
	option ifname 'eth0.2'
	option proto 'static'
	option gateway '192.168.1.1'
	option ipaddr '192.168.1.2'

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

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

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

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

and the wireless:

/etc/config/wireless 

config wifi-device 'radio0'
	option type 'mac80211'
	option channel '11'
	option hwmode '11g'
	option path 'pci0000:00/0000:00:00.0/0000:01:00.0'
	option htmode 'HT20'
	option country 'CN'
	option disabled '0'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'my-SSID'
	option encryption 'psk2'
	option key 'my password'

config wifi-device 'radio1'
	option type 'mac80211'
	option channel '36'
	option hwmode '11a'
	option path 'pci0000:00/0000:00:01.0/0000:02:00.0'
	option htmode 'VHT80'
	option country 'CN'
	option disabled '0'

config wifi-iface 'default_radio1'
	option device 'radio1'
	option network 'lan'
	option mode 'ap'
	option ssid 'OpenWrt'
	option encryption 'none'

You still need to set the WAN netmask and DNS server, or use DHCP. The way it is now, clients which do not have a DNS server statically configured will not be able to DNS.

What is the uci command to set it as DHCP?
And if I have done that, should it then Theoretically work?

option proto 'dhcp'

This is the default configuration for WAN. If you have been changing a lot of things I'd suggest going back to default configuration and make only two changes:
Set LAN ipaddr to 192.168.2.1
Enable wifi
and it should work.

Did that but I still couldn't get a internet connection via WIFI.

I think they need your new entire configs both wireless and network

If you have it post ifconfig output too for both the router and the device connected to it. I am learning really slow so need a bigger picture

What I cannot understand is that your wired devices can connect but your wireless devices cannot...

I think I need more information about how are your devices connected and confogured, specially all routers, and what tests you are performing

I don't know either why it didn't work.
I played around a bit and later I realised that it worked but I don't really know what I did.
Anyway..it works now
Thanks for your help

1 Like