Ubuntu 18.04 - Interface has static IP but picks up DHCP as well

ch33zw1z

Lifer
Nov 4, 2004
39,471
20,154
146
I have laptop w/ a USB NIC that I'm struggling a bit with configuration on. I won't go into the gory long-winded details, but here's my basic problem
*this doesn't happen with the onboard NIC. Both NIC's were present during install, and configured at install. The USB NIC did NOT have it's cable attached tho.

- Netplan config assigns a static IP to this interface. Somehow, it's picking up a DHCP address as well
- Both IP's on the interface ping
- If I run the cmd "sudo netplan apply", the dhcp assigned address disappears...but the interface stops working on either IP

"ip a" for the interface before netplan apply
Code:
3: enx001060315e39: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:10:60:31:5e:39 brd ff:ff:ff:ff:ff:ff
    inet 10.0.86.32/24 brd 10.0.86.255 scope global enx001060315e39
       valid_lft forever preferred_lft forever
    inet 10.0.86.11/24 brd 10.0.86.255 scope global secondary enx001060315e39
       valid_lft forever preferred_lft forever
    inet6 fe80::264b:d430:1bc5:a7b8/64 scope link
       valid_lft forever preferred_lft forever

After netplan apply
Code:
3: enx001060315e39: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:10:60:31:5e:39 brd ff:ff:ff:ff:ff:ff
    inet 10.0.86.32/24 brd 10.0.86.255 scope global enx001060315e39
       valid_lft forever preferred_lft forever
    inet6 fe80::264b:d430:1bc5:a7b8/64 scope link
       valid_lft forever preferred_lft forever

This problem has persisted across two different laptops and reloads. I'm not sure where the dhcp configuration is coming from. I've dug through netplan configurations in /etc /run and /lib directories. I'm even trying to figure out how to disable dhclient altogether.

I also posted a thread at ubuntu forums, but no replies yet.

 
Last edited:

mv2devnull

Golden Member
Apr 13, 2010
1,526
160
106
https://netplan.io/ claims that netplan merely configures a "renderer". How do they see the config?

Is it possible that a renderer has one interface configured by netplan, but adds another automatically on hotplug event?
 

ch33zw1z

Lifer
Nov 4, 2004
39,471
20,154
146
https://netplan.io/ claims that netplan merely configures a "renderer". How do they see the config?

Is it possible that a renderer has one interface configured by netplan, but adds another automatically on hotplug event?

I've been wondering if the USB NIC is treated differently under the covers. I don't hot plug it, just stays put.

My next step is to reload with the cable attached to both interfaces and see what happens
 

ch33zw1z

Lifer
Nov 4, 2004
39,471
20,154
146
I reinstalled with the onboard nic and usb nic installed. it seemed to go ok, I performed multiple reboots, never pulled a dhcp address. So I added a second usb nic because that's my end goal, and I reinstalled again. it seemed to be fine, until i tried to install pihole. It picked the wrong IP based on the nic I chose so I canceled and rebooted. After that, the interfaces go a dhcp address on top of the static address again.

now I've reloaded ubuntu again, and will not be installing pihole on the laptop with usb nic for the time being. I want to see if the problem comes back without pihole in the mix even once.

I have another pihole server running in a kvm ubuntu on centos and another in a hyper-v ubuntu. those can just run the dns load for now. neither has more than one interface, and neither has had the same problem yet.
 
Last edited:

mv2devnull

Golden Member
Apr 13, 2010
1,526
160
106
i tried to install pihole. It picked the wrong IP based on the nic I chose so I canceled and rebooted. After that, the interfaces go a dhcp address on top of the static address again.
Sounds like the installation of pihole changes the network configuration. Why and how? Do they document that "feature"?
 

ch33zw1z

Lifer
Nov 4, 2004
39,471
20,154
146
Sounds like the installation of pihole changes the network configuration. Why and how? Do they document that "feature"?

I agree. pihole installs dhcpd5. I have dug around but nothing specific about that, or about leaving it our during install. with multiple interfaces installed, pihole seems to get confused between them during the install as well. I tell it to pick the onboard nic, and it will populate the IP field of the server with a different IP from one of the USB interfaces.

I've reinstalled with only the onboard nic installed, and it's going fine.

I'm getting together a old pc with 3 nics (hopefully) to see if i can recreate the problem on a different machine with no usb nics
 

BarkingGhostar

Diamond Member
Nov 20, 2009
8,410
1,617
136
Can I assume the static IP is being manually set on the interface that it is also getting a DHCP? If so, it sounds like the issuing DHCP server might be configured to reserve an IP for said interface and doesn't look/care if you have already set that interface static manually.
 

ch33zw1z

Lifer
Nov 4, 2004
39,471
20,154
146
Can I assume the static IP is being manually set on the interface that it is also getting a DHCP? If so, it sounds like the issuing DHCP server might be configured to reserve an IP for said interface and doesn't look/care if you have already set that interface static manually.

It's was a very weird that didn't present itself until I installed pihole, which includes a DHCP server. The problem seemed to be when there were multiple interfaces, and installing pihole, some interfaces would get both the static IP, and one from pihole dhcp. I didn't have any DHCP reservations for these MAC's in my DHCP servers.

Also, pihole would easily get confused during the install with which interface was which.

In the end, I just have one interface for each of the two pihole servers, and firewall rules for my isolated VLAN's to talk to pihole IP's. No ports to the outside world for piholes, and it's working just fine.
 
Last edited: