I have a setup where my system is in the regular home network connected to the router. The router assigns the IP to my device without issues.

I would like to use the same IP every time for my device. Either set it as static or as preferred. This is a fully controlled environment so there should be no problem getting the preferred IP from the DHCP.

Update: I can not change anything on the DHCP server side, I need to come to a solution from the client side. The server is ICS and can not be configured.


My question is, is this possible via dhcpcd? Can I use a static IP with dhcpcd at all? Or even preferred? I can not avoid the use of dhcpcd because of some unrelated requirements.

Done so far

What I have tried so far is to add these lines to the /etc/dhcpcd.conf file:

interface eth0
        static ip_address=
        static routers=
        static domain_name_servers=

This is what the manpages for dhcpcd.conf say:

static value

         Configures a static value.  If you set ip_address then dhcpcd
         will not attempt to obtain a lease and just use the value for the
         address with an infinite lease time.

         Here is an example which configures a static address, routes and
               interface eth0
               static ip_address=
               static routers=
               static domain_name_servers=

But the problem is that even when I do it like this, I only get to see my device using that IP for a short while, after which it seems to be lost and replaced with another IP most probably assigned via DHCP (it is next in the pool i guess).

Here is my complete dhcpcd.conf file contents:

# Inform the DHCP server of our hostname for DDNS.

# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.

# Persist interface configuration when dhcpcd exits.

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# A hook script is provided to lookup the hostname if not set by the DHCP
# server, but it should not be run by default.
nohook lookup-hostname

interface eth0
        static ip_address=
        static routers=
        static domain_name_servers=

Do I need to add some more options to let DHCP know that I don't need a new IP address or something? Or did I completely misunderstand the topic at hand?

I tried searching for more detailed help online, but either there is not much info on this subject, or more probably, I don't know enough about the topic to perform a valid search.

Any help is appreciated!

migrated from serverfault.com Jun 5 '14 at 16:51

This question came from our site for system and network administrators.

  • 1
    You assign reserved IP addresses in the DHCP server, not the client. – Michael Hampton Jun 5 '14 at 16:51
  • 1
    Hmm, i guess. The problem is that I can not change anything on the DHCP server. What can be done from the client side? (The server is a ICS DHCP server which I can not edit) I updated my question with this info.. – bosnjak Jun 5 '14 at 17:03
  • You contact the person who does run the server. – Michael Hampton Jun 5 '14 at 17:10
  • Lets just assume that I can not do anything on the server. The point is, is there anything that can be done on the client to achieve this? – bosnjak Jun 5 '14 at 17:36
  • No. There is not. Asking the same thing over and over will not get you a different answer. – Michael Hampton Jun 5 '14 at 17:38

you need to do MAC reservation, like this:

host vnbandk3920.dsdk12.schoollocal {
   hardware ethernet 00:c0:ee:7d:bc:80;
  • This must be done on the server side? I forgot to mention that I don't have the possibility to change anything on DHCP server side, because it is an ICS DHCP. Ill update that to my question. – bosnjak Jun 5 '14 at 17:00
  • This is the way you do it in ISC DHCP. Though, you are still going to have to get the person who runs the server to do it for you. – Michael Hampton Jun 5 '14 at 17:11
  • Its not an ISC server, rather the ICS (internet connection sharing) setup. Its the most basic fixed setup so I can't change anything on the server side. – bosnjak Jun 5 '14 at 17:15

If you are using dhcpcd (the client daemon, most people here are confusing it with DHCP and DHCPd which is different), then add the following text on the bottom of /etc/dhcpcd.conf

interface eth0
static ip_address=
static routers=
static domain_name_servers=

Of course remember to replace the IP info with your network details.


Are you trying to use as a static address one which falls inside the router's address pool? If so, there is no telling what your router will do. Check the router address pools from the GUI, and pick an address outside the pool.

You may check whether you still experience such phenomena simply by stopping network manager (I presume you use one), giving yourself an address,

  ip link set dev eth0 down
  ip addr flush dev eth0
  ip addr add 192.168.1.whatever/24 dev eth0
  ip link set dev eth0 up
  ip route add default via

without using dhcpcd. This has the advantage of isolating the problem: if it happens again, then it's your router's fault, otherwise it was an incorrect choice of static IP address.

  • Even when I use the IP outside of the pool, the behaviour is strange - i get that IP for some time, but then I just dissapear from the LAN altogether.. I will try the manual way and report back. – bosnjak Jun 5 '14 at 17:38
  • @Lawrence I forgot one command in the manual sequence, please take a look at the revised version. – MariusMatutiae Jun 5 '14 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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