7

Macbook Pro Running 10.7.4 attempting to share ethernet connection via Airport(Wi-Fi) and trying to serve 192.168.1.x addresses to connected clients.

I've tried the guidance provided here (Dead link as of June 2016) and the article Mac OS Hints: Change the default subnet for Internet Sharing
My com.apple.nat file has the following:

NAT =     {
    AirPort =         {
        40BitEncrypt = 0;
        Channel = 0;
        Enabled = 0;
        Extreme = "";
        NetworkName = *****;
        NetworkPassword = <*****>;
    };
    Enabled = 1;
    NatPortMapDisabled = 0;
    PrimaryInterface =         {
        Device = en0;
        Enabled = 0;
        HardwareKey = "";
        PrimaryUserReadable = Ethernet;
    };
    PrimaryService = "352E1799-A5BD-45F7-8C1C-49A963899CFC";
    SharingDevices =         (
        en1
    );
    SharingNetworkNumberStart = "192.168.1.0";
};

But no dice. ifconfig still shows en1 as 10.0.2.1 I've rebooted, made sure System Preferences was closed. en1 up'd and down'd

I'm guessing I need to be modifying a different file. I've looked at the binary for InternetSharing but it has way too much cruft in the file for me to confidently edit it.

Any help? Thanks!

1

2 Answers 2

4
+50

This is specifically for Ethernet > Ethernet Sharing connections, rather than WiFi (it might work for WiFi but I haven't tested) - I thought the answer would best belong here, for Google.

Tested as working up to El Capitan 10.11.5

Apparently since Yosemite, adding just the SharingNetworkNumberStart key is no longer sufficient.
Also, System Prefs caches the NAT file located at /Library/Preferences/SystemConfiguration/com.apple.nat & will just overwrite your settings again, if you do things in the wrong order.
Actual addresses are, of course, your choice.

  • Switch off internet Sharing.
    Close System Prefs

  • In Terminal type these 3 commands

    sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkNumberStart 192.168.0.0
    sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkNumberEnd 192.168.0.20
    sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkMask 255.255.255.0
    
  • Open System Prefs > Network
    Select what is to be your shared port & set as follows

    Configure IPv4: Manually
    IP Address: 192.168.0.1
    Subnet Mask: 255.255.255.0
    Router: 192.168.0.1
    Then in Advanced... > DNS add the same Router Address as DNS server, in this case 192.168.0.1

    OK, Apply.

  • Switch on Internet Sharing

Test your Bridge address in Terminal with ifconfig -a & check the line inet 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255 is what you expected.

Info worked from Mac OS Hints: Change the default subnet for Internet Sharing

1

Apparently, as you say, you need to modify the InternetSharing file, adding:

<key>AirPort</key>
        <dict>
            <key>40BitEncrypt</key>
            <integer>0</integer>
            <key>Channel</key>
            <integer>0</integer>
            <key>Enabled</key>
            <integer>1</integer>
            <key>Extreme</key>
            <string></string>
            <key>NetworkName</key>
            <string>imacnet</string>
            <key>NetworkPassword</key>
            <data>cwB0AHUAYQByAA==</data>
            <key>SharingNetworkNumberStart</key>
            <string>10.0.99.0</string>
        </dict>

It seems pretty straight forward.

3
  • I wish it were as straight forward as it appears. The InternetSharing file mentioned is a binary file and not an easily editable plist. Looking at it with vim is a mess. The standard InternetSharing.plist file does not appear to manage the Airport configuration. Instead it has an argument which called the InternetSharing binary file. I'm looking for a clean way to edit the binary file.
    – syncr
    Commented May 31, 2012 at 17:13
  • You are right, it's a hell of a mess. Couldn't try it until now. I'll keep searching, though.
    – Thecafremo
    Commented May 31, 2012 at 19:59
  • You change the /Library/Preferences/SystemConfiguration/com.apple.nat.plist, which is plain text, not the Internet Sharing file in /usr/libexec/. I added a new answer for how to do this for Ethernet rather than Wifi, if someone wants to tweak to suit for Wifi too.
    – Tetsujin
    Commented Jun 25, 2016 at 14:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .