Category Archives: Server

Missing Interfaces in

2000px-Former_Ubuntu_logo.svg

Have you have ever been in a situation (typically in a virtualised environment) where you have added another network adapter & it didn’t seem to appear in Ubuntu? In the following example, I added a second interface, however it didn’t just simply appear. The following is this issue was resolved.

~$ ifconfig
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.115.199 netmask 255.255.255.0 broadcast 192.168.115.255
inet6 fe80::250:56ff:fe9c:a2df prefixlen 64 scopeid 0x20<link>
ether 00:50:56:9c:a2:df txqueuelen 1000 (Ethernet)
RX packets 2846 bytes 359600 (359.6 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 159 bytes 18009 (18.0 KB)
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 (Local Loopback)
RX packets 358 bytes 26926 (26.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 358 bytes 26926 (26.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

As you can see in the ‘ifconfig’ output, there is no additional ethernet interface. So lets use the command ‘ip link’

~$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:50:56:9c:a2:df brd ff:ff:ff:ff:ff:ff
3: ens192: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 00:50:56:9c:56:c4 brd ff:ff:ff:ff:ff:ff

You can see that there is in fact an additional interface, however it hasn’t been configured yet. So lets use nano to edit the interfaces file and add it.

~$ sudo nano /etc/network/interfaces

 

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens160
iface ens160 inet static
address xxx.xxx.xxx.xxx
netmask 255.255.255.0
network xxx.xxx.xxx.xxx
broadcast xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx
auto ens192
iface ens192 inet dhcp

We add the additional information underlined in this example, exit & save, then we need to restart the network service

~$ sudo systemctl restart networking

Be warned, if you are logged into the server via SSH, your connection will drop, as you’re restarting the whole networking service. Run the ‘ifconfig’ command again to verify that you have your new interface.

~$ ifconfig
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.115.199 netmask 255.255.255.0 broadcast 192.168.115.255
inet6 fe80::250:56ff:fe9c:a2df prefixlen 64 scopeid 0x20<link>
ether 00:50:56:9c:a2:df txqueuelen 1000 (Ethernet)
RX packets 622 bytes 74509 (74.5 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 79 bytes 10801 (10.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

ens192: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::250:56ff:fe9c:56c4 prefixlen 64 scopeid 0x20<link>
ether 00:50:56:9c:56:c4 txqueuelen 1000 (Ethernet)
RX packets 25 bytes 4043 (4.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 19 bytes 2897 (2.8 KB)
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 (Local Loopback)
RX packets 367 bytes 27739 (27.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 367 bytes 27739 (27.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

As we can see by the output, we now have the new interface.

 

Advertisements