Skip to content

Instantly share code, notes, and snippets.

@eripa
Created Apr 25, 2014
Embed
What would you like to do?
OS X network bridge
#! /bin/sh
# ######################################
# coded by Nat!
# 2013 Mulle kybernetiK
# GPL
command=${1:-start}
shift
proxyarp=${1:-no}
shift
start()
{
sysctl -w net.inet.ip.forwarding=1
sysctl -w net.inet.ip.fw.enable=1
if [ "$proxyarp" != "no" ]
then
sysctl -w net.link.ether.inet.proxyall=1
fi
ifconfig bridge1 create
ifconfig bridge1 addm en0
ifconfig bridge1 addm en1
ifconfig bridge1 up
if [ $? -eq 0 ]
then
syslog -s "Mulle Ethernet Bridge is up"
else
syslog -s "Mulle Ethernet Bridge failure"
fi
}
stop()
{
ifconfig bridge1 destroy
sysctl -w net.inet.ip.forwarding=0
sysctl -w net.inet.ip.fw.enable=0
sysctl -w net.link.ether.inet.proxyall=0
syslog -s "Mulle Ethernet Bridge is down"
}
case "$command" in
start*) start
;;
stop*) stop
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment