Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- IFACE=wlan0
- ESSID=batman.kiel.freifunk.net
- CHANNEL=11
- NAME=kiel
- if [ "$(whoami &2>/dev/null)" != "root" ] && [ "$(id -un &2>/dev/null)" != "root" ] ; then
- echo "You must be root to run this script!"; exit 1
- fi
- if [ "$1" = "stop" ]; then
- echo "resuming normal networking..."
- echo "restart network-manager"
- service network-manager restart
- echo "turn wlan iface off"
- batctl if del $IFACE
- sleep 10
- echo "OK"
- echo "echo it can take a few minutes until network-manager gets a new route"
- echo
- exit
- elif [ "$1" = "restart" ]; then
- echo "not implemented. call this script first with stop and then with start"
- exit
- elif [ "$1" = "--help" ]; then
- echo "[start](default) or [stop]"
- echo edit the options in the top section of this script to connect to another network
- exit
- else # "start"
- echo "stopping network-manager"
- service network-manager stop
- echo "pls wait"
- sleep 10
- echo "turn wlan iface off"
- ifconfig $IFACE down
- echo" set maximal transfer unit from standard 1500 to 1528"
- ifconfig $IFACE mtu 1528
- echo "turn wlan encryption off"
- iwconfig $IFACE enc off
- echo "start ad-hoc mode"
- iwconfig $IFACE mode ad-hoc essid $ESSID ap 02:ca:ff:ee:ba:be channel $CHANNEL
- echo "load module into kernel"
- modprobe batman-adv
- echo "adding iface to batman"
- batctl if add $IFACE
- echo "turn wlan iface on"
- ifconfig $IFACE up
- echo "turn batman iface on"
- ifconfig bat0 up
- echo "ESSID $ESSID on $IFACE should be ready"
- echo "internet starting, this may take some minutes due to latency..."
- dhclient bat0
- echo "internet connection IP:"
- ifconfig|grep Bcast
- echo
- echo "to resume normal networking call this script with option stop"
- echo
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement