Script to setup Ubuntu as a wireless access point on a bridge mode
Posted
by
nixnotwin
on Ask Ubuntu
See other posts from Ask Ubuntu
or by nixnotwin
Published on 2011-01-15T14:50:24Z
Indexed on
2011/01/16
12:59 UTC
Read the original article
Hit count: 485
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.
© Ask Ubuntu or respective owner