I have been following another thread and have configured my dhcpcd.conf file . When I restart my pi it gets another ip. Can someone please tell me what I am doing wrong?

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.

# Use the hardware address of the interface for the Client ID.
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.

# 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
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private

# Example static IP configuration:
#interface eth0
#static ip_address=
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=
#static domain_name_servers= fd51:42f8:caae:d92e::1

# It is possible to fall back to a static IP if DHCP fails:
# define static profile
profile static_eth0
static ip_address=
static routers=
static domain_name_servers=

# fallback to static profile on eth0
interface eth0
fallback static_eth0

interface eth0
        static ip_address=
        static routers=
        static domain_name_servers= 
    static domain search=MSHOME
    static domain name=MSHOME

What that does:

pi@raspberrypi:~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast
        inet6 fe80::22c8:501e:646f:5e79  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:ae:5b:33  txqueuelen 1000  (Ethernet)
        RX packets 5971  bytes 2468189 (2.3 MiB)
        RX errors 0  dropped 61  overruns 0  frame 0
        TX packets 5020  bytes 621187 (606.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet  netmask
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 281  bytes 23304 (22.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 281  bytes 23304 (22.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  • It appears to have done what you asked, even though you have duplicate interface entries – Milliways Aug 25 '19 at 22:48
  • Thank you for your response! I asked for and it gave me I am Puzzled – peeb Aug 25 '19 at 23:13
  • Ok I fixed the problem. It turns out that even if you change the ip properly It can still be taken over (assigned a different ip) by another device. I found the suspect device and disconnected it temporally. problem solved. Thanks for those who assisted. – peeb Sep 4 '19 at 1:44
# fallback to static profile on eth0
interface eth0
fallback static_eth0

Will tell dhcpcd to use DHCP and only assign the fallback if this fails

You have duplicated interface entries and it is always difficult to guess what programs will actually do when getting conflicting data.

See Fallback profile in How to set up networking/WiFi for more detail

| improve this answer | |
  • so if I understand correctly it tells the device to first use dhcp? – peeb Aug 26 '19 at 1:10
  • I have removed the duplicate entries and commented out the fallback lines but I still get 134 on ifconfig – peeb Aug 26 '19 at 1:22
  • 2
    @peeb DO NOT put detail in Comments (they are unreadable) EDIT your question instead. – Milliways Aug 26 '19 at 1:52

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.