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

Autostart Apple's Internet Sharing on startup Network
A recent hint here explained how to enable NAT on boot, but this one enables Apple's actual Internet Sharing option from the Sharing panel during startup. Here's what you need to do.

[Editor's note: I have not tested this myself ... and yes, it's distinct from the above referenced hint. That hint launched NAT at startup, the command-line version of internet sharing; this hint enables Apple's version, which apparently has some differences according to the comments to the first hint.]

In the Terminal, open the file /etc/hostconfig as root by typing sudo pic /etc/hostconfig. Add an entry at the bottom looking like this:
ISHARING=-YES-
This is just for having an easy way of disabling
this feature if you want to. Change -YES- to -NO- and it will not start on boot.

Next, you need to createa new StartupItems directory and the required startup files. Do this by typing:
% cd /Library/StartupItems/
% sudo mkdir ISharing
% cd ISharing
% sudo pico ISharing
The last step will open the pico editor on a new, blank "ISharing" file. [Editor's note: I added the "cd ISharing" step here as it was not in the original hint and seems to be required based on the structure of other StartupItems folders.]

In this file, copy and paste the following:
#!/bin/sh

. /etc/rc.common

##
# Start up Internet Sharing
##

if [ "${ISHARING:=-NO-}" = "-YES-" ]; then
ConsoleMessage "Starting Internet Sharing"
/usr/libexec/InternetSharing
fi
Then hit Control-X and type Yes when it asks you to save. After pico quites, type sudo pico StartupParameters.plist and copy this bit into the file:
{
Description = "Internet Sharing";
Provides = ("ISharing");
Requires = ("Network", "NetworkExtensions", "Resolver");
OrderPreference = "Late";
Messages =
{
start = "Starting Internet Sharing";
stop = "Stopping Internet Sharing";
};
}
Save once again as described above using Control-X. Now you're almost good to go. Just one more thing, making sure the permissions are right. Just type these commands:
% sudo chmod 755 ISharing
% sudo chown root:wheel ISharing
% sudo chown root:admin StartupParameters.plist
% sudo chmod 644 StartupParameters.plist
You should now be able to restart your machine and have Apple's Internet Sharing preference enabled at startup.
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[54,781 views]  

Autostart Apple's Internet Sharing on startup | 49 comments | Create New Account
Click here to return to the 'Autostart Apple's Internet Sharing on startup' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
airport sharing, too?
Authored by: blatherskyte on Oct 28, '02 04:54:36PM

can this be augmented in a way that will autoshare as an airport base station? I ask before I begin dredging through the terminal.



[ Reply to This | # ]
airport sharing, too?
Authored by: john_e on Oct 29, '02 05:43:37AM

Well, that should work. Haven't checked where InternetSharing stores it's settings but if you've checked Share Airport Connection or whatever it says, in System Prefs it should work.

Hey just do some testing and tell us all what you find, so we all know what to do
if we ever want to autoshare via AirPort.

/John



[ Reply to This | # ]
airport sharing, too?
Authored by: blatherskyte on Nov 08, '02 12:07:27AM

Set up your sharing for whatever you like...and the hint works great! thanx all!

-j



[ Reply to This | # ]
Set up software base station first, yes
Authored by: Jaharmi on Nov 09, '02 07:44:53AM

If you set up your AirPort software base station settings to your liking first, then any time you run the InternetSharing application, you'll get those same settings.

You don't need to put InternetSharing in its own StartupItem; I've had it in my custom firewall config file for several weeks. (I start all the other sharing features there, but found that InternetSharing enabled a software base station that seems to run in infrastructure rather than ad hoc mode -- it makes all the difference when I'm connecting via my Cisco Aironet 350 card on a Lombard PowerBook.)



[ Reply to This | # ]
Works great
Authored by: paulio on Oct 28, '02 05:23:04PM
This works great except that:
% cd /Library/StartupItems/
should be:
% cd /System/Library/StartupItems/


[ Reply to This | # ]
Works great
Authored by: 47ronin on Oct 28, '02 08:24:53PM

Why /System/Library/StartupItems ?
Why not /Library/StartupItems
like the instructions say? Just curious...



[ Reply to This | # ]
Works great
Authored by: paulio on Oct 29, '02 08:28:43PM

> Why /System/Library/StartupItems ?
> Why not /Library/StartupItems
> like the instructions say? Just curious...

Because there is no /Library/StartupItems:

ls /Library/StartupItems
ls: /Library/StartupItems: No such file or directory



[ Reply to This | # ]
Works great
Authored by: paulio on Oct 29, '02 09:25:37PM

Ok, ok. I didn't read carefully. My bad.

Create a new directory. Don't use the directory that I specified.



[ Reply to This | # ]
Don't touch the System Domain
Authored by: alunapr on Oct 29, '02 04:55:55AM
Sorry, but I really would not encourage people to do this.

The Mac OSX file system is divided into 'domains': System, Local, User and Network. The System domain can only be touch by root (not admin), and consists of the /System folder and parts of /Applications. The local domain includes /Library and is modifiable by admin. The User domain consists of the current user's home directory. As admin, if you want to add startup items they should go in /Library/StartupItems, as the hints says (it works fine).

Here is what Apple says about /System (from 'System Overview'):
The part of the system domain containing the Apple-provided files essential to a bootable system. It includes resources such as system frameworks and fonts. Only the "root" user can modify the contents of this directory; users with "admin" group privileges cannot modify it. Never try to change what is in this directory because doing so could render the system unbootable; for that reason, enabling the root user is discouraged. Note that Apple-provided applications and documentation are not put here.


[ Reply to This | # ]
Works great
Authored by: john_e on Oct 29, '02 05:36:29AM

No, never modify /System unless you have a VERY good reason to do so.

There is a /Library/StartupItems folder, USE IT. Always modify the least
important of two files, if any of the two modifications may be used.


Regards,
John



[ Reply to This | # ]
Works great
Authored by: john_e on Oct 30, '02 06:11:03AM

Actually, there might NOT be a /Library/StartupItems folder. Especially if you have a clean install of the OS. No to worry though, just create one with that name and you're good to go.

Sorry for not mentioning this in the hint.

Either create the folder in the Finder or do:
mkdir /Library/StartupItems

in the terminal.


Regards,
John



[ Reply to This | # ]
does NOT work for me
Authored by: petekjohnson on Oct 28, '02 06:32:36PM

I followed these instructions to the "T" and rebooted and still had to manually start Internet Sharing.

Could someone who has gotten this to work possibly just e-mail to me their StartupItems files so I could try those?

pete_johnson@mac.com

THANKS



[ Reply to This | # ]
does NOT work for me
Authored by: john_e on Oct 29, '02 05:31:27AM

First, you should recheck everything so that there is not any misspellings or anything else. Then check the permissions on the files - this is important. If it still doesn't work, well there could be something different between our setups I guess. I have a static IP for example, maybe you have a dynamic one. Though, if it works when enabling it manually in System Prefs, it really ought to work.

Try this:
restart you computer

check to make sure that Internet Sharing is OFF

then go to terminal and do this:

cd to /usr/libexec

then do this command:

sudo ./InternetSharing

type pass

then you should just return to the prompt, however, in
the background Internet Sharing is now running. Check
System Prefs to see if it's enabled - it should be. Also
check if other machines on your network can get on the
internet. They should be able to.

If this worked, then you must have made a mistake in the
Startup scripts somewhere.

Also, DO NOT, put the Startup scripts in /System/Library/StartupItems/
that directory is reserved for the standard System supplied StartupItems.
There is a REASON, why there are such folders in other places. Never customize
your system inside the /System folder, always do it in /Library/ or /Users/<you>/Library/

At least if you don't have a VERY good reason to modify /System


Regards,
John



[ Reply to This | # ]
does NOT work for me
Authored by: Magnum on Oct 29, '02 01:48:19PM
Doesn't work here either.

The problem is, that InternetSharing does not
start from the terminal.

sudo ./InternetSharing -d

produces:

InternetSharing[1587]: InternetSharing starting

InternetSharing[1587]: no primary service specified, exiting


Anyone know how to fix this?


[ Reply to This | # ]
does NOT work for me
Authored by: john_e on Oct 30, '02 06:07:35AM

Hmm. Maybe you should set your options in the Internet sharing prefs pane first, then try it again. I'm not sure what happens if you have, for example, both airport and ethernet installed on your machine. My setup only has one ethernet card that connects both to the internet AND to the internal network, not very secure, but my main reason is just to share my single IP among several computers.

I have no idea where the Internet sharing prefspane stores it's settings so I'm no help there, sorry. Maybe you should try looking for that and see if you can do anything there?

Regards,
John



[ Reply to This | # ]
does NOT work for me
Authored by: Magnum on Nov 05, '02 01:34:22PM

Okay, I have done some testing and have not succeeded. I tried 5 different
machines, with or without airport, with different configurations - it
doesn't work anywhere. The only cause I can think of is the Internet
connection itself.
Are any of you using an Internet connection over LAN or are you using
PPPoE? All machines I tried use a LAN connection.
I would like to know if any of you have succeeded with this over a LAN
Internet connection.

/Magnum



[ Reply to This | # ]
does NOT work for me
Authored by: cybergoober on Nov 08, '02 12:25:01PM

My desktop is connected to the LAN via ethernet. I connect to the Internet on my laptop via my desktop using this tip.

Desktop:
In the Network System Preferences pane I left my Ethernet settings as-is.
AirPort Settings same as ethernet except,
I changed the IP to 10.0.0.1

Laptop:
AirPort IP set to 10.0.0.2
Router 10.0.0.1
All other IP settings are the same as the desktop.

Draw back.
On the laptop I can connect to machines on the LAN via IP or Hostname but cannot browse the LAN.

Perhaps I have something mis-configured, but broadcasting DHCP is unacceptable.



[ Reply to This | # ]
Set up via System Prefs first?
Authored by: Jaharmi on Nov 09, '02 07:54:04AM

Have you set up Internet Sharing via System Prefs first? You can get around a lot of problems by just letting the system pref do its work. I have no idea where it installs its config files; I do know that starting the InternetSharing app from the command line works if you have set it up beforehand via System Prefs.

You should not need to assign any IP addresses to the interfaces you are configuring. InternetSharing handles this for you, and I don't know how to stop it from doing its automatic thing or customize what it does. Every attempt I've made makes duplicate interfaces that I see when I run ifconfig at the command line.

You will need at least two interfaces, and I'm sorry to tell you that there may not be a way to turn of DHCP. If you have Ethernet and AirPort, you can share your Ethernet-based Internet connection with AirPort users. (You could also share your Ethernet connection via Ethernet with other Ethernet-based computers -- there's a checkbox for that -- but I would say it's safer to have a second Ethernet card and share that instead.) You'll end up sharing any interfaces that don't host your primary Internet connection, in my experience.

I have been running this happily for weeks, since I struggled with my firewall/nat setup after upgrading to Jaguar. (I had previously customized my firewall in 10.1, and had to make some changes to get it to work in 10.2.)

If you are having problems, maybe it's because you haven't set up Internet Sharing via the GUI first ... ?



[ Reply to This | # ]
Set up via System Prefs first?
Authored by: Magnum on Nov 12, '02 04:56:33AM

Sorry for not putting it clearly. I connect to the Internet through a LAN
on my Cube and I share this connection over an Airport to my iBook. Internet
Sharing works fine when I start it from the Pref Pane and before Jaguar gNAT
did the trick. I've tried all kinds of different sharing settings - InternetSharing won't start from the command line.
It's frustrating to read about it, when I can't get it to work on any Mac I
tried.

/Magnum



[ Reply to This | # ]
does NOT work for me
Authored by: jaysoffian on Dec 09, '02 08:19:58PM

Finally, with a little help from ktrace, I figured out the last piece of the puzzle.

In /var/db/SystemConfigurations is a file called com.apple.nat.xml. If you
open this with Property List Editor (just type 'open com.apple.nat.xml from
the CLI), you'll see the property Root->NAT->Enabled is set to '0' when
Internet Sharing is off, and '1' when it is on.

It looks like what the Sharing pane does when you click 'Start' is to edit
this file, setting Enabled to 1, then it runs /usr/libexec/InternetSharing.

When I do this, InternetSharing starts properly for me. The Sharing pane
indicates that sharing has started and the airport icon in my menubar does
as well.

So, what to do? Just setup your prefs in the Sharing pane, start sharing, then
make a backup copy of this file. In the start script mentioned in this tip,
add an additional step to restore com.apple.nat.xml with the backup copy
you just made before running InternetSharing.

Good luck.



[ Reply to This | # ]
does NOT work for me
Authored by: osxfan57 on Mar 14, '03 10:41:34PM

I followed your steps - after issuing the command, Internet Sharing is NOT turned on (as verified by looking in Sharing under Sys Prefs).
What could be the problem? I'm trying to get this working so that I can use Bluetooth to allow my Palm Tungsten to have a web connection. Thanks.

---
iMac 17, OS 10.2.4



[ Reply to This | # ]
/Library/StartupItems…
Authored by: cybergoober on Oct 29, '02 10:00:53AM

Not here. On any of my systems.

Not sure what to do here.

*edit*-- Hmm. Just looked at a system that was "upgraded" (all mine were clean installs of Jaguar). That system has a /Library/StartupItems folder (also of note, the only items in this folder were created by NAV, did NAV create the /Library/StartupItems directory?). Is this a carry-over from 10.0/10.1 then? How many of you that do have /Library/StartupItems upgraded/clean installed? Could I safely just create /Library/StartupItems myself? I don't want to hose anything up here.



[ Reply to This | # ]
Nevermind
Authored by: cybergoober on Oct 29, '02 10:20:36AM

Grew some cajones(sp?) and created the directory (/Library/StartupItems) myself.

Followed the directions as specified and… it works. Cool.

Perhaps there should be an addendum for those of us who clean installed Jaguar
and don't have /Library/StartupItems already. Someone not familiar with mucking
around in the Terminal might not know what to do when they
cd /Library/StartupItems and get error that there is no such directory.



[ Reply to This | # ]
(sp?)
Authored by: elkraneo on Jan 07, '03 06:08:00PM
you mean "cojones" ? ;-)

[ Reply to This | # ]
I hope Apple are reading this
Authored by: Anonymous on Oct 31, '02 06:50:17PM

The real question is why they didn't do this themselves.



[ Reply to This | # ]
I hope Apple are reading this
Authored by: Jaharmi on Nov 09, '02 07:56:59AM

It would also be nice to have documentation on how to configure Internet Sharing for advanced users, and where its settings are stored. I'd like to hand-tune some things based on my firewall/nat setup used in 10.1, and I haven't been able to track down the relevant config files for Internet Sharing. It just seems to ignore the manual configuration I've done ... creating duplicate interfaces and whatnot.



[ Reply to This | # ]
Auto connect PPoE?
Authored by: MrMadnutz on Nov 19, '02 08:38:41PM

Hey,
This is great, but I also need to be able to autoconnect to Verizon... any way to do this? In OS9 I can put my verizon stuff in the System Folder/Startup Items folder, but under X how can I get this service to run at startup?



[ Reply to This | # ]
Is Internet Sharing also available on a modem dialup connection?
Authored by: logo on Nov 20, '02 04:57:28AM

I'm using my internal modem or an ISDN connection at home.
Will this work if I connect my iBook to a G4 via Ethernet?



[ Reply to This | # ]
works for me
Authored by: macsurveyr on Nov 22, '02 11:12:17PM

I just got around to trying this, and it works fine. FYI - I did an UPGRADE to Jaguar. I have had internet sharing on, share your connection with Airport-equipped computers enabled since upgrading and have had to restart the sharing in system preferences until now.

Copied the hint exactly, restarted, software airport base station- essentially that is what it is - was working immediately.

Thanks for the hint - works great.



[ Reply to This | # ]
Pico editor??
Authored by: Anonymous on Nov 28, '02 12:14:34AM

Hi John,
Please tell me what the pico editor is as in
"The last step will open the pico editor on a new, blank "ISharing" file."
Thanks



[ Reply to This | # ]
Pico editor??
Authored by: john_e on Dec 08, '02 06:27:07PM

Pico is a terminal text editor. If you just type "pico" and then enter it will open with a blank page and no document name specified. If you type, for example "pico blaha" it will open with a blank document called "blaha" most probably. Though, if there already is a file in the directory you're in named "blaha", pico will open that file.
As simple as that. I prefer pico when editing system files, because of it's simplicity. There is also "vi" and "emacs", which you could try(there are other editors as well, but these are the most widely known afaik, and are both installed on OS X).

Hope this clears it up!



[ Reply to This | # ]
complete newbie
Authored by: MrRee on Dec 10, '02 09:19:41PM

I'm a complete newbie to the terminal - I got as far as opening /etc/hostconfig as root but then had no idea how to add an entry at the bottom. Can anyone give me a primer on adding that - or where to look?



[ Reply to This | # ]
Way to enable infrastructure mode without the extras?
Authored by: OmegaAtUMD on Dec 14, '02 09:23:47AM

This tip works perfectly for enabling the standard internet sharing suite. Before this tip, I had been running natd manually with my own ipfw rules and simply setting up an adhoc wireless network. I'd like to use apple's internet sharing except for 2 major reasons:
it assigns new ip addesses to shared interfaces
automatically starts its own dhcp server (bootpd)

any ideas on how to either stop this behavior or manually get my airport card to run in infrastructure mode instead of adhoc?



[ Reply to This | # ]
Way to enable infrastructure mode without the extras?
Authored by: Jaharmi on Jan 31, '03 09:57:14AM

InternetSharing runs my AirPort card in infrastructure mode. If you have the AirPort menu extra in your menu bar, the AirPort "waves" will change to a diamond with an upward arrow inside.

As far as my Cisco AiroNet 350 card was concerned, it was connected to a real base station in infrastructure mode. I couldn't get it to connect to any software base stations in ad hoc mode, so I assume that's the difference that InternetSharing makes.



[ Reply to This | # ]
isharing
Authored by: g4macuser on Dec 25, '02 11:20:25AM

i tried the ISHARING=-YES- and got a \"Command not found.\" reply from terminal



[ Reply to This | # ]
isharing
Authored by: JayKiL on Jan 02, '03 08:01:49PM

I had the same problem, and then I found the solution: there is a mistake in the first command line.
It shouldn't be "sudo pic /etc/hostconfig" but "sudo pico /etc/hostconfig".
Then, you can add ISHARING=-YES- under the others.

JayKiL



[ Reply to This | # ]
Works fine (but)...
Authored by: TheGeek on Jan 16, '03 08:38:35AM
It does work fine but, please note this:

there is a minor error in the line that says to "type sudo pic /etc/hostconfig".
It should say "sudo pico /etc/hostconfig"

Pico is a simple terminal based file editor (a "terminal TextEdit") while pic is a program to "compile pictures for troff or TeX" that apparently printed the contents of the hostconfig file in the terminal.

Apparently this confused a lot of people! Once inside pico, go to the bottom of the file (using arrow keys) and add the line as written in the hint text (copy-paste will work)

(many thanks to the author for this wonderful tip)

[ Reply to This | # ]
adding entry
Authored by: g4macuser on Feb 01, '03 05:59:24AM

how do i add the ISHARING=-YES-, is there a command to go in front of this? if i just type it in i get: ISHARING=-YES-: Command not found.



[ Reply to This | # ]
just saw the reply to my previous, sorry
Authored by: g4macuser on Feb 01, '03 06:01:43AM

sorry about that



[ Reply to This | # ]
step by step for us dummies
Authored by: g4macuser on Feb 01, '03 08:04:31AM
Section 1
Open the Terminal App

Enter the following command:

sudo pico /etc/hostconfig

when prompted for your password, enter it and hit return

Add an entry at the bottom looking like this:

ISHARING=-YES-

Use the key command Control - X to exit
Hit the Y key for yes
Enter or Return

This is just for having an easy way of disabling
this feature if you want to. Change -YES- to -NO- and it will not start on boot.


Section 2
Next, you need to create a new StartupItems directory and the required startup files.
Do this by typing each of the following lines at the% prompt and hitting enter or return after each line:

cd /Library/StartupItems/
sudo mkdir ISharing
cd ISharing
sudo pico ISharing



The last step will open the pico editor on a new, blank "ISharing" file. In this file, copy and paste the following:
#!/bin/sh

. /etc/rc.common

##
# Start up Internet Sharing
##

if [ "${ISHARING:=-NO-}" = "-YES-" ]; then
ConsoleMessage "Starting Internet Sharing"
/usr/libexec/InternetSharing
fi


Use the key command Control - X to exit
Hit the Y key for yes
Enter or Return


Section 3
Enter the following command:

sudo pico StartupParameters.plist

When prompted for your password, enter it and hit return

Copy and paste the following into the blank file just like above:
{
Description = "Internet Sharing";
Provides = ("ISharing");
Requires = ("Network", "NetworkExtensions", "Resolver");
OrderPreference = "Late";
Messages =
{
start = "Starting Internet Sharing";
stop = "Stopping Internet Sharing";
};
}


Use the key command Control - X to exit
Hit the Y key for yes
Enter or Return


Section 4
Just one more thing, making sure the permissions are right. Do this by typing each of the following lines at the% prompt and hitting enter or return after each line:

sudo chmod 755 ISharing
sudo chown root:wheel ISharing
sudo chown root:admin StartupParameters.plist
sudo chmod 644 StartupParameters.plist


Type exit to end your Terminal terminal session

Now restart your machine.

[ Reply to This | # ]
step by step for us dummies
Authored by: JiveGuy on Apr 08, '03 07:51:25PM

First post worked fine for me under 10.2.4

Thanks.



[ Reply to This | # ]
Works great with Airport under 10.2.8
Authored by: alexanderklar on Dec 03, '03 04:41:18AM

A great thank you for the original post and this refined step-by-step explanation. I am using my iMac 17" flat panel with Mac OS 10.2.8 as an "Airport base station" - and the hint works great. I just start up the computer and the Airport Icon in the menu bar shows that arrow pointing upwards just as I like it. :-)

Thanks, thanks, thanks!



[ Reply to This | # ]
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:

/private/var/db/SystemConfiguration/com.apple.nat.xml

The second occurence of

<key>Enabled</key>
<integer>0</integer>

has to become

<key>Enabled</key>
<integer>1</integer>

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
cp com.apple.nat.xml com.apple.nat.xml.on

Then I modified the script file ISharing:

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

became:

if [ \"${Isharing:=-NO-}\" = \"-YES-\" ]; then
ConsoleMessage \"Starting internet sharing\"
cd /private/var/db/SystemConfiguration
cp com.apple.nat.xml.on com.apple.nat.xml
/usr/libexec/internetsharing
fi

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 com.apple.nat.xml.on



[ 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/com.apple.nat.xml 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 com.apple.nat.xml file:
    cd /var/db/SystemConfiguration/
    sudo cp com.apple.nat.xml nat.off
  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.off com.apple.nat.xml > ~/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 nat.off and make sure that the files are owned by user root and group wheel:
    sudo rm nat.off
    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/com.apple.nat.xml /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 | # ]
Malformatted parameters file
Authored by: jakerollo on Oct 17, '03 07:43:23AM
After a clean install of 10.2.8 this tip does not work any more. When i try

sudo Systemstarter -nv

it returns "Malformatted parameters file /Library/StartupItems/Isharing/StartupParameters.plist".

I copy/pasted the text from the tip and made some changes to the script so that com.apple.nat.xml has the right values. What could be wrong?

[ Reply to This | # ]
Malformatted parameters file
Authored by: kmschindler on Nov 09, '03 05:35:22PM

It still works here. No clean install, though (:-)
Maybe some small nasty typo?
Does it look ok, when opened using the Property List Editor?
If you still cannot figure it out, you may send me the file.
email: karl-michael.schindler (at) web.de
Just replace the (at) with the corresponding letter. Sorry, for the hassle, but I try to avoid the email harvesting bots of these bloody spammers.



[ Reply to This | # ]
problems with macosxhints formatting
Authored by: smcghee on Dec 10, '03 04:04:37PM
specific to this article, probably applies to others: if you choose "print this page" the line
if [ "${ISHARING:=-NO-}" = "-YES-" ]; then
comes out as
if [ "$" = "-YES-" ]; then
this causes the script to not work. obviously.

[ Reply to This | # ]
Autostart Apple's Internet Sharing on startup
Authored by: rulerk on Jan 14, '04 03:00:37AM

It's lovely that everyone is so anxious to turn on Internetsharing, but I'm actually looking for a command to turn it off. Does anyone know of one?



[ Reply to This | # ]
Autostart Apple's Internet Sharing on startup
Authored by: Brian Kendig on Feb 04, '04 10:18:44AM

This tip is no longer necessary under Panther, which automatically restarts Internet Sharing on startup if it was on at shutdown.



[ Reply to This | # ]