1

I'm using Ubuntu 18.04. I added a new NIC (network interface card) to the box and I disabled the old one in BIOS. This is obviously required to amend a configuration. I just simply swapped eth0 with the new enp2s0 in the netplan config. All looked good and all services have worked.

After some time, I wanted to add a vlan configuration to the netplan yaml file, but it was not so simple as in the examples found over forums and netplan.io. The configuration showed the new vlan and IP, but I spotted that the main interface has 2 IP addresses: a static one as per netplan and secondary one via dhcp.

2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 74:da:38:d8:db:41 brd ff:ff:ff:ff:ff:ff
inet 192.168.6.6/24 brd 192.168.6.255 scope global enp2s0
   valid_lft forever preferred_lft forever
inet 192.168.6.56/24 brd 192.168.6.255 scope global secondary enp2s0
   valid_lft forever preferred_lft forever
inet6 fe80::76da:38ff:fed8:db41/64 scope link
   valid_lft forever preferred_lft forever

ip route 

    default via 192.168.6.1 dev enp2s0 src 192.168.6.56 metric 202
    192.168.6.0/24 dev enp2s0 proto kernel scope link src 192.168.6.56 metric 202

I started digging: removed vlan config, removed cloud-init from the system (I don't need this).

Below is my netplan config:

network:
    ethernets:
        enp2s0:
            addresses: [192.168.6.6/24]
            gateway4: 192.168.6.1
            nameservers:
              addresses: [192.168.16.253, 8.8.8.8, 1.1.1.1]
            dhcp4: false
    version: 2
    renderer: networkd
#    vlans:
#        vlan.15:
#            id: 15
#            link: enp2s0
#            addresses: [192.168.15.99/24]

How to get rid of the DCHP assigned address?

Where can I find the config responsible for that part of a system?

I thought that cloud-init did it, but, even after removing it, nothing has changed in the network subsystem behaviour.

  • why do you believe this IP address has been assigned via dhcp? DHCP addresses should have the 'dynamic' flag set; your ip addr output only shows 'secondary'. – slangasek Sep 8 at 19:04
  • I can see this in the DHCP Leases list on a firewall. As you can see there is no secondary address in my netplan file. Why it is assigned? What should I check? – Adam An Sep 9 at 9:18
  • ok I don't know what is assigning that address but the behavior does not look consistent either with netplan or with networkd's dhcp client. I'd suggest that you look at the process list on your system for any unexpected other dhcp clients that are not part of the base Ubuntu configuration. – slangasek Sep 10 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.