Skip to content

Instantly share code, notes, and snippets.

@bmaddy
Forked from midwire/reset_routing_table.sh
Last active February 11, 2018 20:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bmaddy/199147a3d546812dc9c6ebbeb0c69019 to your computer and use it in GitHub Desktop.
Save bmaddy/199147a3d546812dc9c6ebbeb0c69019 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 -rn
echo "**********************************************************"
for i in {0..4}; do
sudo route -n flush # several times
done
echo "********** AFTER *****************************************"
netstat -rn
echo "**********************************************************"
echo "Bringing interface down..."
sudo ifconfig en0 down
sleep 1
echo "Bringing interface back up..."
sudo ifconfig en0 up
sleep 1
echo "********** FINALLY ***************************************"
netstat -rn
echo "**********************************************************"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment