Skip to content

Instantly share code, notes, and snippets.

@jonbackhaus
Forked from midwire/reset_routing_table.sh
Created May 29, 2017 19:19
Show Gist options
  • Select an option

  • Save jonbackhaus/74b42a90ee6c7eecbf67bc0b12d8ae5c to your computer and use it in GitHub Desktop.

Select an option

Save jonbackhaus/74b42a90ee6c7eecbf67bc0b12d8ae5c to your computer and use it in GitHub Desktop.

Revisions

  1. @midwire midwire created this gist Jan 15, 2015.
    26 changes: 26 additions & 0 deletions reset_routing_table.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    #!/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 "**********************************************************"