How do you release your IP address?

I was just on the phone with my internet provider and they told me that I can manually change my IP address if I do the following commands in a DOS window:

ipconfig/release
ipconfig/renew

I know that you can renew the DHCP lease in the Network preferences but this way doesn't work (unless you have to be in the admin account. I had to type in the admin name and password to get the Network preferences pane to open up so I don't think this is the reason why it didn't work).

So, is there an equivalent way to do the above DOS commands in the unix terminal window or is there a way to do this using the Network preferences?
(And if there is a way in the terminal, what are the commands?)

Thanks to all who reply.

Mark

G4/450MHz Sawtooth

Posted on Jul 30, 2006 11:06 AM

Reply
17 replies

Jul 30, 2006 12:11 PM in response to Mark T1

Those 2 commands for 'ipconfig' on Windows are just resetting the DHCP lease. The "Renew DHCP Lease" button in the Network control panel works for this sometimes, although a more reliable way is to toggle the network connection itself off and back on.

You can do this by toggling the port in the Network Port Configuration area of the Network control panel (uncheck the appropriate On box, click Apply Now, then check On again next to the active port), switching to another Location and back (choosing Apply Now after each), changing the network settings to Manually with some bogus IPs and back, etc. You could also do this a couple of ways in the Terminal with the 'ifconfig' command, but they're really no more efficient than using the Network preferences.

Apple has a couple of articles on this (, ), and MacOSXHints.com has suggestions dealing more with the Terminal side.

Jul 30, 2006 1:01 PM in response to Mark T1

>(And if there is a way in the terminal, what are the commands?)

You can do it via either ipconfig or ifconfig. Both options involve bouncing the interface, so it doesn't really matter which you use. I prefer ifconfig:

sudo ifconfig en0 down
sudo ifconfi en0 up


This bounces the interface forcing it to request a new DHCP lease from the server.

Note that this is different from the 'Renew lease' option in System Preferences which extends the lease on the current IP address, rather than requesting a new. It's only useful if you have a 169.254.x.x address because you didn't get a response from a DHCP server to an earlier request.

Jul 31, 2006 4:37 PM in response to tele_player

Thanks for the info.

According to my ISP, they said that its ok to request a new IP address so I'm not sure the request would be denied. They also posted on their site that its a good security measure to change your IP address. That is why I wanted to get a new one. Another reason is that I have been logging the attempts to get into my computer and some of the IP addresses show that they come from China (I know the actual location can be spoofed). I just feel safer if I often change the IP address.

Mark

Jul 31, 2006 7:43 PM in response to tele_player

Obviously, I'm not that educated in the networking area. You lost me with your last comment (but I appreciate your responding back to me).

I guess what I would still like to know is what are the equivalent (or close to)OS X unix commands for the following windows DOS commands:

ipconfig/release
ipconfig/renew

My ISP said if I was running windows, I could type the above DOS commands and get a new IP address so I would think that there are commands that do the same in an OS X terminal.

Mark

Jul 31, 2006 8:28 PM in response to Mark T1

I wouldn't assume there is a way to do it on OS X, and I'm not convinced that a release followed by renew on Windows will necessarily do it, either.

The commands suggested above by Camelot:

sudo ifconfig <interface goes here> down
sudo ifconfig <interface goes here> up

would perform a release followed by a request, and MIGHT get you a new address. Depends on the DHCP server. In order to guarantee that the address changes, the DHCP client in OS X would need to respond to the server with DHCPDECLINE if the server sent the previous address again, and I don't know of a way to get the OS X DHCP client to do that.

Jul 31, 2006 9:17 PM in response to tele_player

When I tried

sudo ifconfig <interface goes here> down
sudo ifconfig <interface goes here> up

I had the wrong interface which may be why it didn't work. I used en0 but my built in ethernet card is not working so I had to buy a 3rd party card. Its in en2. Next time, I will try these commands.

By the way tele-player, could using the commands that I did be harmful to my system? I'm wondering if I should do a clean install where it just overwrites your system files.

Mark

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do you release your IP address?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.