Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am looking to release and renew my IP address in OS X 10.4 (Tiger) using Terminal. Essentially, I need the OS X equivalent of Windows':

C:\\> ipconfig /release  
C:\\> ipconfig /renew

However, I need the interface to remain active during this process, so using ifconfig down/up will not work.

I believe I can clear the IP address with ifconfig <interface> delete, but I'm not sure how to get the DHCP client to reassign the address. An article from 2002 suggests using set dhcp, but Apple's ifconfig man page does not include this information.

share|improve this question

4 Answers 4

sudo ipconfig set en0 BOOTP <return>

sudo ipconfig set en0 DHCP <return>

Should do it.


Source: from macosxhints.com and itnetcentral.com

share|improve this answer

If you need to do this without having sudo privileges, then the easiest way is to create a new location, let's call it "DHCP", and then change to it, and back again… This also causes Mac OS X to reconfigure the networking. The commands needed are:

scselect DHCP
scselect Automatic

You can create a new network location from the network preference setting panel, select the dropdown at the top that says "Automatic" and then "Create New…".

share|improve this answer

I find that the commands

ipconfig set <interface> BOOTP 
ipconfig set <interface> DHCP

do accomplish releasing the interfaces IP, but won't renew it. This behavior might be explained because I'm working on a MACBook Air. However, I've also tried this on a MacBook Pro with the same outcome. A quick perusal of networksetup's man page reveals two sister commands to the ones for ipconfig. These commands are

networksetup -setbootp <network service name>
networksetup -setdhcp <network service name>

where is the name seen in the network settings status pane. If you open the network settings you can watch this command work by watching the "Configure IPv4" option change. Note, to save on typing I excluded the sudo from all my commands, and of course if your system requires elevated priveleges to execute commands you should use "sudo" on the front of the commands listed in this answer. Hope this saves someones the hair pulling and fuming I experienced looking for such a simple command.

share|improve this answer
    
To view a list of the <network service names> you can use networksetup -listnetworkserviceorder –  David Graham Aug 6 at 4:17

I was able to release/renew the IP address using

sudo ipconfig set en0 BOOTP <return>
sudo ipconfig set en0 DHCP <return>

But now I can't access screen sharing over Ethernet using the built-in VNC. I can still access it over Wi-Fi from my phone.

share|improve this answer
    
Is this an answer or a question? –  Peter Mortensen Nov 17 at 15:25
    
It's yet another way to accomplish the same thing so it is an answer. I just commented on my complete experience with it. –  hmj6jmh Nov 17 at 19:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.