1

I want to assign multiple IP4 addresses to a USB->Ethernet adapter in an Ubuntu 18.04 LTS system. I have removed netplan, since I find the yaml-based configuration even more obscure than the traditional way of configuring the network.

Since I want the extra addresses to be permanent, I put them into /etc/network/interfaces, as described here as "Legacy method".

Adding extra IP4 addresses to a "fixed" ethernet interface works, but the same doesn't work with the USB-to-Ethernet dongle. I'm puzzled as to what the difference is.

EDIT: I was asked to share my interfaces file. Here it is:

auto lo
iface lo inet loopback

auto eno1
iface eno1 inet static
      address 192.168.2.6
      netmask 255.255.255.0
      broadcast 192.168.2.255
      offload-gro off
      offload-gso off
      offload-tso off

auto enx000ec6fe56fb
iface enx000ec6fe56fb inet static
      address 192.168.31.6
      netmask 255.255.255.0
      broadcast 192.168.31.255
      gateway 192.168.31.1
      offload-gro off
      offload-gso off
      offload-tso off

auto enx000ec6fe56fb:0
iface enx000ec6fe56fb:0 inet static
      address 192.168.31.4
      netmask 255.255.255.0

auto eno1:0
iface eno1:0 inet static
      address 192.168.2.4
      netmask 255.255.255.0

As you can see, I introduce a virtual IP interface for each of the real interfaces. eno1 is a plain Ethernet interface on the mainboard, while enx000ec6fe56fb is a USB-to-Ethernet dongle. The virtual interface for eno1 works, the other doesn't.

  • 1
    Care to share your interfaces file? – roaima Dec 1 '18 at 22:45
  • 1
    As said, post the interfaces file. Also, is network-manager still installed and active? Finally, it may come down to when network is started vs. when the USB driver is loaded. Can you do a basic config for the first address in for the USB dongle in the interfaces file? – ivanivan Dec 2 '18 at 3:01
  • @ivanivan: network-manager isn't installed, but your comment about the time when the driver gets loaded sounds interesting. My USB device is plugged in permanently, so is there a chance for its driver to be loaded too late? How do I check, i.e. which messages in dmesg should I watch out for? – sh- Dec 3 '18 at 7:15
1

Because ifupdown is deprecated since the Ubuntu 17.10 release (the /etc/network/interfaces file is used by ifupdown), you should reinstall netplan on your system and remove the ifupdown package. There is how to configure a multiple IP address for a network interface using the following example from the official website :Multiple addresses on an interface.

sudo nano /etc/netplan/your-config-file.yaml :

network:
  version: 2
  renderer:  NetworkManager
  ethernets:
    enp3s0:
     addresses:
       - 10.100.1.38/24
       - 10.100.1.39/24
     gateway4: 10.100.1.1

Test and apply the new configuration:

sudo netplan generate
sudo netplan try
sudo netplan apply

See: MigratingToNetplan

Deprecate ifupdown in Ubuntu for the 17.10 release.

  • This was the first time I was exposed to netplan, and I have to say my experience was wholly negative. I am in the process of setting up a new server to replace a very old and tired one that was also running Ubuntu. I had administered the old server with webmin and wanted to do the same with the new one. Only after having installed webmin and used it for a while, I noticed that webmin was deprecated with Ubuntu 18.04. I first tried to manually configure/repair netplan, but it took me a long time to figure out an indentation error I made in the config file, so I decided to kick it out. – sh- Dec 3 '18 at 7:19
  • I have to say I would have expected the netplan implementors to come up with a way of protecting themselves from software that still used the old way of configuring the network. A comment in /etc/network/interfaces doesn't do, because it is often software that modifies the file, not humans. Also, yaml is harder to get right, and the error messages are cryptic, at least to me. I consider netplan in its present state as deficient. For me, it made things harder rather than easier. The whole thing is now more cryptic than before. – sh- Dec 3 '18 at 7:27
  • 1
    After having learned that the newest version of webmin (1.900) now supports netplan, I have reinstalled netplan. I needed to manually edit its configuration, this time with success, i.e. the additional IP addresses now work with the Ethernet->USB dongle. I just should have waited for the new webmin, it seems. Thanks to everybody who helped. – sh- Dec 6 '18 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.