Renewing a DHCP lease

Feb 12, '03 09:32:33AM

Contributed by: Anonymous

If you have a cable modem, you may have to sometimes "renew your DHCP lease" — in other words, get a new IP address from your Internet provider's DHCP server. This is particularly useful when your ISP has recently been suffering connectivity problems and your earlier established connection was disrupted. There are two ways to do this: the 'normal' way, and also the 'shell' way. This is shortened somewhat from this webpage...

The 'normal' way involves the Network preference pane in the System Preferences application. Click on the "Show" pull-down menu and select either 'Network Port Configurations' or 'Active Network Ports,' depending on whether you're using 10.2 or an earlier version. Click off the box next to your network port (usually 'Built-In Ethernet,' unless you're using AirPort), then hit 'Apply Now.' Then click it back on and hit 'Apply Now' again. And as Emeril might say ... BAM! New DHCP lease.

You can also do this through the Terminal. First type the Unix command sudo ipconfig set en0 BOOTP, and then the command sudo ipconfig set en0 DHCP. I aliased the two commands together as 'new-ip' (you put them both on the same line, using a semi-colon to separate them). Don't know how to use aliases? Read this hint (and possibly this one, if you're in 10.2).

If you're working with IP addresses through the terminal, ipconfig getifaddr en0 is another useful one; it should show you your current IP address.

[Editor's note: That last command will only work if you're not hiding behind a router of some sort. If you are, it will instead return your local machine's IP number.]

Comments (20)


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