djinnZ Advocate
Joined: 02 Nov 2006 Posts: 4831 Location: somewhere in L.O.S.
|
Posted: Tue Mar 26, 2013 12:43 pm Post subject: atheros hostapd - openrc configuration |
|
|
I am unable to understand how to set up my computer as "bridged AP". My NICs are lspci: | 02:07.0 Ethernet controller: Atheros Communications Inc. AR5212/AR5213 Wireless Network Adapter (rev 01) | eth1 lspci: | 01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 06) | eth0 lspci: | 02:05.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10) |
Hostapd work fine with the atheros and i have no problem but now i will bridge wlan0 and eth1.
The "manual" sequence Code: | ifconfig eth1 up
ifconfig wlan0 up
brctl addbr br0
brctl addif br0 eth1
hostapd -B /etc/hostapd/hostapd.conf
brctl addif br0 wlan0
ifconfig br0 ... | work fine. Code: | ifconfig eth1 up
ifconfig wlan0 up
brctl addbr br0
brctl addif br0 eth1
iw wlan0 set 4addr on
brctl addif br0 wlan0
hostapd -B /etc/hostapd/hostapd.conf
ifconfig br0 ... | also work but using iw is dirty trick and must be run as root so is not useful in a wlan0_preup function.
This is the relevant part of the configuration files: /etc/conf.d/net wrote: | modules="iproute2"
# eth0 - wan interface
config_eth0="172.30.0.14/28"
routes_eth0="default gw 172.30.0.1"
# eth1 - lan interface
config_eth1="null"
ifdown_eth1="NO"
# wlan0 - net interface (hostapd)
modules_wlan0="!wireless"
config_wlan0="null"[/code]
essid_wlan0="test"
# br0
bridge_br0="eth1 wlan0"
config_br0="172.30.0.6/28" |
/etc/conf.d/hostapd wrote: | INTERFACES="wlan0" |
/etc/hostapd/hostapd.conf wrote: | interface=wlan0
bridge=br0
driver=nl80211
dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
country_code=IT
hw_mode=g |
If i start by the console the initscripts there are no problems and the sequence is Code: | /etc/init.d/net.eth0 start
/etc/init.d/hostapd start
/etc/init.d/net.br0 start | but at restart openrc will use the order- net.eth0
- net.eth1
- net.wlan0
- net.br0
- hostapd
and net.br0, of course, fail to start.
Adding to default runlevel only hostapd and set /etc/conf.d/hostapd wrote: | INTERFACES="wlan0 eth1 br0" | will also fail.
So my question is : what is the correct way to set up the damned openrc to start the bridge after hostapd and not before? Is an openrc bug or not?
I am not sure than the network section is the better choice bevause the problem is only related to openrc configuration.
edit: i have forget to write /etc*/rc.conf: | rc_net_br0_after="hostapd"
rc_hostapd_before="net.br0" | is an useful workaround but i will change the configuration at the runlevel change (in some case i need to use wlan0 to connect to gateway in place of eth0 and this is badly documented). _________________ scita et risus abundant in ore stultorum sed etiam semper severi insani sunt
mala tempora currunt...mater stultorum semper pregna est
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist |
|