Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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  
share|improve this answer
    
No,didn't work. The interfaces are removed but it shows that bridge cannot be removed. –  nixnotwin Jan 16 '11 at 2:37
    
are you root? try dropping the br0 interface before you delete it...editing –  hbdgaf Jan 16 '11 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 Jan 18 '11 at 13:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.