Fix (delete) secondary dhcp address when setting static ip address.

After setting a static ip address in a debian based os, there is often a secondary ip address visible with ip addr show.
This is caused by the dhcpcd service which keeps running after setting a static ip.
Stopping this service will remove the secondary ip address after a reboot or network restart.

update-rc.d dhcpcd disable
service dhcpcd stop
#and optionally the next line or a reboot
ip addr del %YOURS-SECOND-IP% dev ethX

Replace %YOURS-SECOND-IP% with the unwanted secondary ip address.
And replace ethx with the interface name.
Restart the network.
Or just reboot and the secondary ip will be gone.

Works on a Volumio based Raspberry Pi and Ubuntu Server 18.04.2 LTS.

Set static IP with /etc/network/interfaces

Edit /etc/network/interfaces als volgt:

auto lo eth0
iface lo inet loopback
iface eth0 inet static
        address xxx.xxx.xxx.xxx (enter your ip here)
        netmask xxx.xxx.xxx.xxx (on lan usually 255.255.255.0)         
        gateway xxx.xxx.xxx.xxx (enter gateway ip here)

Opslaan en dan dns instellen:

sudo nano /etc/resolv.conf
nameserver 8.8.8.8 
nameserver 8.8.4.4

Dit zijn de gratis Google dns servers, vervang de ip adressen met je de dns servers van je keuze.

Schakel nu eerst nog de dhcpd service uit om niet via een eventueel secundair ip adres toegankelijk te zijn.
Dan rebooten of:

sudo /etc/init.d/networking restart