image
image

Go Back   macosx.com > Mac Help Forums > Networking & Compatibility

Reply
 
Thread Tools
  #1  
Old January 4th, 2008, 04:15 PM
Registered User
 
Join Date: Jan 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
WhyCan'tI is on a distinguished road
Help with natd & ipfw

I have two networks in my location.

The first is a 100Mbps wired & 802.11g wireless network operating on subnet 192.168.1 with subnet mask 255.255.255.0.

The second is a 10Mbps wired & 802.11b wireless network operating on subnet 192.168.2 with subnet mask 255.255.255.0.

A MacBook is on the 802.11g network and has address 192.168.1.100.

Another machine is on the 10 Mbps wired network and has address 192.168.2.229.

A Mac mini is on both networks. Interface en0 has IP address 192.168.1.226. Interface en1 has IP address 192.168.2.200.

Here is a picture:
http://i159.photobucket.com/albums/t...gy/Network.jpg

I am trying to use natd & ipfw on the Mac mini to create a bridge between the two networks. I want to be able to ping from all directions, and for the devices on the 192.168.2 network to be able to reach the internet.

So far I have been using

$ sysctl -w net.inet.ip.forwarding=1
$ natd -v -interface en0
$ ipfw add divert natd all from any to any via en0

But it doesn't appear to be routing any of the traffic.

Any ideas?
Reply With Quote
  #2  
Old January 5th, 2008, 09:13 AM
Registered User
 
Join Date: Jan 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
WhyCan'tI is on a distinguished road
Nevermind. Got it working.
Reply With Quote
  #3  
Old April 15th, 2008, 06:49 AM
Registered User
 
Join Date: Apr 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
UserB93 is on a distinguished road
Hi, I am wondering how you got it to work. I have been struggling with an similar setup.

Thanks!
Reply With Quote
  #4  
Old May 11th, 2008, 07:30 AM
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
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 02:15 PM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.