Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
atheros hostapd - openrc configuration
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
djinnZ
Advocate
Advocate


Joined: 02 Nov 2006
Posts: 4831
Location: somewhere in L.O.S.

PostPosted: Tue Mar 26, 2013 12:43 pm    Post subject: atheros hostapd - openrc configuration Reply with quote

I am unable to understand how to set up my computer as "bridged AP". My NICs are
  • wlan0
    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
  1. net.eth0
  2. net.eth1
  3. net.wlan0
  4. net.br0
  5. 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:wink:
mala tempora currunt...mater stultorum semper pregna est :evil:
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist :wink:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum