Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to request a specific IP address from DHCP server?

This question also touches the topic of DHCP address reservation in a router.

Background: My home routers DHCP table only allows to create an IP address reservation of an assigned IP. It does not let me edit the table and manually assign the device an arbitrary IP for the next renew.

share|improve this question
    
Who knows an easy, free solution doing it from a Windows 7 machine? Couln't find any tools for such low level thing, might interfere with the Windows internal DHCP? (OTOH, I wouln't care to reboot afterwards) –  leo Oct 14 '12 at 15:03

1 Answer 1

using the linux program dhclient.

If you don't have linux installed, you can use a bootable Linux live CD.

[edit] If you do this trick to create an address reservation for an actual Windows machine, first switch the NIC in Windows to a static IP, because after a reboot in DHCP mode Windows may send a DHCP request with its last used IP, which would annihilate your efforts with dhclient below...

The trick is to send a DHCP request with your desired IP address from the same NIC (or better: same MAC address).

Edit the /etc/dhcp/dhclient.conf and add the following line (you might have to first copy the file to a writeable location if booting from a CD):

send dhcp-requested-address 192.168.1.240;

Then stop and start dhclient as user root, where your NIC is eth0 (check by issuing ip addr show beforehand)

dhclient -r -v
dhclient -4 -d -v -cf /etc/dhcp/dhclient.conf eth0

If successfull, your DHCP server will fulfill your prepared request. Sometimes you will have to delete the device entry in the DHCP table before issuing dhclient -4 -d ....

Then make that device IP address in the DHCP table of the router a fix address reservation. This will associate the IP to the MAC of the device and return the same IP everytime a DHCP request with that MAC address is encountered in the future.

share|improve this answer
1  
The -4 and -cf switches will generally be redundant. The -d switch will make the process stay in the foreground, which is probably undesirable. dhclient [-v] eth0 for the last step should be enough. –  Dologan Jun 10 at 20:34

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.