Skip to content

Latest commit

 

History

History
94 lines (73 loc) · 1.59 KB

File metadata and controls

94 lines (73 loc) · 1.59 KB

wpa_supplicant

  • No internet, no nmcli (Debian standard / text mode)
export PATH=$PATH:/sbin

# credential
conf=wpa.conf
echo p2p_disabled=1 > $conf
wpa_passphrase SSID PASSWORD >> $conf

# connect
wl=$( ip link | awk -F':' '/^.: w/ {print $2}' )
wpa_supplicant -B -i $wl -c $conf
dhcpcd $wl

nmcli

  • Easiest to use
nmcli device wifi rescan
nmcli device wifi list
nmcli device wifi connect SSID password PASSWORD

netctl

  • Light weight, default on Arch Linux Arm
# interactive connection
wifi-menu

# profiles
netctl list

# start
ifconfig <wlan0> down # must not "UP" before start
netctl start <profile>

# stop
netctl stop <profile>

# auto start
systemctl enable netctl-auto@wlan0

# ip - gateway
netctl status <profile> | grep 'leased\|route via' | sed 's/.* \([0-9]*.[0-9]*.[0-9]*.[0-9]\).*/\1/'

iw

  • Faster than netctl but there're still issues on Arch Linux Arm
# status
iw dev <wlan0> link

# get ssid
iw dev <wlan0> link | grep SSID | awk '{print $NF}'

# scan
iwlist <wlan0> scan

# connect
iw dev <wlan0> connect [ssid] key [hex_key]

# disconnect
iw dev <wlan0> disconnect

ip

  • Manage interface
# status
ip link

# ip
ip addr show

# get ip
ip addr show dev <wlan0> | grep '^\s*inet' | awk '{print $2}'

# get gateway - ip - dns
gwip=$( ip r | grep 'default.*<wlan0>' | awk '{print $3" "$9}' )
dns=$( cat /etc/resolv.conf | grep nameserver | cut -d' ' -f2 )
gwipdns="$gwip $dns"

# set ip
ifconfig <wlan0> [ip]

# remove ip
ifconfig <wlan0> 0.0.0.0

# up/down
ip link set dev <wlan0> [up/down]
# or
ifconfig <wlan0> [up/down]