Iodine Script

The iodine IP-over-DNS tunnel is useful for many reasons! If you use it from different places, here is a script that will automatically detect your DNS server, attempt to launch the daemon, and configure routes. It's intended for Mac OS X, on which finding the current DNS server is a little bit more involved than on Linux.

 #!/bin/bash
 sudo killall iodine

 mydns=`echo "show State:/Network/Global/DNS" | scutil | sed -e '/[1-9][0-9]/!d' -e 's/0 ://' | head -1`
 echo "Using DNS server $mydns"
 sudo /usr/local/bin/iodine -P PASSWORD $mydns YOUR.IODINE.SERVER.HERE
 DEFROUTE=`netstat -nr | grep default | awk '{print \$2}'`
 sudo route add -host $mydns $DEFROUTE
 sudo route delete default
 sudo route add default YOUR.TUNNEL.SERVER.GW