Change Internet Sharing subnet on Mac OS X
During one of our Support Essentials Courses a delegate asked me if it was possible to change the subnet supplied by Mac OS X default internet sharing service.
After some searching on both the system files and Google, I found that that the configuration file is located in /Library/Preferences/SystemConfiguration/com.apple.nat.plist.
This file only gets created after you have switched internet sharing on. I’ve written this blog to show you how to change the internet sharing subnet on mac OS X. Originally the system gives out 192.168.2.* addresses and I’m now going to show you how to change it to 10.0.111.*
Now we are going to modify the file to suit our needs:
If internet sharing is on, switch it off
Create a backup of the config file just in case something goes wrong: open the terminal app and copy file to desktop:
sudo cp /Library/Preferences/SystemConfiguration/com.apple.nat.plist ~/Desktop.
Now let’s make the changes: to make it easier, continue using Terminal but this time, use defaults command. We need to add 3 lines:
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkNumberStart 10.0.111.1
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkNumberEnd 10.0.111.20
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkMask 255.255.255.0