Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Autostart Apple's Internet Sharing on startup (cont.)' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Autostart Apple's Internet Sharing on startup (cont.)
Authored by: kmschindler on Feb 17, '03 04:51:13AM

Until recently, everything worked fine, but then it stopped (maybe due to system updates 10.2.3 or 10.2.4).
The cure was to modify the following file:


The second occurence of


has to become


Don't change the first occurence within <key>Airport</key>.

This change needs to be done at startup. My quick and dirty way was to switch on InternetSharing in the SystemPreferences, copy the file with the following command in the Terminal (being root).

cd /private/var/db/SystemConfiguration

Then I modified the script file ISharing:

if [ \"${Isharing:=-NO-}\" = \"-YES-\" ]; then
ConsoleMessage \"Starting internet sharing\"


if [ \"${Isharing:=-NO-}\" = \"-YES-\" ]; then
ConsoleMessage \"Starting internet sharing\"
cd /private/var/db/SystemConfiguration

Sure, there are more elegant ways to do this, but it worked.
Remember that as soon as you change preferences that are stored in this file (e.g. NAT related), you will have to remake the file

[ Reply to This | # ]
A tad more elegant solution using patch
Authored by: peterhil on Sep 25, '03 02:23:53PM

I struggled quite a bit to make this work.

The first problem was that there appeared backslashes before every quote in the scripts in /Library/StartupItems/ISharing directory for some odd reason (copy in Safari paste in Vim?).

You can make sure there are no syntax errors in the scripts by issuing command: sudo SystemStarter -nv

The -n option is for "don't actually perform action on items (no-run mode)". Option -d is debug, which gives you a more detailed output.

Secondly, as the previous poster wrote, newer versions of Jaguar (I'm using 10.2.8 now) will overwrite the file /var/db/SystemConfiguration/ on startup to indicate that the Internet Sharing is not enabled.

In order to enable Internet Sharing at startup, you must change the file in startup script to indicate that Internet Sharing should be enabled. I did this by using diff and patch like this:

  1. Ensure that Internet Sharing is off using the Sharing pane in System Preferences
  2. Make a copy of the file:
    cd /var/db/SystemConfiguration/
    sudo cp
  3. Enable Internet sharing in System Preferences
  4. Make context patchfile from differences of the two files (Diff can't write output to SystemConfiguration directory, so I used home directory for temporary location):
    diff -c1 > ~/nat.patch
  5. Move the patch file to the same directory as other files:
    sudo mv /Users/[usernamehere]/nat.patch .
  6. Remove the unnecessary file and make sure that the files are owned by user root and group wheel:
    sudo rm
    sudo chown root:wheel /var/db/SystemConfiguration/*
  7. Add this command to the file /Library/StartupItems/ISharing/ISharing, just before issuing the /usr/libexec/InternetSharing command (Following comes into one line!):
    /usr/bin/patch -f /var/db/SystemConfiguration/ /var/db/System Configuration/nat.patch > /dev/null &2>1
  8. Test the startup scripts with sudo SystemStarter -nv, restart and VĂ³ila!. You should now have the Internet Sharing automatically enabled at startup.

[ Reply to This | # ]