 |
 |
a CLI command to request a new lease from DHCP server
|
 |
|
 |
|
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status:
Offline
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Nov 2000
Location: in front of my Mac
Status:
Offline
|
|
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... 
|
|
•
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |