No support for interface labels

Bug #1743200 reported by Maciej Dems
190
This bug affects 42 people
Affects Status Importance Assigned to Milestone
Netplan
Fix Released
Wishlist
Unassigned
nplan (Ubuntu)
Fix Released
Wishlist
Unassigned

Bug Description

In the old /etc/network/interfaces I could define a virtual interface:

    auto eth0
    iface eth0 inet static
        address aaa.aaa.aaa.aaa
        netmask 255.255.255.0
        gateway aaa.aaa.aaa.1

    auto eth0:0
    iface eth0:0 inet static
        address bbb.bbb.bbb.bbb
        netmask 255.255.255.0

This is not possible to achieve with the netplan. The only exisiting posibilities are either to create a VLAN, which may be not an option in some networks where you have no access to other hosts, or to define both addresses for one interface:

    network:
      version: 2
      renderer: networkd
      ethernets:
        eth0:
          addresses: [aaa.aaa.aaa.aaa/24, bbb.bbb.bbb/24]
          gateway4: aaa.aaa.aaa.1

This solution is not optimal either, because configuring iptables or some services may require specific interface name for a single network.

It should be possible to add the same physical interfaces with different networks and different alias names.

Changed in nplan (Ubuntu):
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Robert Sander (gurubert) wrote :

This is called an interface label, the iproute2 syntax is as follows:

ip address add bbb.bbb.bbb.bbb/24 dev eth0 label eth0:0

netplan should support this configuration.

Changed in nplan (Ubuntu):
status: Triaged → In Progress
Changed in nplan (Ubuntu):
status: In Progress → Triaged
summary: - No virtual interfaces
+ No support for interface labels
Revision history for this message
Jamie Murphy (itjamie) wrote :

Is there any plan to implement this?

Revision history for this message
sascha arthur (sarthur) wrote :

yes please also need it :((

Revision history for this message
Volker (skydiablo) wrote :

+1

Revision history for this message
Florian Faltermeier (florianfa) wrote :

+1

Revision history for this message
Alexey Zilber (alexeyzilber) wrote :

+1 Also, why is this a "Wishlist"? This is BASIC FUNCTIONALITY that has been in linux since the 1990's! This is a functional defect.

Maciej Dems (macdems)
description: updated
Revision history for this message
Jamie Murphy (itjamie) wrote :

+1. Its insane that a configuration option thats been around for years was skipped.

Revision history for this message
Peter Lambrechtsen (plambrechtsen) wrote :

+1 I have also stumbled onto this via various searches.

It seems on my host the secondary IP address does get added, but I can't see it anywhere via ifconfig.

cat /etc/netplan/01-default.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses:
        - 192.168.1.150/24
        - 192.168.2.150/24
      gateway4: 192.168.1.251
      nameservers:
        addresses: [192.168.1.254]

the ifconfig gives me

ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
        inet 192.168.1.150 netmask 255.255.255.0 broadcast 192.168.1.255
        RX packets 205 bytes 18287 (18.2 KB)
        RX errors 0 dropped 42 overruns 0 frame 0
        TX packets 81 bytes 11947 (11.9 KB)
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
        device interrupt 20

But doesn't list the second ip address, but "ip address" does.

ip address
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    inet 192.168.1.150/24 brd 192.168.1.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 192.168.2.150/24 brd 192.168.2.255 scope global eth0
       valid_lft forever preferred_lft forever

it would be ideal if it turned up as a secondary IP address ie eth0:0 or eth0:1 etc..

Revision history for this message
Eric stumbo (digikin) wrote :

+1

Revision history for this message
dimi (dimitrios) wrote :

+1
thought i learn netplan on my new server and use a second IP, project ended here

Revision history for this message
Federico Alves (h-sales) wrote :

I am affected by this bug.

tags: added: id-5e98792c0fbd366c03967e8d
Revision history for this message
Robert Sander (gurubert) wrote :

BTW: ifconfig is deprecated for at least 10 years now: https://lists.debian.org/debian-devel/2009/03/msg00780.html

Please start using "ip".

Lukas Märdian (slyon)
Changed in netplan:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Jamie Murphy (itjamie) wrote :

its not just ifconfig that uses interface labels. many programs use them for mapping which ip they bind to.

Revision history for this message
Lukas Märdian (slyon) wrote :

We have that as an item on the current netplan development backlog.

Revision history for this message
Lukas Märdian (slyon) wrote :

As a clarification on this topic:

We will be implementing ip address labels, as defined by iproute2's "ip address [...] label eth0:XXX" command (man ip-address). Not to be confused with ifconfig's legacy method of using aliased or virtual interfaces, which behave almost like a real interface.

The newer 'ip' utility does not use the legacy concept of alias interfaces. However, it supports assigning arbitrary names to the interfaces, called 'labels'. Both methods have in common that they allow to assign multiple IP addresses to an interface, which can be referenced by name.

Revision history for this message
Lukas Märdian (slyon) wrote :

Support for IP address labels has been merged upstream and will be part of the next netplan.io release: https://github.com/CanonicalLtd/netplan/pull/89

Revision history for this message
Lukas Märdian (slyon) wrote :

netplan 0.100 has now been released, including this feature.

Changed in netplan:
status: Triaged → Fix Released
Changed in nplan (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Bruno Criado (brunocriado) wrote :

How I can see the current version of netplan that I'm using since that `netplan info` doesn't bring version number and is it already available on Ubuntu 20.04.1 (server)?

Revision history for this message
Lukas Märdian (slyon) wrote :

Hi Bruno, you can call `dpkg -l | grep netplan` to see the installed version. Netplan 0.100 is available in Ubuntu Focal 20.04 LTS.

Revision history for this message
Jessica Litwin (bolognese) wrote :

Any chance of a backport to bionic?

Revision history for this message
Lukas Märdian (slyon) wrote :

Hi Jessica, there is currently no plan to backport Netplan >= 0.100 to Bionic. If you need this urgently, please open a new bug report explaining your rationale.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.