Created
August 24, 2012 03:28
-
-
Save hydra35/3445140 to your computer and use it in GitHub Desktop.
destroy NAT gateway on OSX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# All these steps look excessive but address | |
# network instability issues created by not doing them | |
gwdev=`netstat -nr | grep default | awk '{ print $6 }' | head -1` | |
if [ -z "$gwdev" ]; then | |
gwdev=en1 | |
fi | |
killall natd | |
/sbin/ipfw delete 100 divert natd ip from any to any via $gwdev | |
sysctl -w net.inet.ip.forwarding=0 | |
ifconfig $gwdev down | |
ifconfig en0 down | |
route delete default -interface bridge0 -ifscope bridge0 | |
ifconfig bridge0 172.20.0.1 delete | |
ifconfig bridge0 deletem en0 | |
ifconfig bridge0 destroy | |
ifconfig en0 up | |
ifconfig $gwdev up |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment