Changing the IP address for OS X’s shared network

When I’m developing software on small and embedded devices I tend to network them by using a CAT-6 cable between a network port on my Mac and the device and enable Internet Sharing via System Preferences. Unfortunately OS X always selects as the network address and this may class with other networks on your network. Recently I found out how to change this.

I have an Apple USB Network Adapter that I use to provide a second network port. I connect this, using a CAT-6 cable, directly to my target device when developing. Enabling Internet Sharing will forward network traffic from either my primary ethernet port or wi-fi adapter. The only problem with this is the network IP address as I said above. This seems to be a hardcoded default.

However behind all the UI utilities Apple has command line ones that do the grunt work. Internet Sharing is no different. Checking out the man page for InternetSharing provides all sorts of gems.

$ man InternetSharing

Specifically these two snippets of information. This:

     InternetSharing reads the property list stored in the

And this:

     One property worth mentioning is SharingNetworkNumberStart.  This prop-
     erty controls the behavior of InternetSharing when it configures IP
     addresses for the local interfaces.  The property is encoded as a string
     containing the dotted decimal network IP address, assumed to be a class C

You can change the network IP address for the private network by defining a new value for the SharingNetworkNumberStart property.

Open a terminal and edit the file /Library/Preferences/SystemConfiguration/ in vim. (You will need to us sudo to give you administrator/super-user privileges.)

$ sudo vim /Library/Preferences/SystemConfiguration/

At the bottom of the file, just above the second from bottom </dict> add a key value pair for SharingNetworkNumberStart as follows:


Where the can be any network IP address you choose.

Once edited if you restart Internet Sharing you will see the new IP address is used for the network.


4 Responses to “Changing the IP address for OS X’s shared network”

  1. alecthegeek Says:

    This does not seem to work in OS X.8 (Mountain Lion).

    Another handy hint is that you can save the editing with the command

    sudo defaults write /Library/Preferences/SystemConfiguration/ SharingNetworkNumberStart

    However this still does not work on X.8 🙁

  2. alecthegeek Says:

    Mmmm — after a lot of futzing around my problems are due to VMWare networking messing things up. Iz all gud now. Please ignore my previous comments

  3. wasp digital Says:

    Actually this only works if you first close system preferences. Otherwise there is some caching that system preferences does, and the changes get overwritten.

  4. DaZ Says:

    That post helped me achieve this in Mountain Lion

    I had to completly close System Preferences before editing, and Add the key/string pair to AirPort Subset.

Leave a Reply