If your Ubuntu machine has networking configured but there’s nothing in: /etc/network/interfaces (maybe only loopback interface is configured there) and there’s no file in /etc/network/interfaces.d then maybe the network was configured via Ubuntu’s GUI (Network Manager).
In that case the config file is located in /etc/NetworkManager directory.
One way on some Ubuntu versions was to edit /etc/network/interfaces and add the the configuration of network interface. On Ubuntu 16.04 I’ve don the following setup:
# cat /etc/network/interfaces # interfaces(5) file used by ifup(8) and ifdown(8) # Include files from /etc/network/interfaces.d: source-directory /etc/network/interfaces.d
And then we create a file in /etc/network/interfaces.d called enp0s3:
# cat enp0s3 auto enp0s3 iface enp0s3 inet static address 10.0.0.211 broadcast 10.0.0.255 netmask 255.255.255.0 post-up route add default gw 10.0.0.1 pre-down route del default gw 10.0.0.1 dns-nameservers 10.0.0.1
Here is a Quick Guide to configure networking in OpenSUSE Linux using manual IPv4.
First let’s see where config files are located.
# ls /etc/sysconfig/network/ifcfg-* /etc/sysconfig/network/ifcfg-eth0 /etc/sysconfig/network/ifcfg-lo linux-t003:/home/ovi #
Edit /etc/sysconfig/network/ifcfg-eth0 file and add:
BOOTPROTO='static' BROADCAST='' ETHTOOL_OPTIONS='' IPADDR='10.0.1.31/24' MTU='' NAME='82540EM Gigabit Ethernet Controller' NETWORK='' REMOTE_IPADDR='' STARTMODE='auto'
Edit /etc/sysconfig/network/routes file and add:
default 10.0.1.1 - -
Edit /etc/resolv.conf and add:
Then we need to restart network service:
service network restart