Using wpa_cli
and busybox udhcpc
Busybox udhcpc execution on gentoo
/bin/busybox udhcpc -x hostname:localhost \
--interface=wlan0 \
--now --script=/lib/netifrc/sh/udhcpc-hook.sh \
--pidfile=/run/udhcpc-wlan0.pid
Switch to another configured network
~ $ sudo wpa_cli
> list_networks
network id / ssid / bssid / flags
0 network1 any [DISABLED]
1 network2 any [DISABLED]
> select_network 1
Allow wpa_supplicant
to connect to any of the networks in
the configuration file (this is the default).
> enable_network 0
> enable_network 1
See the help in wpa_cli
for more detail.
Renewing the DHCP Lease
~ $ kill -SIGUSR1 `cat /run/udhcpc-wlan0.pid`
Or, if you don't like backticks (they are discouraged):
~ $ kill -SIGUSR1 $(cat /run/udhcpc-wlan0.pid)