dhcpcd-discuss

Setting static IP with dhcpcd

Lorrin

Thu Jun 05 16:38:54 2014

Hello everyone.

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.

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.

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

interface eth0
        static ip_address=192.168.1.135/24
        static routers=192.168.1.1
        static domain_name_servers=8.8.8.8

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//
//             dns.//
//                   interface eth0//
//                   static ip_address=192.168.0.10/24//
//                   static routers=192.168.0.1//
//                   static domain_name_servers=192.168.0.1/


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: http://pastie.org/9261495

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!

Regards!



Follow-Ups:
Re: Setting static IP with dhcpcdRoy Marples
Archive administrator: postmaster@marples.name