4

I use the following script to make my netbook a full-fledged wireless access point. It creates a bridge with eth0 and wlan0 and starts hostapd.

#!/bin/bash

service network-manager stop 
ifconfig eth0 0.0.0.0 #remove IP from eth0
ifconfig eth0 up #ensure the interface is up

ifconfig wlan0 0.0.0.0 #remove IP from eth1
ifconfig wlan0 up #ensure the interface is up

brctl addbr br0 #create br0 node
hostapd -d /etc/hostapd/hostapd.conf > /var/log/hostapd.log &
sleep 5
brctl addif br0 eth0 #add eth0 to bridge br0
brctl addif br0 wlan0 #add wlan0 to bridge br0

ifconfig br0 192.168.1.15 netmask 255.255.255.0 #ip for bridge
ifconfig br0 up #bring up interface
route add default gw 192.168.1.1 # gateway

This script works efficiently. But if I want to revert back to use Network Manager, I cannot do it. The bridge simply cannot be deleted. How can I modify this script so that if I run bridge_script --stop, the bridge gets deleted, network manager starts and interfaces behave as if the machine had a fresh reboot.

1 Answer 1

3

You have to remove interfaces from the vbridge before it can be deleted. These commands should do it:

killall hostapd  
brctl delif br0 eth0  
brctl delif br0 wlan0  
ifconfig br0 down  
brctl delbr br0  
service networking restart  
3
  • No,didn't work. The interfaces are removed but it shows that bridge cannot be removed.
    – nixnotwin
    Commented Jan 16, 2011 at 2:37
  • are you root? try dropping the br0 interface before you delete it...editing Commented Jan 16, 2011 at 2:53
  • Thanks. Now I can turn my netbook into a wireless AP, as quickly as it can be made a normal wreless client. Also all my wireless devises have become useful once more.
    – nixnotwin
    Commented Jan 18, 2011 at 13:40

You must log in to answer this question.

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