Modify

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#17209 closed defect (not_a_bug)

wlan0 / wifi0, unbridged, does not get ip address assigned

Reported by: doddel Owned by: developers
Priority: high Milestone:
Component: packages Version: Trunk
Keywords: Cc:

Description

trunk, rev. 41765,
HW: UBNT Bullet M5, Configuration: lan routed to wlan that connects to gateway; no bridging nor presence of bridge package.
Problem:
If I manually assign the ip address to wlan0, using ifconfig, it accepts it.
But the ip address defined in 'network' in the section 'wifi0' does not get assigned upon boot. An 'ifdown wifi0' followed by 'ifup wifi0' will show the wlan0 interface again upon 'ifconfig' but without its ip address thast was manually entered. The gateway definition in the wifi0 section of 'network' does not produce a default route either. Lan does get its ip address assigned, even ip_v6, although in 'make menuconfig' ipv6 has been disabled under general options.
Exactly same 'network' arrangement works in earlier versions of OpenWrt that I tried on the same hardware, so it is not defective hardware.

Attachments (1)

wireless (613 bytes) - added by anonymous 4 years ago.

Download all attachments as: .zip

Change History (23)

comment:1 Changed 4 years ago by nbd

please test r41818

comment:2 Changed 4 years ago by doddel

also strange: the hostname, as defined in config/system, does not make it into proc/sys/kernel/hostname. Instead as hostname at the command prompt and in the /proc/... file the command of the first job is shown that I defined in /etc/crontabs/root ; weard.
Something must be wrong with the parsing of the config files. They show properly when issuing the 'uci show' command though. Or have I missed something and has the configuration methodology been changed?

comment:3 Changed 4 years ago by doddel

Just top document the simple /etc/config/network contents:
config interface loopback

option 'ifname' 'lo'
option 'proto' 'static'
option 'ipaddr' '127.0.0.1'
option 'netmask' '255.0.0.0'

config interface lan

option 'ifname' 'eth0'
option 'proto' 'static'
option 'ipaddr' '192.168.109.1'
option 'netmask' '255.255.255.0'

config interface wifi0

option 'ifname' 'wlan0'
option 'proto' 'static'
option 'ipaddr' '192.168.21.9'
option 'netmask' '255.255.255.0'
option 'dns' '192.168.21.100'
option 'gateway' '192.168.21.100'

=====================================================
the lo and lan ip addresses work and are shown upon 'ifconfig', incl. their ipv6 versions.
'ifconfig wlan0' has no ip address whatsoever.
'Route' only shows the lan interface; no wlan0 nor default via wlan0.

comment:4 Changed 4 years ago by doddel

@nbd
tnx! Had missed your comment; sorry. Now tried r41818 via r41836 of today. Result: negative.
The ip address as defined in /etc/config/network does not get assigned. 'Route' does not show the wlan0 interface, nor the default.

comment:5 Changed 4 years ago by jow

Attach your wireless config please.

comment:6 Changed 4 years ago by nbd

by the way, specifying wlan0 as ifname in /etc/config/network is wrong and should be removed.

Changed 4 years ago by anonymous

comment:7 Changed 4 years ago by doddel

had tried removing 'ifname wlan0' in /config/network but no effect.
Manually can make the wlan0 interface work by defining the ip address through ifconfig and the default route using 'route'. These settings are removed again by a 'wifi up'. Ifconfig than still shows the interface but ip address-less. 'Route' has also lost then the wlan0 interface and the default route.

comment:8 Changed 4 years ago by doddel

on ifname in 'network' the wiki states:
"This option may be empty or missing if only a wireless interface references this network".
If it is indeed 'wrong' this should read 'must be missing or empty'.

comment:9 follow-up: Changed 4 years ago by nbd

did the wireless interface connect? because the ip address will only be assigned after the connection has been established.

comment:10 in reply to: ↑ 9 Changed 4 years ago by doddel

@nbd
No; thusfar that has never been required. The interface has an ip address, not the connection ....
So, imho, if this is by design it is very inconvenient.

comment:11 Changed 4 years ago by nbd

you can set option force_link 1 in the interface section. it will ensure that the ip address gets assigned immediately. please test

comment:12 follow-up: Changed 4 years ago by doddel

@nbd
tried adding 'option force_link 1' to the 'config wifi-iface' section.
Result: negative, no change.

comment:13 in reply to: ↑ 12 Changed 4 years ago by doddel

@nbd
correction; added 'option force_link 1' now to '/etc/config/network' and now it works.
After a 'wifi up' the ip address and route of the wifi0 interface are momentarily gone but appear after a few 100 millisecs. The lo and eth0 interfaces show via 'ifconfig' also an ipv6 address line. The wlan0 section does not.
If this behaviour is to stay would suggest to make 'option force_link 1' the default.

comment:14 Changed 4 years ago by doddel

@nbd
investigated behaviour with 'option force_link 1' removed and ap mode i.s.o. sta mode in wireless.
After a brief delay the address and routes get assigned to the ap mode wireless, including an ipv6 address; so in AP mode it works fine.
In either mode there is no wireless connection and in both there is an active radio hardware.
Also from a routing point of view it is desirable to keep the routes and ip address defined even when the link is down; the router can then answer 'gateway not reachable' or something to that extent. Without a default route and knowledge of that interface's ip subnet and whether it is the gateway it cannot be that specific about not being able to guide the traffic.

comment:15 Changed 4 years ago by nbd

  • Resolution set to not_a_bug
  • Status changed from new to closed

enabling force_link by default globally is not a good solution. link status detection is useful to restart dhcp/ppp when a device link goes up again - the cable might have been plugged into a different network, or wifi may have roamed.

what i'll do soon is to enable force_link by default only for proto=static
already pushed a change to netifd git, will be committed to openwrt soon.

comment:16 Changed 4 years ago by doddel

  • Resolution not_a_bug deleted
  • Status changed from closed to reopened

@nbd, tnx.
Just as last detail on this:
how come in AP mode also an ipv6 address gets assigned and in sta (managed) mode not (with force_link set) ?

comment:17 Changed 4 years ago by nbd

  • Resolution set to not_a_bug
  • Status changed from reopened to closed

IPv6 link local addresses are assigned by the kernel when the link is detected. In AP mode, the link is always considered up. In client mode, it is considered up as soon as it is connected.

This is not a bug.

comment:18 Changed 3 years ago by anonymous

  • Resolution not_a_bug deleted
  • Status changed from closed to reopened

Recurring bug in r44597.
no ipv4 address on wifi interface even with said fixed above 'option force_link 1'

comment:19 Changed 3 years ago by nbd

please post your configuration

comment:20 Changed 3 years ago by anonymous

Platform: Ar71xx TPlink Archer C7 V2

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 'fda4:1103:3ec4::/48'

config interface 'lan'

option ifname 'eth1'
option force_link '1'

# option type 'bridge'

option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'

config interface 'wan'

option ifname 'eth0'
option proto 'dhcp'

config interface 'wan6'

option ifname 'eth0'
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 '0 2 3 4 5'

config switch_vlan

option device 'switch0'
option vlan '2'
option ports '1 6'

#### WIFI configuration

config 'interface' 'wlan0'

option 'ifname' 'radio0'
option 'proto' 'static'
option ipaddr 10.11.150.1
option netmask 255.255.255.0
option force_link '1'


#### WIFI configuration

config 'interface' 'wlan1'

option 'ifname' 'radio1'
option 'proto' 'static'
option ipaddr 10.22.150.1
option netmask 255.255.255.0
option force_link '1'


config 'interface' 'usb0'

option 'name' 'usb0'
option 'proto' 'dhcp'
option 'ifname' 'usb0'
option 'defaultroute' '0'
option 'peerdns' '0'

###################

at /etc/config/wireless
config wifi-device radio0

option type mac80211
option channel 36
option hwmode 11a
option path 'pci0000:01/0000:01:00.0'
option htmode VHT80
# REMOVE THIS LINE TO ENABLE WIFI:

# option disabled 1

config wifi-iface

option device radio0
option network lan
option mode ap
option ssid OpenWrt
option encryption none

config wifi-device radio1

option type mac80211
option channel 11
option hwmode 11g
option path 'platform/qca955x_wmac'
option htmode HT20
# REMOVE THIS LINE TO ENABLE WIFI:

# option disabled 1

config wifi-iface

option device radio1
option network lan
option mode ap
option ssid OpenWrt
option encryption none

root@OpenWrt:/#

comment:21 Changed 3 years ago by nbd

  • Resolution set to not_a_bug
  • Status changed from reopened to closed

your configuration is broken. the wifi interfaces you configured are assigned to lan.
you need to remove the ifname options from the interface configurations where you assigned the ip address. you instead need to use the 'network' option in /etc/config/wireless.
please read the wiki documentation for more information.

comment:22 Changed 3 years ago by anonymous

Thank you.
I realized that right after posting the wifi config.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.