Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

The IT guy gave me an IP address outside of the DHCP dynamic pool range (I do not have a DHCP reservation). I'd like to set linux client's IP staticly, but still have it pull the DNS servers and domain name from DHCP.

Searches have only turned up hundreds of "DHCP VS STATIC IP!!!111" results, or people trying somehow to "protect" their network using DHCP.

I'm sure this can be done, I'm just not sure how to go about it. I should be able to do a DHCPINFORM then use the returned settings with my static IP. I see option dhcp-message-type in man dhcp-options, but I'm not sure where that goes. So (1) how do I get dhclient to use that option and (2) how do I hook this into the ifup scripts? (I'm going to have to do this on both an Ubuntu and a CentOS machine)

share|improve this question

closed as off topic by Sven, Skyhawk, EEAA, Khaled, Ward Apr 21 '12 at 8:55

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Why didn't you ask the admin for a reservation, instead of a static address? – Zoredache Apr 20 '12 at 23:42
See this related question.…. Setup, a reservation, set a fixed address in your client config in case the server is unavailable. – Zoredache Apr 20 '12 at 23:48
You have answered your own question by mentioning that what you really need is a reservation. "It is vain to do with more what can be done with less." – Skyhawk Apr 21 '12 at 0:01
This is a "how do I", not a "what should I do" question. You're all right, a reservation would be better, however I'd still like to know how to do this. – Code Bling Apr 21 '12 at 16:19
Could someone please explain why this is off topic? I don't see how a question about network infrastructure is off topic. Do I seriously need to rephrase the question as "how do I set up WPADP on my network?" – Code Bling Apr 21 '12 at 16:27

If you have a static IP, you usually configure all the things you get from DHCP manually. This includes DNS and other entries. Your administrator can give you the appropriate values. This is the preferred configuration for servers and other systems which need to work even if DHCP is down.

Alternately, your administrator can configure DHCP to provide your static IP address as a reservation. This will provide you the fixed address whenever you plug into that network, but allow you to obtain a different IP address when you plug into other networks. This works well for portable systems which need a static address. On many networks, your IP address will be essentially static unless you off the network for a long period of time even without a reservation.

As you are running Linux you can configure your static IP address in addition to the IP address provided by DCHP. Many DHCP clients allow this to be configured. On Debian (Ubuntu) based systems you can configure the IP address using a post-up statement to the DHCP setup in /etc/network/interfaces. A stanza like this:

auto eth0
iface eth0 inet dhcp
     post-up addr add dev eth0
share|improve this answer
So in the 3rd case my NIC would have 2 IPs. So I'd have all the static settings plus everything from DHCP..That could work. Thanks! – Code Bling Apr 21 '12 at 16:34

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