For some time, I googled and hunted for a solution that would allow me to change the subnet that Internet Sharing (on the Sharing System Preferences panel) uses when sharing onto an Ethernet network — the default being 192.168.2.0. In my case, this also happens to be a subnet used by my corporate VPN, which is not too convenient.
The solution for Leopard turned out to be extremely straightforward, and can be found in the unix help file for InternetSharing — just type man InternetSharing to read it in Terminal:
- Copy the plist file /Library » Preferences » SystemConfiguration » com.apple.nat.plist to your home directory, eg: sudo cp /Library/Preferences/SystemConfiguration/com.apple.nat.plist ~.
- Use Xcode’s Property List Editor (or any other property list editor) to edit the file in your home directory.
- Add a new key (child) to the NAT dict. Call it SharingNetworkNumberStart. The type should be String, and the value is the IP network you want to use (eg 10.168.2.0). As an example, here’s what my edited file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NAT</key>
<dict>
<key>AirPort</key>
<dict>
<key>40BitEncrypt</key>
<integer>1</integer>
<key>Channel</key>
<integer>0</integer>
<key>Enabled</key>
<integer>0</integer>
<key>Extreme</key>
<string></string>
<key>NetworkName</key>
<string>pimpedwifi</string>
<key>NetworkPassword</key>
<data>################</data>
</dict>
<key>Enabled</key>
<integer>1</integer>
<key>PrimaryInterface</key>
<dict>
<key>Device</key>
<string>HUAWEIMobile-Modem</string>
<key>Enabled</key>
<integer>0</integer>
<key>HardwareKey</key>
<string></string>
<key>PrimaryUserReadable</key>
<string>HUAWEI Mobile</string>
</dict>
<key>PrimaryService</key>
<string>C42284CE-6803-42A7-9F54-627DB90321DF</string>
<key>SharingDevices</key>
<array>
<string>en0</string>
</array>
<key>SharingNetworkNumberStart</key>
<string>10.168.2.0</string>
</dict>
</dict>
</plist>
- Save your changes.
- Copy the edited file back to the original location. sudo cp ~/com.apple.nat.plist /Library/Preferences/SystemConfiguration/
Now you can (re-)start Internet Sharing, and it will run on your defined subnet.
Hopefully some day Apple will add this as a config option in the Sharing System Preferences panel.
Article source: http://hints.macworld.com/article.php?story=20090510120814850