Skip to content

Instantly share code, notes, and snippets.

@tyhenry
Last active May 30, 2018 22:12
Show Gist options
  • Save tyhenry/ca5938739542127d2ce146e0c1d66684 to your computer and use it in GitHub Desktop.
Save tyhenry/ca5938739542127d2ce146e0c1d66684 to your computer and use it in GitHub Desktop.
# Kill wpa_supplicant
# see SO: https://stackoverflow.com/questions/3510673/find-and-kill-a-process-in-one-line-using-bash-and-regex
sudo kill $(ps aux | grep '[w]pa_supplicant' | awk '{print $2}')
# Activate batman-adv
sudo modprobe batman-adv
# Disable and configure wlan0
sudo ip link set wlan0 down
sudo ifconfig wlan0 mtu 1500
sudo iwconfig wlan0 mode ad-hoc
sudo iwconfig wlan0 essid my-mesh-network
# sudo iwconfig wlan0 ap any
sudo iwconfig wlan0 ap 02:12:34:56:78:9A
sudo iwconfig wlan0 channel 8
sleep 1s
sudo ip link set wlan0 up
sleep 1s
sudo batctl if add wlan0
sleep 1s
sudo ifconfig bat0 up
sleep 5s
# Use different IPv4 addresses for each device
# This is the only change necessary to the script for
# different devices. Make sure to indicate the number
# of bits used for the mask.
sudo ifconfig bat0 172.27.0.1/24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment