36

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.

4 Answers 4

36
sudo ipconfig set en0 BOOTP
sudo ipconfig set en0 DHCP

Should do it.


Sources:

0
13

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.

2
  • 2
    To view a list of the <network service names> you can use networksetup -listnetworkserviceorder Aug 6, 2014 at 4:17
  • 1
    This was perfect. When doing it via ipconfig it was renewing DHCP and I did have internet connectivity, though the computer thought differently. With using networksetup it seems to have fixed all of that.
    – molson504x
    Feb 2, 2018 at 15:43
1

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…".

0

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.

2
  • Is this an answer or a question? Nov 17, 2014 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, 2014 at 19:17

You must log in to answer this question.