Ubuntu – Ubuntu server – ethernet disabled and no eth0 in interfaces file

ethernetinternetnetworkingserver

I have installed Ubuntu Server on an old desktop, and I'm new to this. I had set it up and was trying to connect through Putty but that was not working. When I tried ifconfig there was no eth0 IP address, and logging onto the router showed the only device connected by ethernet is the printer. However, the ethernet cable is plugged into the server and is showing the green light by it.

I tried opening /etc/networking/interfaces but this shows the following:

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

I tried adding 'auto eth0' after this and saving but made no difference, and have tried sudo ifconfig eth0 up which didn't do anything either.

sudo lshw -C network says that the network is DISABLED.

Any ideas to help get this up and running?

EDIT:
Running command lspci -knn | grep Eth -A3 results in the following:

02:05.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL-8110SC/8169SC Gigabit Ethernet [10ec:8167] (rev 10)
         Subsytem: Gigabyte Technology Co., Ltd GA-MA69G-S3H Motherboard [1458:e000]
         Kernel driver in use: r8169
         Kernel modules: r8169

Best Answer

When you ran ifconfig, was your ethernet interface eth0 or was it something different like enp0s25 or some such?

Whatever it was, amend your file /etc/network/interfaces to read something like:

auto lo
iface lo inet loopback

auto enp0s25
iface enp0s25 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1 8.8.8.8

Be sure to select a static address outside the range used by the DHCP server in the router, switch or other access point. Of course, substitute your details here. If you expect to ssh and ftp into the server, you need to know where it is. Do so with a static IP address:

Get the system to read and use the changes:

sudo ifdown enp0s25 && sudo ifup -v enp0s25

Did you connect?

ping -c3 192.168.1.1
ping -c3 www.ubuntu.com