Unmanaged networking

I would like to manage network manually on rpi3 but failed at achieving this.

I have first uninstalled network-manager and edited /etc/network/interfaces file:

auto lo
iface lo inet loopback

auto enxb827ebc30a82
iface enxb827ebc30a82 net dhcp

Then I edited the /etc/dhcp/dhclient.conf file:

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;

timeout 30;

lease {
interface "enxb827ebc30a82";
fixed-address 192.168.0.56;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option domain-name-servers 127.0.0.1;
renew 2 2050/1/12 00:00:01;
rebind 2 2050/1/12 00:00:01;
expire 2 2050/1/12 00:00:01;
}

However after reboot the ifconfig shows no ip address for the ethernet interface.... Doing sudo service networking restart works but as this targets to be a embedded system without human interface I need to know what is going wrong with my setup.

Any help will be appreciate

Regards

UPDATE:

Going further with this problem, I discover that the problem comes from the fact that lease is stored into /var/lib/dhcp/dhclient/enxXXXX.leases. How to avoid that mechanism? If I remove the content of this file and restart the platform all works as expected (i.e. the platform ask for dhcp lease for 30 seconds and then take a static IP then. If the DHCP offers an address before the timeout this also works until the next reboot (since the lease file contains an entry…

I am also seeing this issue: https://bugs.launchpad.net/ubuntu/+source/isc-dhcp/+bug/1551351

I thought you just wanted static ip on the pi3. Why do you need a lease? (maybe I do not understand the issue … ). For static, the /etc/network/interfaces file would be:

auto yourinterface
iface yourinterface inet static
  address 192.168.0.56
  gateway 192.168.0.1 
  netmask 255.255.255.0

Hello Pavlos,

The fact is that the system can be installed in an unknown environment, sometimes there’s a dhcp sometimes not, sometime we have access to the dhcp configuration, sometimes not, that is why I need to stop dhcp request and takes a static IP. More than that I would like to setup two IP on the same interface one with dhcp request that becomes a static IP if there’s no dhcp and a second one that is always static to perform some admin tasks.

I finally discover that the resolvconf was in charge of keeping dhcp lease. See /etc/dhcp/dhclient-enter-hooks.d/resolvconf

This seems to store the lease in var/lib/dhcp/dhclient/enxXXX.leases. Removing resolvconf by installing virtual packet open-resolve do the trick. The lease is not store anymore and dhclient works as expected. I don’t know if this is a correct way to achieve this and this had not remove wanted feature but it was a pain to find. And I see this as a regression in networking management of ubuntu. Last time I used ubuntu environment was ten years ago and this was a lot simpler to do all of this manually to understand how it works…

I’ve marked the post as answered a little bit too early, indeed, this works properly when no dhcp offer a lease but as soon as a dhcp gives an address, the lease file is filling in with lease informations and then if I restart with no dhcp server, the dhclient will ask to use the latest given IP address… this does not work as I would expect