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


Click here to return to the 'Much simpler way to do this, using `defaults` command in Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Much simpler way to do this, using `defaults` command in Terminal
Authored by: babbage on May 14, '09 02:45:27PM

There's a much, much simpler way to do this, if you don't mind using Terminal for like 15 seconds.

First, paste the following line into Terminal to make a backup, noting that sudo requires your admin password, and won't work on Leopard if your password is blank:

* sudo cp com.apple.nat.plist{,.backup}

Then verify the current setting for the plist file before making any changes:

* defaults read /Library/Preferences/SystemConfiguration/com.apple.nat

(Note that this won't work if you have the full "com.apple.nat.plist", as the defaults command insists on omitting the ".plist" file extension. Blame Apple.)

Then, assert the new setting (this is the only line that actually does anything):

* sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat SharingNetworkNumberStart 192.168.3.150

Use whatever you find appropriate for that IP address.

Then, confirm the change:

* defaults read /Library/Preferences/SystemConfiguration/com.apple.nat

That's it.

---

--
DO NOT LEAVE IT IS NOT REAL

[ Reply to This | # ]

Much simpler way to do this, using `defaults` command in Terminal
Authored by: daimoh on Jul 23, '09 02:28:07AM

using the "defaults write" stuff worked fine for me, in that it added the relevant line to the file. However, it didn't add it under NAT as the OP mentioned.

So, I used the plist editor that came with XCode, but everytime I restart Internet Sharing, it loses the extra key I put in - it defaults back to what it was before.

How do you make that setting stick?



[ Reply to This | # ]
Much simpler way to do this, using `defaults` command in Terminal
Authored by: ka9lrn on Aug 06, '10 02:14:44AM

I was having the same problem. I found the fix. If the information is in memory when you start/stop Internet Sharing, the file on disk gets written over both when Internet Sharing is started and stopped. I stopped Internet Sharing, changed the file, then rebooted the machine prior to restarting Internet Sharing. After the reboot, it had to get the information from the file. So, the new address information was retained and kept in memory to be written out when it stopped again.

BTW, editing the binary is not necessary. The defaults command worked great with the modified write per Bigtoad. (Don't forget to prepend "sudo" to the example.)



[ Reply to This | # ]
Much simpler way to do this, using `defaults` command in Terminal
Authored by: Bigtoad on Feb 16, '10 08:09:41PM
You got that almost right. A little experimentation showed that this variation worked on 10.6.2:
defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkNumberStart 192.168.24.0


[ Reply to This | # ]