We have a windows server with DHCP and 2 Linux machines with Ubuntu 16
if we set /etc/network/interfaces like this:
# The loopback network interface
auto lo eth0
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.18
netmask 255.255.255.0
allow-hotplug eth0
iface eth0 inet dhcp
Then all works fine. So in short, first the machine sets static IP then it uses DHCP and it gets that ip 192.168.1.18
And if we delete those two last lines:
allow-hotplug eth0
iface eth0 inet dhcp
There is no internet at all on the machine. Can anyone explain this please?
"Can anyone explain this please?" Yes, your interfaces file is seriously deficient. You have not specified a gateway nor the very important DNS nameservers.
I suggest that you amend the file to:
Please be certain that the specified static IP address is outside the DHCP range in the router to avoid collisions.
Restart the interface:
Confirm that you are connected: