Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I know there is a simple command for this, but how do I tell my ubuntu server instance to request a new IP address from the DHCP server on eth0?

share|improve this question
    
+1 for being Heat Miser (w/ pic!), haha. –  nedm Jun 12 '09 at 5:30

4 Answers 4

up vote 14 down vote accepted

dhclient eth0

share|improve this answer
$ sudo dhclient -r

to release the current ip

$ sudo dhclient

to obtain a fresh lease

share|improve this answer
1  
the OP may wants to run this inside a screen and actually do a "sudo dhclient -r <interface> && sudo dhclient <interface>" otherwise connectivity may be lost and he needs to get on site to restore the network link. That is if there is no out of bands management installed. –  Server Horror Jun 12 '09 at 6:55
    
Interesting, why is doing the release, then obtain better than just the sudo dhclient eth0? Thanks! –  Heat Miser Jun 12 '09 at 18:05
1  
Just restarting dhclient will usually reassign the same IP address if the server doesn't object. If you release the address first, the server and client know to renegotiate a new one (although it could possibly be the same one you had). –  Martijn Heemels May 15 '10 at 19:37

Another issue I ran in to was that dhclient kept requesting the same IP from the DHCP server. Running the command dhclient -r did not resolve this. Therefore, after reading the man pages more thoroughly, I found that if I edited the file /var/lib/dhcp3/dhclient.leases to remove all lease references to the specific adaptor, in my case eth0. Then running sudo dhclient eth0 worked as expected and assigned me a new/different IP.

My situation was perhaps unique, but it required that my server pull an address from a higher range than was previously issued. The DHCP server was configured to do this, unless a specific IP address was requested regardless of the range. Since dhclient was specifically requesting the old IP address, based on the information in the dhclient.leases file, the DHCP server was always returning the same address.

share|improve this answer
    
Agree: situation I have had and just had to remind myself about again is the situation where you have a system which was getting a random IP address, but to which you assign a new (different) statically leased IP address, assigned by MAC. The issue is that if your DHCP client still has a valid lease in dhclient.leases, it does not actually ask the server for a new IP address: it just reuses the lease which it thinks is still valid. So dhclient -r effectively does nothing. Deleting leases file first, followed by dhclient -r, and all is well. –  liamf Sep 29 '11 at 23:28

When you run "sudo /etc/init.d/dhcp3-server restart" does it give something like:

Stopping DHCP server: dhcpd3. Starting DHCP server:dhcpd3.

If not, it's not running...

Then just be sure, check if your client sends out a request for a lease, take a look at your /var/logs/deamon.log file. There should be a bunch of DHCP requests in there. If not, the problem is with your client (and we will take it from there).

If your client is ok, just forget about firestarter for the moment and let's try to get it working without it. To make sure your DHCP server is up and running. Type "sudo /etc/init.d/dhcp3-server stop" and then "sudo /etc/init.d/dhcp3-server start". Then it should be running, assuming it's properly installed on your box.

I have included a copy of my dhcpd.conf file.

Finally, take a look at your server's /var/log/messages file if it gets the requests and replies to it with a valid lease. It also might give you an idea what's wrong with your configuration file (if there's something wrong with it ofcourse). If you can't make anything of this, post your messages file and I will take a look lateron.

goodluck

Rajat

share|improve this answer
    
He's talking about the DHCP client, not the server. –  mikl Jun 12 '09 at 7:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.