My Ubuntu server will not accept my static IP assignment. Instead, I keep getting a DHCP lease. Network Manager is not installed. Below is the output of cat /etc/network/interfaces
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.128
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.120 192.168.1.125
dns-domain mynetwork.local
dns-search mynetwork.local
Questions:
-
Why doesn't Ubuntu accept the static IP assignment? The Interfaces file seems to be ignored.
-
What is allowing a DHCP lease to be assigned?
Best Answer
The package ifupdown and so
/etc/network/interfaces
are no longer used. Ubuntu 17.10 Server uses the package netplan instead, which configures systemd-networkd.Make sure you use the default content for the config file
/etc/network/interfaces
And create this netplan config file for a static IPV4 address (works for me):
/etc/netplan/01-netcfg.yaml
.Make sure you use the correct network interface name ("
ens3
" in this example).Make sure you use the correct DNS servers (nameservers->addresses) for your network environment.
Once this file has been created, run the following commands as root to test & activate the configuration: