Quote:
Originally Posted by UserB93 Hi, I am wondering how you got it to work. I have been struggling with an similar setup.
Thanks! |
Here you go...
Code:
#!/bin/sh
. /etc/rc.common
ConsoleMessage "Configuring Network Bridge"
IPFW=/sbin/ipfw
# Enabling IP Forwarding
sysctl -w net.inet.ip.forwarding=1
# Starting NAT
natd -interface en0
StartService ()
{
if [ "${FIREWALL:=-YES-}" = "-YES-" ]; then
CheckForNetwork
# check for network
if [ "${NETWORKUP}" = "-NO-" ]; then exit; fi
# clear all rules
ConsoleMessage "Flushing IPFW Ruleset"
${IPFW} -f flush
ConsoleMessage "Starting IPFW"
# Allow loopback traffic; deny spoofing
ConsoleMessage "Starting NAT"
# Start NAT diverting
${IPFW} add divert natd all from any to any via en0
${IPFW} add divert natd all from any to any via en1
# Allow outgoing traffic
#${IPFW} add 65535 allow all from any to any
fi
}
StopService ()
{
ConsoleMessage "Stopping Bridge"
}
RestartService () { StopService; StartService; }
RunService "$1"