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
interface eth0 static ip_address=192.168.1.135/24 static routers=192.168.1.1 static domain_name_servers=220.127.116.11
This is what the manpages for
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 contents:
# Inform the DHCP server of our hostname for DDNS. hostname # Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361. duid # Persist interface configuration when dhcpcd exits. persistent # 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 noipv4ll interface eth0 static ip_address=192.168.1.135/24 static routers=192.168.1.1 static domain_name_servers=18.104.22.168
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!