View Single Post
  #4  
Old May 11th, 2008, 07:30 AM
WhyCan'tI WhyCan'tI is offline
Registered User
 
Join Date: Jan 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
WhyCan'tI is on a distinguished road
Quote:
Originally Posted by UserB93 View Post
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"
Reply With Quote