I have an Ubuntu 16.04 system with two interfaces – eth0 configured with DHCP and eth1 configured with static ip addresses.
The /etc/network/interfaces file has the following config
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
# The Secondary network interface
auto eth1
iface eth1 inet static
address 10.10.1.10
netmask 255.255.255.0
dns-nameservers 74.82.42.42 4.2.2.2
## Virtual Interfaces for virtual hosts
auto eth1:11
iface eth1:11 inet static
address 10.10.1.11
netmask 255.255.255.0
auto eth1:12
iface eth1:12 inet static
address 10.10.1.12
netmask 255.255.255.0
auto eth1:13
iface eth1:13 inet static
address 10.10.1.13
netmask 255.255.255.0
The issue is, when DHCP server is not available on eth0 link or if the eth0 link is down, the system hangs for 5 mins, significantly slowing down the boot process.
violet@ubuntu-xenial:~$ systemd-analyze blame
5min 241ms networking.service
1.529s nmbd.service
1.524s winbind.service
I tried reducing the time in /etc/systemd/system/network-online.target.wants/networking.service file which makes the system boot faster without waiting for the network service, however, that fails to load the virtual interfaces on eth1.
Is there a cleaner way to let the system boot without full network configuration on eth0 interface and still load all the static network configuration on eth1?
Best Answer
It seems someone was paranoid about a client not getting it's DHCP in time.
Edit this file
/etc/dhcp/dhclient.conf
and settimeout
to a reasonable value, likeThe default value of 300 seconds is way too high. The suggested replacement value of 15 was tested and works fine.