Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > a CLI command to request a new lease from DHCP server

a CLI command to request a new lease from DHCP server
Thread Tools
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Mar 5, 2003, 09:32 AM
 
I have seen that Coctail offers a GUI to request a new lease from DHCP server. Can somebody tell me what the Darwin command is that is being used here? I know that I can click around in the network system prefs to get a new IP, but I'd prefer a little command.
     
Dedicated MacNNer
Join Date: Aug 2002
Status: Offline
Reply With Quote
Mar 5, 2003, 12:15 PM
 
Code:
sudo ifconfig en0 down sudo ifconfig en0 up
sudo - run as root
ifconfig - command you are running as root, configures network interfaces
en0 - may vary, is the interface you wish to modify
down, up - turn the interface off or on, respectively

Taking your network interface down and then bringing it back up will force it to re-check the lease with the dhcp server. This won't actually change your address though unless you are on a different network with a different dhcp server. Otherwise it will renew the lease on your current address.
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Mar 5, 2003, 12:24 PM
 
Originally posted by Simon:
I have seen that Coctail offers a GUI to request a new lease from DHCP server. Can somebody tell me what the Darwin command is that is being used here? I know that I can click around in the network system prefs to get a new IP, but I'd prefer a little command.
I can't say I know what it means exactly, but here is the command it is running:

Code:
sh -c sudo -b ipconfig set en0 BOOTP; sudo -b ipconfig set en0 DHCP
What I want to know is how it gets the sudo password. Seems a bit disconcerting to me that it can run a sudo command with no password.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
Dedicated MacNNer
Join Date: Aug 2002
Status: Offline
Reply With Quote
Mar 5, 2003, 05:48 PM
 
I believe it has to do with the little lock icon at the bottom of the preferences pane. Unlocking the pane requires you to enter the root password. Presumably it stores this password internally until you lock the pane again.
     
Simon  (op)
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status: Offline
Reply With Quote
Mar 6, 2003, 04:26 AM
 
Thanks for the info guys.

I'll try it as soon as I get home to my Mac. If I'd try it through a remote ssh session I don't think I'd be very happy with the result...
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 05:52 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2