Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using a computer on a network I have no control over (at work) that uses DHCP to assign me an IP Address. Each time I reboot the network assigns me a new IP address (which is annoying as I am using the IP on a second machine for tools such as synergy).

Is there a simple way for me to set up the Linux machine so I can reserve the address I am using (for say 3 days) so I can turn my machine off for the weekend or evening without losing my IP and having to reconfigure services on the second machine?

share|improve this question
With a proper DHCP setup, you'll usually have a DNS setup that reflects the current DHCP leases. Maybe you can just use your hostname instead of the IP? – Oliver Salzburg Jun 18 '12 at 10:58
Just have your network admin give you a static ip address. – Ramhound Jun 18 '12 at 11:07
Usually LANs with DHCP accept a static IP in the configured range w/o problems. Just set your actual IP as static and you should be good to go. If you experience problems set the last digit of the IP on a high range (eg x.x.x.240-253) – Bruno9779 Jun 18 '12 at 11:52
@Bruno9779 if he doesn't have full access to the machine he may not be able to set a static IP address. This is what I would suggest though! – qroberts Jun 18 '12 at 11:57
Ask nicely for a DHCP reservation. – Stephanie Jun 18 '12 at 13:06

Pretty much the only thing a host can do with DHCP is release it's lease, in essence, give the IP back. The host can't really tell the server to do much more than that.

From your question it sounds like you have no control of the network, but full control of both computers, and are working with two Linux machines.

If @Oliver Salzburg's, @Ramhound's, or @Bruno9779's suggestions don't help, if you are using dhclient, there is a script directory (/etc/dhcp3/dhclient-exit-hooks or similar IIRC) where you can put a script of your own. Such a script executes every time dhclient is called, which is every time your system is asking for a new IP among other events. This would be the key to automating reconfiguration on the other system.

With properly setup ssh keys you can execute a remote command on the second system. This could be used by the script called by dhclient to run an ifconfig command or similar.

share|improve this answer
Technically, the DHCP client can ask the server to provide a specified address, but chances the server will grant the request are pretty slim or you probably wouldn't have this problem to begin with. – Marcks Thomas Jun 18 '12 at 15:03

Your Answer


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.