Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a wired router to which my ubuntu laptop connects via ethernet. The wierless NIC of the laptop acts as a wireless hotspot on master mode. I use hostapd fo this. I have bridged eth0 and wlan0, so my wireless clients that connect to my laptop over wifi get ip from the wired router via dhcp, so the devices get registered at the wired router ( and the laptop is just an access point). I use the following commands to get my laptop+accesspoint working:

sudo brctl addbr br0
sudo brctl addif br0 eth0
sudo hostapd /etc/hostapd/hostapd.conf &
sudo dhclient -d br0 & 
sudo ifconfig wlan0 netmask up
sudo brctl addif br0 wlan0

These commands enable me to access internet on my wireless clients and also on the laptop which is acting as wireless accesspoint. But if I reboot the wired router (without rebooting the laptop that is acting as accesspoint), Internet access on the laptop+accesspoint gets lost, but on wireless clients it works fine. Even I have not been able to figure out a command which will reset the laptop interfaces to default settings, so everytime the router reboots, I have to reboot the laptop too to get into default settings so that I can re-enter the above mentioned commands. My first question is How can I have my bridge+accesspoint up and running even-though the router reboots? And is there a command to set the interfaces to a default state? (ifdown -a doesn't work, after issuing the command the bridge still remained).

share|improve this question

migrated from Jan 15 '11 at 22:00

This question came from our site for system and network administrators.

i found this out a long time ago but try this sudo su makes life a little easier – whoami Jan 15 '11 at 4:07
But then you lose the accounting of what commands are being executed as root, @Sparky... – Josh Jan 15 '11 at 16:27
up vote 3 down vote accepted

You need to edit /etc/network/interfaces to add the correct configuration. Something like the following should do.

# The primary network interface
auto  br0
iface br0 inet dhcp  
    pre-up brctl addbr br0
    post-up brtcl addif br0 eth0
    pre-down brctl delif br0 eth0
    post-down brctl delbr br0

iface eth0 manual

#auto wlan0
iface wlan0 inet static
    post-up addif br0 wlan0
    post-up hostapd /etc/hostapd/hostapd.conf &
    wireless-channel 3
    wireless-essid mysid
    wireless-mode managed
    wireless-rate 54M auto
    wpa-ap-scan 2
    wpa-bssid mysid xx:xx:xx:xx:xx:xx
    wpa-eapol_version 1
    wpa-group TKIP
    wpa-key-mgmt WPA-PSK
    wpa-pairwise TKIP
    wpa-proto WPA
    wpa-psk mykey
    wpa-scan-ssid 1
    wpa-ssid mysid

There are options for /etc/network/interfaces to setup the wireless configuration using the wireless- prefix. The supplicant program uses the wpa- prefix. The values above were grabbed from a client. The hostapd program may take care some or all these settings.

The DHCP client will be started automatically by the above configuration. man interfaces will display the documentation for the configuration file.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .