Ubuntu: Problems with static IP config via interfaces file



Question:

I'd like to setup a static IP on Kubuntu 17.10 for my desktop PC.

ifconfig  enp10s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500      inet 192.168.100.32  netmask 255.255.255.0  broadcast 192.168.100.255      inet6 fe80::71e0:527e:96cd:4128  prefixlen 64  scopeid 0x20<link>      ether 70:85:c2:41:08:d0  txqueuelen 1000  (Ethernet)      RX packets 12849  bytes 4063036 (4.0 MB)      RX errors 0  dropped 0  overruns 0  frame 0      TX packets 10032  bytes 1116381 (1.1 MB)      TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536      inet 127.0.0.1  netmask 255.0.0.0      inet6 ::1  prefixlen 128  scopeid 0x10<host>      loop  txqueuelen 1000  (Lokale Schleife)      RX packets 854  bytes 69858 (69.8 KB)      RX errors 0  dropped 0  overruns 0  frame 0      TX packets 854  bytes 69858 (69.8 KB)      TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0  

Working interfaces:

auto lo  iface lo inet loopback  

Not working interfaces:

auto lo  iface lo inet loopback    auto enp10s0  iface enp10s0 inet static  address 192.168.100.99  netmask 255.255.255.0  gateway 192.168.100.1  

After a sudo service network-manager restart my connection isn't connected. If I delete the enp10s0 entry (revert back to the working interfaces) and restart the network-manager, the network/internet is working again.

It's a fairly standard setup and not my first time changing something in the interfaces but I can't see my mistake here. Anybody?


Solution:1

Ubuntu is using the Netplan configuration abstraction from version 17.10.

So instead of /etc/network/interfaces we now use /etc/netplan/*.yaml

The config for my single interface with static IP:

# Let NetworkManager manage all devices on this system  network:    version: 2    #renderer: NetworkManager    renderer: networkd    ethernets:      enp10s0:        dhcp4: no        dhcp6: no        addresses: [192.168.100.99/24]        gateway4: 192.168.100.1        nameservers:          addresses: [8.8.8.8,8.8.4.4]  

sudo netplan generate generates the configuration for the network render.

Note: I tried sudo netplan --debug generate and kept on running into a message:

DEBUG: NetworkManager: definition enp10s0 is not for us (backend 1)

But still, a restart assigned the correct IP and everything seems to be working smoothly.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »