If you active Internet Sharing in a large LAN (e.g. your company). You can share your internet to a subnet until your mac touch another DHCP server. The InternetSharing process will exit, even cannot open again.
Look at you system.log. You will find some word like below:
dhcpd: detected another DHCP server x.x.x.x, exiting.
There is a backend of Internet Sharing. You can find it at
/usr/libexec/InternetSharing. It’s a binary executable file. When it running, it boot other server process: DHCP(bootpd), NAT(natd), DNS(named)
The issus is bootpd will exit when detected another DHCP server by default. Maybe you think change it’s config file. But wait. I have try that way. I make a file
/etc/bootpd.plist and set
detect_other_dhcp_server false. When I check InternetSharing, it rewrite my config file. And when I unchecked, it give my config file back. Amazed!
Ok. We must find another way. In bootpd man, there is an answer: If bootpd receives a SIGHUP (-1) signal, it will re-read its configuration and client binding files.
Let me try this:
- create a file:
- open InternetSharing in sharing preferences panel
- modify detect_other_dhcp_server to 0 in
kill -HUP your_bootpd_pid
Look like it works. When bootpd process detected another DHCP server, it will talk about without shy.
Here is a ruby script: (usage: sudo ruby hup_bootpd.rb)
File.open("/etc/bootpd.plist", "r+") do |f|