Wifi does not connect or goes down

Tried switching to a static ip address:

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 ula_prefix 'fd7b:ae4f:9e47::/48'

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

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'

config interface 'wwan'
	option device 'wlan0'
	option proto 'static'
	option ipaddr '10.1.1.4'
	option netmask '255.255.255.0'
	option gateway '10.1.1.1'
	option broadcast '10.1.1.255'
	list dns '10.1.1.1'

However, diagnostic returned:



PING openwrt.org (139.59.209.225): 56 data bytes
64 bytes from 139.59.209.225: seq=0 ttl=47 time=345.246 ms
64 bytes from 139.59.209.225: seq=1 ttl=47 time=345.656 ms
64 bytes from 139.59.209.225: seq=2 ttl=47 time=346.722 ms
64 bytes from 139.59.209.225: seq=3 ttl=47 time=349.147 ms

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

I still don't know what you're trying to achieve...or even how you set up your network.
Are you still trying this?

If yes, please state so. Didn't you wrote in that thread that you got it to work?
If you're on something different, please outline it detailed.
My crystal ball just shows foggy thingies, so i can't help you with that little bit of information you're sharing.

1 Like

I am trying to do that but I need to solve the wifi problem first.

I guess, you'll have to do this on your own.
We still don't know, what your problem is.
"Wifi doesn't work (sometimes)" is no help at all.

The network seems causing the problem but I am unsure how to fix it.

  • What does bad ping address mean? (I've only seen this error when the user entered an invalid address - simply enter a valid address to ping)
    • Can you just paste the results?

I don't see what you're referring to.

Here:

Show where?

I don't see a WiFi connection.

Wait, are you saying that your device doesn't get an IP from the upstream AP?

  • Have you checked the the AP
  • What channel is the upstream AP set to? (:spiral_notepad: it shouldn't use auto nor DFS channels)
  • Verify settings in /etc/config/wireless

You made a thread about this already: Wireless network scan goes down

What was the WWAN configuration when opkg update worked?

This network config has wifi but somehow the lan interface got stuffed up.


 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 ula_prefix 'fd7b:ae4f:9e47::/48'
 
 config interface 'wan'
 	option device 'wan'
 	option proto 'dhcp'
 
 config interface 'wan6'
 	option device 'wan'
 	option proto 'dhcpv6'
 
 config interface 'wwan'
 	option proto 'static'
 	option device 'wlan0'
 	option ipaddr '10.1.1.4'
 	option netmask '255.255.255.0'
 	option gateway '10.1.1.1'
 	option broadcast '10.1.1.255'
        list dns '10.1.1.1'
 
 config interface 'lan'
 	option proto 'static'
 	option ipaddr '192.168.1.1'
 	option netmask '255.255.255.0'
 	option device 'br-lan'
 
 config device
 	option type 'bridge'
 	option name 'br-lan'
 	list ports 'lan1'
 	list ports 'lan2'
 	list ports 'lan3'
 	list ports 'lan4'
 
 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 5t'
  
 config switch_vlan
         option device 'switch0'
         option vlan '2'
         option ports '0 5t'

Typically, the wifi device (wlan0 in this case) does not belong in the /etc/config/network file. This line should be removed. The wwan network should be associated with the sta mode wifi config in the /etc/config/wireless file.

Let's also take a look at your other config files, while we are at it:

Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

cat /etc/config/wireless
cat /etc/config/dhcp
cat /etc/config/firewall

Although, I think it gets added in the network file but luci? I will have a closer look next time. As stated in the posted above yours I now have the wifi working but have encountered another problem.

This is related to the screenshot that says "connection failed"?
How is that computer connected to the router (wired or wireless)? Does it have a link? What about an IP address?

If you actually post all of the key config files, we may be able to spot the problems (so the 3 I mentioned and the network config, if anything has changed since post 16)..

1 Like

Well, yes! It was the lan interface which has the 4 ports bridged. One port connected via ether cable to my laptop and another connected via ethernet to my desktop machine.

Well, this problem is moot now since I managed to lock myself out of OpenWrt while trying to confirm your statement about wifi interface suppose to be in wireless file.

Sorry you are locked out. What did you change? The lan (especially the Ethernet ports) should not be affected by a change to the wan/wwan or the WiFi radio configuration, so it sounds like something else might be going on.

1 Like

I tried scanning for a network to connect to but while I was connected to said network. I was connected via wireless because of this issue with the lan settings.

Here is the default interfaces file, which works:


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

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'

Default wifi

config interface 'wwan'
	option proto 'dhcp'

in the interfaces file

Please post the complete config files (the full contents of all 4 of the requested files). There isn’t enough information here to help you.

1 Like

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 ignore '1'

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'

firewall

config defaults
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option synflood_protect '1'

config zone 'lan'
	option name 'lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'
	list network 'lan'
	list device 'tun+'

config zone 'wan'
	option name 'wan'
	option output 'ACCEPT'
	option forward 'REJECT'
	option masq '1'
	option mtu_fix '1'
	list network 'wan'
	list network 'wan6'
	list network 'wwan'
	option input 'ACCEPT'

config forwarding
	option src 'lan'
	option dest 'wan'

config rule
	option name 'Allow-DHCP-Renew'
	option src 'wan'
	option proto 'udp'
	option dest_port '68'
	option target 'ACCEPT'
	option family 'ipv4'

config rule
	option name 'Allow-Ping'
	option src 'wan'
	option proto 'icmp'
	option icmp_type 'echo-request'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-IGMP'
	option src 'wan'
	option proto 'igmp'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-DHCPv6'
	option src 'wan'
	option proto 'udp'
	option dest_port '546'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-MLD'
	option src 'wan'
	option proto 'icmp'
	option src_ip 'fe80::/10'
	list icmp_type '130/0'
	list icmp_type '131/0'
	list icmp_type '132/0'
	list icmp_type '143/0'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Input'
	option src 'wan'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	list icmp_type 'router-solicitation'
	list icmp_type 'neighbour-solicitation'
	list icmp_type 'router-advertisement'
	list icmp_type 'neighbour-advertisement'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Forward'
	option src 'wan'
	option dest '*'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-IPSec-ESP'
	option src 'wan'
	option dest 'lan'
	option proto 'esp'
	option target 'ACCEPT'

config rule
	option name 'Allow-ISAKMP'
	option src 'wan'
	option dest 'lan'
	option dest_port '500'
	option proto 'udp'
	option target 'ACCEPT'

config rule 'ovpn'
	option name 'Allow-OpenVPN'
	option src 'wan'
	option dest_port '1190'
	option proto 'udp'
	option target 'ACCEPT'

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 ula_prefix 'fd8a:8fad:fb8b::/48'

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

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'
	option gateway '10.1.1.4'
	option broadcast '192.168.2.255'

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

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

config interface 'wwan'
	option proto 'static'
	option device 'wlan0'
	option ipaddr '10.1.1.4'
	option netmask '255.255.255.0'
	option gateway '10.1.1.1'
	option broadcast '10.1.1.255'
	list dns '10.1.1.1'

wireless

config wifi-device 'radio0'
	option type 'mac80211'
	option path 'platform/18000000.wmac'
	option band '2g'
	option htmode 'HT20'
	option channel 'auto'
	option country 'AU'
	option cell_density '0'

config wifi-iface 'wifinet1'
	option device 'radio0'
	option mode 'sta'
	option network 'wwan'
	option ssid 'ssid'
	option bssid 'bssid'
	option encryption 'psk2'
	option key 'password'

Edit:

Figured out why the lan interface was not working! For some reason it needs DHCP enabled to function even if it is set to a static ip address.

I recommend removing the gateway and broadcast addresses from the lan network interface definition. Those will happen automatically in the background.

I also recommend removing broadcast from the wan (again, it'll happen automatically). This shouldn't cause a problem, but it's just cleaner without.

You had disabled the dhcp server which was the problem. This should be disabled if you have a DHCP server already on a given subnet, but in the vast majority of cases, it should be enabled. In this case, you disabled the DHCP on your lan subnet, so there was nothing to provide DHCP addresses to the hosts on that network. (DHCP is not absolutely required for a network to function, of course. But without it, you must set all of the downstream devices with static IPs (manually configured on each device; some devices don't even have a user interface to let you do this))

Why does it have those sections if they shouldn't be edited? In regard to the gateway it says "10.1.1.1" which, is the ip address on the main router when I had manually set it to "10.1.1.4" the address of the wifi interface. I would have thought it would need the wifi interface address?

They are there so that you can override defaults or make special configurations where needed. But the defaults are usually good for the vast majority of users. It is only necessary to change them if you are doing something that is a bit more custom. It's like the defaults on so many systems these days (ranging from your car to your TV to your computer and everything in between) -- yes, you can change lots of settings, but they're configured with default states that are appropriate for a very large part of the user base.

the gateway is the address of the device that connects to the "next" network (i.e. the internet in many cases). The nominally correct address for the gateway is actually 10.1.1.1 because that is the address of the actual upstream gateway. 10.1.1.4 is held by the router, it's not actually the gateway, but I think this actually works because that address has an associated gateway, but is not technically correct to use it this way. Further, normally the gateway must be defined within the same subnet, and this is not... although it does work because you're defining a gateway that the routing table already understands, it looks strange.

In many cases with this type of normal routed configuration, it is best to omit the gateway because it will cause all routing to break if the wan's network is changed. When omitted, the router will use the default gateway to route traffic from the lan to the upstream (i.e. internet) networks... that default gateway is the address on the wan and is automatically populated in the routing table.