Skip to content

Instantly share code, notes, and snippets.

@lucasrangit
Created October 3, 2018 13:52
Show Gist options
  • Save lucasrangit/aabd17a6c2cbc0700ad653a149cc9673 to your computer and use it in GitHub Desktop.
Save lucasrangit/aabd17a6c2cbc0700ad653a149cc9673 to your computer and use it in GitHub Desktop.
WIFI load test using virtual interfaces
#!/bin/bash
# this script creates multiple virtual interfaces
# all of these interfaces associate to the same AP to see how many associations the AP can handle
set -o errexit
set -o xtrace
DEVNAME=wlx0024a5219b70
CLIENTS=50
SSID=bhnt-vote
rfkill unblock all
sleep 2
ifconfig ${DEVNAME} up
sleep 2
# create interfaces
i=1
while [ $i -le $CLIENTS ]; do
iw dev ${DEVNAME} interface add client$i type station
sleep 1
ip link set client$i address 00:00:00:00:00:$(printf '%0.2d' $i)
sleep 1
ifconfig client$i up
sleep 1
iw dev client$i connect -w "${SSID}" && \
dhclient -4 -pf /var/run/wifitest-dhcp-client$i.pid -lf /var/lib/dhcp/wifitest-dhcp-client$i.lease -v client$i
i=`expr $i + 1`
done
# cleanup
killall dhclient
sleep 1
while [ $i -gt 0 ]; do
ifconfig client$i down && sleep 1
iw dev ${DEVNAME} del
i=`expr $i - 1`
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment