Automatically enable Internet Sharing at startup
Feb 26, '08 07:30:00AM • Contributed by: Michelasso
Feb 26, '08 07:30:00AM • Contributed by: Michelasso
You are sharing the Internet connection via Airport, but after every reboot, the AirPort icon in the menu bar shows that Internet Sharing is disabled. Looking in the Internet Sharing prefs panel, everything is configured correctly. Disabling and enabling it again, and it works as it should. This happened to me various times with 10.4.11 and it always happens with 10.5.x. I discovered that by killing either the InternetSharing or the bootpd process, launchd restarts them correctly and InternetSharing gets enabled. Since launchd stores the PID of bootpd in /var/run/bootpd.pid, I thought to automate the process of "refreshing" InternetSharing/bootpd at boot time by means of the /etc/rc.local script. (For compatibility reasons, this script still works in Leopard -- see man rc for details. Basically one needs just to issue the following command:
[robg adds: I haven't tested this one.]
sudo sh -c 'echo kill $(cat /var/run/bootpd.pid) >> /etc/rc.local'
Run that command, then reboot. After logging in, you will notice that the AirPort icon will show a disabled Internet Sharing state that switches automatically to enabled after a slight delay. I also noticed that this workaround fixed a problem I had with Medialink (a program to share media files to the PS3 via UPnP) that did not always recognize my PS3.
[robg adds: I haven't tested this one.]
•
[21,719 views]
