Reset network to renew DHCP when changing locations

Oct 22, '03 10:37:00AM

Contributed by: Anonymous

When changing locations in Network via System Preferences and the DHCP service does not provide directly a new IP address, one does not need to restart the computer. A network reset suffices. This can be given via the terminal:

% sudo /System/Library/StartupItems/NetworkExtensions/NetworkExtensions stop
% sudo /System/Library/StartupItems/NetworkExtensions/NetworkExtensions start
A tcsh "Network-restart" script can be easily put into ~/bin to make this easier. Make the script executable with chmod +x Network-restart. Here's the "Network-restart" script:
#!/bin/tcsh -f
#
# aim:      restart network
# usage:  Network-restart

sudo /System/Library/StartupItems/NetworkExtensions/NetworkExtensions stop
sudo /System/Library/StartupItems/NetworkExtensions/NetworkExtensions start
[robg adds: I haven't tested this one.]

Comments (13)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20031021073821426