Skip to content

Instantly share code, notes, and snippets.

@ultraon
Forked from midwire/reset_routing_table.sh
Created March 6, 2017 10:39
Show Gist options
  • Save ultraon/c0a6ba3c37c91ee0160e3b88e2e5a41b to your computer and use it in GitHub Desktop.
Save ultraon/c0a6ba3c37c91ee0160e3b88e2e5a41b to your computer and use it in GitHub Desktop.
Reset routing table on OSX
#!/usr/bin/env bash
# Reset routing table on OSX
# display current routing table
echo "********** BEFORE ****************************************"
netstat -r
echo "**********************************************************"
for i in {0..4}; do
sudo route -n flush # several times
done
echo "********** AFTER *****************************************"
netstat -r
echo "**********************************************************"
echo "Bringing interface down..."
sudo ifconfig en1 down
sleep 1
echo "Bringing interface back up..."
sudo ifconfig en1 up
sleep 1
echo "********** FINALLY ***************************************"
netstat -r
echo "**********************************************************"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment