Skip to content

Instantly share code, notes, and snippets.

@libesto
Forked from midwire/reset_routing_table.sh
Last active August 25, 2025 11:02
Show Gist options
  • Save libesto/e445888fb57cf1a8a3b03afbccfe83a7 to your computer and use it in GitHub Desktop.
Save libesto/e445888fb57cf1a8a3b03afbccfe83a7 to your computer and use it in GitHub Desktop.
[Reset routing table on OSX] #osx #devops #networking
#!/usr/bin/env bash
# Reset routing table on OSX
# display current routing table
echo "********** BEFORE ****************************************"
#netstat -r
netstat -nr -f inet
echo "**********************************************************"
for i in {0..4}; do
sudo route -n flush # several times
done
echo "********** AFTER *****************************************"
#netstat -r
netstat -nr -f inet
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
netstat -nr -f inet
echo "**********************************************************"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment