Is there a way to renew a DHCP address on your Linux desktop?
Novell Cool Solutions: Trench
By Joe Harmon
Reader Rating
from 9 ratings
|
Digg This -
Slashdot This
Posted: 19 Sep 2005 |
Applies To:
- Novell Linux Desktop 9
- SUSE Linux 10.0
Renew an IP address one time
Note: In this example we will be using the interface eth0. The interface must be configured for DHCP as up and running.
- Open a terminal and su - to root.
- Type ifconfig to show the current IP address that you received from DHCP.
- Type dhcpcd -k to send the appropriate signals to dhcpcd.
- Now bring the interface back up by typing ifup eth0.
- Type ifconfig to show the new IP address.
Renew an IP address every time
- Edit the file called dhcp as root. It can be found in the /etc/sysconfig/network directory.
- Find the parameter labeled DHCLIENT_RELEASE_BEFORE_QUIT="no" and change the no to yes so that it then reads DHCLIENT_RELEASE_BEFORE_QUIT="yes".
- Take the eth0 interface down and then back up again by typing ifdown eth0 and ifup eth0 within a terminal.
- Type ifconfig to show the new IP address. It should change every time that the interface is brought down and back up again.
Reader Comments
- What about ifdown-dhcp eth0 and ifup-dhcp eth0 ?
- If you get "**** dhcpcd: not running" when typing dhcpcd -k (aparently because the dhcp server was down here a while ago) just do the ifdown eth0 ifup eth0 to start it up again. Then it worked like a charm.
- It is not quite correct what you say here. With "ifdown eth0" and "ifup eth0" you will get a new address via DHCP. Every time you restart an interface which requires an address via DHCP, it will send a new request, so you'll get a new address. You don't need the "dhcpcd -k". And the parameter "DHCLIENT_RELEASE_BEFORE_QUIT" is not necessary. It only tells the DHCP-client to send a "RELEASE" message to the server when the interface is deactivated. So you will probably get a new address, not the one you used before. But that does not help if you e.g. changed the locations and simply want a new address from the new network.
- It's easier to remember 'ifdown eth0' than to remember 'dhcpd -k' since you need to type 'ifup eth0' also.
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com
