#!/bin/bash IP=$1 source /opt/scripts/mesh/freq.sh # get center frequency of channel like this: ${chan2g["1"]} 'OR' ${chan5g["149"]} CHANNEL=${chan[$2]} export PHYNAME_ATH=phy0 export DEVNAME_ATH=wlan0 ifconfig ${DEVNAME_ATH} down iw dev ${DEVNAME_ATH} del iw reg set US # set US regulatory domain iw phy ${PHYNAME_ATH} interface add ${DEVNAME_ATH} type managed ifconfig ${DEVNAME_ATH} up iw dev ${DEVNAME_ATH} connect -w access_point ${CHANNEL} key 0:abcdeabcde ip -4 addr add 192.168.10.$IP/24 broadcast 192.168.10.255 dev ${DEVNAME_ATH} # https://donnutcompute.wordpress.com/2014/04/20/connect-to-wi-fi-via-command-line/