[ALUG] Changing a static IP (Rasbian Stretch)

Mark Rogers mark at more-solutions.co.uk
Tue Sep 12 16:46:10 BST 2017


Note: I have "net.ifnames=0" in /boot/cmdline.txt so that I get the
old interface names (eth0 etc) back.

I've always worked with /etc/network/interfaces in the past, but
Googling suggests the correct way to set a static IP is now to edit
/etc/dhcpcd.conf and append:
    interface eth0
    static ip_address=192.168.0.28/24
    static routers=192.168.0.1
    static domain_name_servers=192.168.0.5

If I restart dhcpcd or networking:
    sudo service networking restart

.. then the new IP address gets added, but the old IP address gets
retained until reboot. (Regardless of whether the old IP came from
DHCP or was a previous static.)

What am I doing wrong?

Note: If there's a better way to set a static IP then I'm happy to
look at that instead.

-- 
Mark Rogers // More Solutions Ltd (Peterborough Office) // 0844 251 1450
Registered in England (0456 0902) 21 Drakes Mews, Milton Keynes, MK8 0ER



More information about the main mailing list