WIFI AP on hotplug usb device.

Hello.

I’m looking for decision to start WiFi AP on hotplug WiFi USB adapter.
Main problem is to add wlan interface to existing bridge when USB adapter plugged.

I’ve configuration of wlan interface in ifcfg-wlan0 file (the name of interface is changed by udev rule, it’s ok)

[FONT=monospace]BOOTPROTO='none' 
NAME='wlan0' 
STARTMODE='hotplug' 
LINK_REQUIRED='no' 
ZONE='internal'[/FONT]

and ifcfg-br0

[FONT=monospace]STARTMODE='auto' 
BOOTPROTO='static' 
USERCONTROL='no' 
IPADDR='172.30.1.1/27' 
BRIDGE='yes' 
BRIDGE_PORTS="eth_GRAY wlan0" 
BRIDGE_STP='off' 
BRIDGE_FORWARDDELAY='0' 
LINK_REQUIRED='no' 
ZONE='internal'[/FONT]

After reboot (wicked mode) the br0 is misconfigured (the IP is not set) and consist [FONT=monospace][FONT=monospace][FONT=monospace][FONT=monospace][FONT=monospace][FONT=monospace]eth_GRAY interface only. I think the adding wlan0 to br0 ending with an error.[/FONT][/FONT]

[/FONT][/FONT][/FONT][/FONT]

[FONT=monospace][FONT=monospace][FONT=monospace]brctl show[/FONT][/FONT][/FONT]
[FONT=monospace][FONT=monospace][FONT=monospace]bridge name     bridge id               STP enabled     interfaces 
br0             8000.5adeebd60847       no              eth_GRAY [/FONT][/FONT][/FONT]

[FONT=monospace][FONT=monospace]

I know, to add wifi interface to bridge it must be configured by a command:[/FONT][/FONT]


iw dev wlan0 set 4addr on

How this command can be added to automatic configuration?

Next, I’ve plan to start wpa_supplicant for AP mode.

Well, is it wrong way? Do you know more simple decision?

You got it backwards. First you must create AP mode interface which then can be added to bridge.

I know, to add wifi interface to bridge it must be configured by a command:

iw dev wlan0 set 4addr on

This is only if you want to do WDS (i.e. forward packets between different AP). AP by definition forwards packets between WiFi and Ethernet so does not need any special settings for this. See

While setting 4addr on client side allows it to be added to bridge, it will not work unless your AP also supports it.

Do you know more simple decision?

Usually AP mode is managed by hostapd which can be configured either in bidged or in NAT mode and adds interface to bridge itself. NetworkManager can create AP, you may be interested in this thread

wicked is certainly the wrong tool here.

Ok, I’ve made an interface (Please check, is it right?):

**root@BELKA:/etc/sysconfig/network# **cat ifcfg-wlan_nick0 
BOOTPROTO='none' 
STARTMODE='hotplug' 
WIRELESS_ESSID='DELETED' 
WIRELESS_AUTH_MODE='psk' 
WIRELESS_MODE='master' 
WIRELESS_WPA_PSK='DELETED' 
WIRELESS_AP_SCANMODE='1' 
LINK_REQUIRED='no' 
ZONE='internal'

and add this interface to bridge:


[FONT=monospace]**root@BELKA:/etc/sysconfig/network# **cat ifcfg-br0  
STARTMODE='auto' 
BOOTPROTO='static' 
USERCONTROL='no' 
IPADDR='172.30.1.1/27' 
BRIDGE='yes' 
BRIDGE_PORTS="eth_GRAY wlan_nick0" 
BRIDGE_STP='off' 
BRIDGE_FORWARDDELAY='0' 
LINK_REQUIRED='no' 
ZONE='internal'
[/FONT]

[FONT=monospace]
After reboot the WLAN interface is not added to bridge:
[/FONT]

**root@BELKA:/etc/sysconfig/network# **brctl show       
bridge name     bridge id               STP enabled     interfaces 
br0             8000.5adeebd60847       no              eth_GRAY

But I can add it to bridge:


[FONT=monospace]**root@BELKA:~# **brctl addif br0 wlan_nick0 
can't add wlan_nick0 to bridge br0: Operation not supported 
**root@BELKA:~# **iw dev wlan_nick0 set 4addr on  
**root@BELKA:~# **brctl addif br0 wlan_nick0     
**root@BELKA:~# **brctl show                                
bridge name     bridge id               STP enabled     interfaces 
br0             8000.5adeebd60847       no              eth_GRAY 
                                                        wlan_nick0 
**root@BELKA:~# **
[/FONT]

I think, ‘[FONT=monospace]iw dev wlan_nick0 set 4addr on’ is necessary. Else, how it possible to add wifi interface to bridge? [/FONT]