Add multiple IP bindings to Mikrotik Hotspot – Bash Script

Copy and paste the following into a file named mtbypass.sh and then “chmod +x mtbypass.sh”  Or download from this direct link.  Be sure to change the username and password

#!bin/bash
filelist="bypasslist.txt"
username="admin"
password="password!"
ip="$1"

for i in `cat ${filelist}`
do
address=`echo $i | cut -d= -f1`
mac=`echo $i | cut -d= -f2`
sshpass -p ${password} ssh ${username}@${ip} "ip hotspot ip-binding add address=${address} mac-address=${mac} type=bypassed"
done

Now create a file named bypasslist.txt and put all the addresses you want bypassed.  You’ll need the Mac Address and the IP Address.

Example file

192.168.88.2=4C:5E:0C:B8:4E:01
192.168.88.3=3E:AA:A1:2D:8B:2C
192.168.88.5=DE:D1:39:65:91:4E

Usage of script is

./mtbypass.sh MikrotikIP

Example:

./mtbypass.sh 192.168.88.1