LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Question: Request a specific IP address from a DHCP server? (https://www.linuxquestions.org/questions/linux-software-2/question-request-a-specific-ip-address-from-a-dhcp-server-483227/)

haertig 09-13-2006 04:41 PM

Question: Request a specific IP address from a DHCP server?
 
Is there a way (even a kludge) to request a specific IP address from a DHCP server? (assuming the desired IP address is currently free and available)

I'm running Debian Sarge using dhclient from the dhcp-client package (version 2.0pl5-19.1sarge2)

There is not any "release" option (-r) on my dhclient although this option is documented on some sites when you run a Google search on "dhclient release". I was thinking if I could somehow force a release of my current IP, hack my /var/run/dhcpclient.leases file with my desired IP address, then ifdown/ifup might do the trick.

If anyone is wondering why in the world I would want to do this, it's because at work my IP address has been very stable historically, even though it's DHCP. To ssh into my home server I have it setup (at home, in my authorized_keys2 file) that I must use pubkey authentication from a specific IP address. In retrospect, this might be a tad too tight given my once stable work IP address is now changing on me. I will loosen up that specific IP address requirement when I get home so this doesn't happen to me again.

My old IP address, the one currently configured at home in authorized_keys2, appears to be unused here at work as best I can tell (Why didn't the work DHCP server reassign me my old address at lease renewal? Maybe it was rebooted and lost it's memory.) Anyway, I was speculating on how I might regain my old IP address. Hacking my leases file and running ipdown/ifup doesn't work. I'm sure the work DHCP server has my MAC address tied into the IP address that it's reassigning to me over and over.

p.s. - I do have a second public key that can access my home server from any incoming IP address. That's only stored on a thumbdrive. Which happens to be, ahem, sitting on my desk at home and not in my pocket at the moment!

farslayer 09-13-2006 05:25 PM

Do you manage the DHCP server at work ?

If so you can reserve a specific IP on the DHCP server that is related to the MAC address of the workstation requesting the lease..

any time the DHCP server sees a request for an address from your MAC address it will alwayts assign the same IP

haertig 09-13-2006 05:32 PM

Quote:

Originally Posted by farslayer
Do you manage the DHCP server at work ?

No I don't.


All times are GMT -5. The time now is 03:29 AM.