NetworkManager tries to configure eth0 instead of eth0.1

Bug #1029273 reported by Michael
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
network-manager (Ubuntu)
Incomplete
Undecided
Unassigned

Bug Description

System Ubuntu 12.04 LTS (precise), network-manager 0.9.4.0-0ubuntu4.1

I have the following configuration in /etc/network/interfaces:

auto lo
iface lo inet loopback

# The primary network interface
#auto eth0
auto eth0.1

The nm-applet shows this connection as "ifupdown(eth0.1)" correctly, although this can of course not be edited.

However, when activating this connection, network-manager activates eth0 instead of eth0.1, which of course does not work. Here is the relevant syslog:

Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> Activation (eth0) starting connection 'Ifupdown (eth0.1)'
Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> (eth0): device state change: disconnected -> prepare (reason 'none') [30 40 0]
Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) scheduled...
Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) started...
Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) scheduled...
Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) complete.
Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) starting...
Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> (eth0): device state change: prepare -> config (reason 'none') [40 50 0]
Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) successful.
Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) scheduled.
Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) complete.
Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) started...
Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> (eth0): device state change: config -> ip-config (reason 'none') [50 70 0]
Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> Activation (eth0) Beginning DHCPv4 transaction (timeout in 45 seconds)
Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> dhclient started with pid 4487
Jul 26 08:11:48 LaptopMB NetworkManager[32517]: <info> Activation (eth0) Beginning IP6 addrconf.
[...]
Jul 26 08:11:50 LaptopMB NetworkManager[32517]: <info> Policy set 'Ifupdown (eth0.1)' (eth0) as default for IPv4 routing and DNS.
Jul 26 08:11:50 LaptopMB NetworkManager[32517]: <info> Activation (eth0) successful, device activated.
Jul 26 08:11:50 LaptopMB NetworkManager[32517]: <info> Activation (eth0) Stage 5 of 5 (IPv4 Commit) complete.

As you can see, it is really not activating eth0.1 as written in /etc/nbetwork/interfaces but eth0, although network manager 0.9.4 should have support for vlan configurations.

If I am doing something wrong, please tell me what and how it should be done instead.

Thank you very much.

Tags: vlan
Revision history for this message
Thomas Hood (jdthood) wrote :

@Michael: Please reboot, reproduce the bug, then run "apport-collect 1029273" to provide more information about the affected system.

summary: - Network manager doesn't read /etc/network/interfaces correctly
+ NetworkManager tries to configure eth0 instead of eth0.1
Revision history for this message
Thomas Hood (jdthood) wrote :

@Michael: Also, can you explain what you are trying to do? Is that eth0.1 interface a vlan interface to be created with vconfig(8)? If so, where is it defined?

Changed in network-manager (Ubuntu):
status: New → Incomplete
Revision history for this message
Michael (auslands-kv) wrote :

Hi Thomas

Thanks for your reply.

Sorry, can't reboot the laptop right now, will do that later. Just as an info, I have done many reboots while testing.

Yes, eth0.1 is a VLAN. It is defined in /etc/network/interfaces:

auto eth0.1
iface eth0.1 inet dhcp

I also tried another syntax:

auto vlan1
iface vlan1 inet dhcp
  vlan-raw-device eth0

Both declarations lead to the same result:
Using standard debian/ubuntu 'ifup / ifdown' commands such as:

ifup eth0.1

or

ifup vlan1

lead to the correct result. The system sets up the vlan device as well as the parent device eth0.

In nm-applet you see the above mentioned bahaviour, i.e. the config is shown as "ifupdown(eth0.1)", but network manager uses device eth0 instead of eth0.1

What do I want to achieve?
=====================

Actually, not very much from my point of view:
1. I want to use network manager (and nm-applet) to manage my networks. The system is a laptop and thus movable. So it encounters different network environments.
2. I have a network system at my office, where I have access to two VLANs (id 1 and id 5). I need to connect to VLAN1.
3. I need to have network manager being aware of this connection, because I need occasionally VPN connectivity. And this is only possible if nm has established the underlying ethernet connection.

I hope my explanation doesn't make it more complicated than it is :-) In the end, I just want to be able to connect to a VLAN via nm-applet.

Configuration of the vlan connection does not need to be done via nm-applet (I know that this is not yet implemented), but using network-manager with vlan should be possible for version 0.9.4.

If I am doing anything wrong here, I'd appreciate very much some hints how to do it correctly. Unfortunately, there is only very little information in the net about configuring vlan with network manager.

Revision history for this message
Thomas Hood (jdthood) wrote :

I don't have any experience using the vlan package or vconfig(8). I've just read some of the documentation. It's implemented as an extension to ifupdown, but that doesn't necessarily mean that it won't work when NM is managing interfaces defined in /e/n/i.

In the vlan way of doing and naming things, eth0.1 is a virtual Ethernet device "on" the (real) Ethernet device eth0. So I'd expect that you have to define eth0 so that it can be configured in the usual way and so that eth0.1 can be "created on" it. I'd also expect that eth0 has to be configured before eth0.1 is configured, but correct me if I'm wrong.

Revision history for this message
Michael (auslands-kv) wrote :

I don't know much about the working of vlans either. I simply use them :-)

Looking at the ifupdown mechanism it seems to work like this:

You just configure the vlan in /etc/network/interfaces like: iface eth0.1 inet dhcp

When you then enter 'ifup eth0.1', the system configures eth0 and then sets on top the virtual interface eth0.1 Afterwards it starts the dhclient on the virtual interface. So, the end configuration of an "ifup eth0.1" looks like this (sorry, from German system):

eth0 Link encap:Ethernet Hardware Adresse 00:1f:16:0d:7b:41
          inet6-Adresse: fe80::21f:16ff:fe0d:7b41/64 Gültigkeitsbereich:Verbindung
          UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metrik:1
          RX packets:1468333 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1453849 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:1000
          RX-Bytes:919300549 (919.3 MB) TX-Bytes:629072382 (629.0 MB)
          Interrupt:20 Speicher:f2700000-f2720000

eth0.1 Link encap:Ethernet Hardware Adresse 00:1f:16:0d:7b:41
          inet Adresse:172.17.2.103 Bcast:172.17.2.127 Maske:255.255.255.128
          inet6-Adresse: fe80::21f:16ff:fe0d:7b41/64 Gültigkeitsbereich:Verbindung
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1
          RX packets:292825 errors:0 dropped:0 overruns:0 frame:0
          TX packets:190175 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:0
          RX-Bytes:342938624 (342.9 MB) TX-Bytes:29941003 (29.9 MB)

So, the parent device eth0 is up but has no IP address. The virtual device eth0.1 has an IP address. Same applies to the routes:

Ziel Router Genmask Flags Metric Ref Use Iface
default pbx.home 0.0.0.0 UG 100 0 0 eth0.1
link-local * 255.255.0.0 U 1000 0 0 eth0.1

(not sure what the link-local is good for)

Network Manager on the other hand does not do anything with eth0.1. It just configures eth0 and start the dhclient on eth0, although it reads its configuration from the same /etc/network/interfaces file. So, either it doesn't know how to handle vlans at all or it does not read /etc/network/interfaces correctly. But 0.9.4 is said to have vlan support.

Would it be better to go upstream with this question? However, those guys there deal with a different configuration system from rhel. They might not understand the Ubuntu implementation...

Revision history for this message
Thomas Hood (jdthood) wrote :

> You just configure the vlan in /etc/network/interfaces like:
> iface eth0.1 inet dhcp
>
> When you then enter 'ifup eth0.1', the system configures eth0
> and then sets on top the virtual interface eth0.1
> Afterwards it starts the dhclient on the virtual interface.

It's /etc/network/if-pre-up.d/vlan that does all this. It takes 'eth0.1' and extracts 'eth0' as the raw device name.

   IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/\(eth[0-9][0-9]*\)\..*/\1/;s/\(bond[0-9][0-9]*\)\..*/\1/;s/\(wlan[0-9][0-9]*\)\..*/\1/;s/\(em[0-9][0-9]*\)\..*/\1/;s/\(p[0-9][0-9]*\(p[0-9][0-9]*\)\?\(_[0-9][0-9]*\)\?\)\..*/\1/"`

Then it ups eth0 and creates eth0.1.

    ip link set up dev $IF_VLAN_RAW_DEVICE
    vconfig add $IF_VLAN_RAW_DEVICE $VLANID

Then ifup runs dhclient for eth0.1.

This sort of trickery works with ifupdown but it doesn't surprise me that it confuses NetworkManager.

This person gives instructions for creating ethX.Y on the command line and then letting NM configure it:

    http://ubuntuforums.org/showthread.php?t=703387

Someone reported a similar issue at superuser.com:

    http://superuser.com/questions/287443/ubuntu-network-manager-and-vlan

And finally, an earlier Launchpad bug report, bug #353835, with which I've merged this report. :)

Revision history for this message
Thomas Hood (jdthood) wrote :

I wrote:
> It's /etc/network/if-pre-up.d/vlan that does all this.

I now add:

And NM doesn't run if-pre-up.d scripts, only if-up.d scripts. Justed checked (on my Ubuntu 12.04 system with upgraded n-m).

$ dpkg -l network-manager | grep ^ii
ii network-manager 0.9.6.0~git201207161259.00297f4-0ubuntu2 network management framework (daemon and userspace tools)

For background, see

   https://bugzilla.gnome.org/show_bug.cgi?id=600167

which has been marked as a duplicate of

    https://bugzilla.gnome.org/show_bug.cgi?id=387832

where there has been discussion of various options, but where most recently only support for a sort of pre-down hook is being contemplated.

Anyway, it's better if NM supports VLANs (more) "natively" and this is what bug #353835 is about.

Revision history for this message
Michael (auslands-kv) wrote :

Hmm, doesn't look like much trickery to me. It just extracts the raw device name and does the corresponding vonfig if the syntax eth0.x is being used. For the syntax "vlanX" it only does the vconfig. To my mind, that's exactly what needs to be done and network-manager should do the same. I wouldn't mind if it is necessary to use the "vlanX" notation.

The old posts, however, do not have must in common with the current problem, as at that time network manager did not have support for vlans. VLAN support was added with 0.9.4 in 2012, so pretty recently.

Concerning the patch message for the vlan support. Yes, but there is more evidence that network manager has vlan support. First the network manager main page and the release notes state so:

http://projects.gnome.org/NetworkManager/

Secondly the API description shows VLAN entries:

http://projects.gnome.org/NetworkManager/developers/api/09/ref-settings.html

The big question for me now is: If network manager has vlan support, how to use that? There are some examples in the net (although very difficult to find), but these all use for rhel, thus using rhel configuration files. :-(

Either that all is a parser function, so only the rhel configuration file parser can work with VLAN entries and not the ifupdown parser. But on the other hand, all documentation states that in the "keyfile" configuration files you can access all configuration items. I would not mind to configure the vlan in the keyfile manually once, if network manager can then manage the connection...

Revision history for this message
Michael (auslands-kv) wrote :

Hi Thomas

I had a brief look at the network manager source code that is in the Ubuntu repositories. While I am no developer, I do see that there are numerous references to VLAN in the code.

I also see that concerning the plugins only the rhel parser has vlan references, not the ifupdown.

My current take is thus that network manager does have VLAN support in Ubuntu (if it hasn't been disabled somewhere), but you cannot use the /etc/network/interfaces file for these. The "keyfiles" in /etc/NetworkManager/system-connections/, however, could well be usable, if someone finds out, how to configure a vlan there...

Revision history for this message
Thomas Hood (jdthood) wrote :

Please follow up at bug #353835.

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

Other bug subscribers

Remote bug watches

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