Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > NAT Quirks

NAT Quirks
Thread Tools
Cowdog
Dedicated MacNNer
Join Date: Apr 2001
Location: [localhost:~]
Status: Offline
Reply With Quote
Apr 9, 2001, 10:29 PM
 
I set up NAT by following the long running macnn thread and download link.. it seems to have worked fine for a week or so but now it never seems to work on my first startup and I have to restart my computer after the intal boot for the other computers to use the connection.

Anyone know whats going on?
moof. home of the quintuple edit.
     
fitter
Senior User
Join Date: Jan 2000
Status: Offline
Reply With Quote
Apr 10, 2001, 07:43 AM
 
Have you set up NAT to run on startup? I found that having it as part of the startup items was causing some problems (which I think I've worked out...it had to do with the way I created the bundle for startup).

If you post your rc.natd script, that might be a help. A bit more information generally about your setup would improve the chances of a solution.
     
Cowdog  (op)
Dedicated MacNNer
Join Date: Apr 2001
Location: [localhost:~]
Status: Offline
Reply With Quote
Apr 10, 2001, 09:05 PM
 
Originally posted by fitter:
If you post your rc.natd script, that might be a help. A bit more information generally about your setup would improve the chances of a solution.
thanks. I do use it as a startup script, weird thing is that it works fine if I restart once but usually not on the first boot of the day. My setup

Created NAT folder in system/library/startupitems with the plist and the nat script which is as follows.


#!/bin/sh

##
# NAT enables internet connection to be shared.
##

. /etc/rc.common

ConsoleMessage "starting NAT"

#ConsoleMessage "Loading PPP Extension"
#pushd /System/Library/Extensions
#kextload ppp.kext
#popd

ConsoleMessage "Setting NAT parameters"
sysctl -w net.inet.ip.forwarding=1
natd -dynamic -interface en0
/sbin/ipfw -f flush
/sbin/ipfw add divert natd all from any to any via en0
/sbin/ipfw add pass all from any to any


My computer is a BW G3, second ethernet card (en1) connected to network the other (en0) to my cable modem. The permissions are right and I have tried running the script from the terminal (by typing the path and file name, right?), I do get feedback from the terminal but the connection still doesn't work for the other machines unless I do the restart, in which case it works anyway even if I don't run the script from the terminal. Isn't a major quirk but it is annoying having the restart twice at the beginning of the day.


Another note, is there a way to check on my machine if the script executed successfully without checking from one of the other computers?
moof. home of the quintuple edit.
     
altoid
Fresh-Faced Recruit
Join Date: Nov 2000
Location: Brooklyn
Status: Offline
Reply With Quote
Apr 11, 2001, 12:30 PM
 
don't know why it's not working at first boot up, but you should be able to see if it ran successfully by checking that the NAT daemon is running.

ps -ax | grep nat

Tho that wont say if all the ipfw commands completed successfully.

You could try to add an 'if' statement into the script. Something to verify that the divert or add commands worked that would print a postive response if returned positive.
     
Mr_Solar_Wind
Forum Regular
Join Date: Sep 2000
Location: San Diego, CA
Status: Offline
Reply With Quote
Apr 11, 2001, 03:36 PM
 
One possible cause of the issue you may be having is that NAT was incompatible with Classic, at least as far as the public beta is concerned. Do any of you have Classic launching automatically at startup? If so, perhaps there's a classic application that looks on the Internet each day you start up, like a software updater. I don't know about this but it seems possible.

Solar
     
fitter
Senior User
Join Date: Jan 2000
Status: Offline
Reply With Quote
Apr 11, 2001, 04:12 PM
 
I think I've got it. It may, of course, be related to the issue Mr. Wind suggests, although I've had no problems running Classic and retaining a functional NAT daemon with OS X final.

I notice that you've got this line before the body of your NAT script:

Code:
sysctl -w net.inet.ip.forwarding=1
But if you'll look in /System/Library/StartupItems/Network/Network, you'll notice that the network initialization process already takes care of this:

Code:
## # Turn on/off IP forwarding ## if [ "${IPFORWARDING:=-NO-}" = "-YES-" ]; then sysctl -w net.inet.ip.forwarding=1 > /dev/null else sysctl -w net.inet.ip.forwarding=0 > /dev/null fi
Perhaps the system is switching ip forwarding off due to this duplication.

All you need do is make sure that the line in /etc/hostconfig is set to IPFORWARDING=-YES-, and remove the offending line from your script. Replace it with your IP masquerading info (see my script below).

Here is my working NAT startup script (placed in /System/Library/StartupItems/NAT/):

Code:
#!/bin/sh ## # NAT enables internet connection to be shared. ## . /etc/rc.common ConsoleMessage "starting NAT" ConsoleMessage "Setting NAT parameters" ifconfig en0 alias 192.168.0.250 netmask 255.255.255.0 natd -dynamic -interface en0 /sbin/ipfw -f flush /sbin/ipfw add divert natd all from any to any via en0 /sbin/ipfw add pass all from any to any
And here, for the sake of being thorough, is my StartupParameters.plist:

Code:
{ Description = "NAT"; Provides = ("NAT"); Requires = ("Network"); OrderPreference = "None"; Messages = { start = "Starting NAT"; stop = "Stopping NAT"; }; }


Give this a shot and post your results.

[This message has been edited by fitter (edited 04-11-2001).]
     
   
 
Forum Links
Forum 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 On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 12:13 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,