Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 64370  / 2 Years ago, sat, september 10, 2022, 6:17:12

What is the correct way of configuring virtual LAN interfaces (hopefully without messing up Network Manager) on Ubuntu 12.04 Desktop?



Simply adding the interface to /etc/network/interfaces seems to cause Network Manager some confusion:



auto vlan500
iface vlan500 inet static
...
...
vlan_raw_device eth1


Is there a better way of doing it?



update:



I updated /etc/NetworkManager/NetworkManager.conf with a no-auto-default clause, and set managed=false in the [ifupdown] section:



[main]
plugins=ifupdown,keyfile
dns=dnsmasq

no-auto-default=6C:FD:12:34:56:78,

[ifupdown]
managed=false


This keeps NetworkManager from firing up eth0, and makes it stay away from eth1 and it's VLAN interfaces. Previously it would only let a single VLAN interface be up, and it would put the static IP of that VLAN interface directly on the eth1 physical interface.



Still, there is a 2 minute delay during boot as (I presume) NetworkManager is trying to work out the network configuration.



Solution:



Solved by creating keyfiles as described in my answer below. My desktop now boots with all VLAN interfaces up and running, and without any delays during boot.


More From » 12.04

 Answers
7

Turns out there is no VLAN support in the ifupdown plugin that lets Network Manager work with /etc/network/interfaces, so instead we will have to manually add a keyfile for Network Manager.



First generate an UUID for the VLAN interface



root@kayna:~# uuidgen -r
5985c23f-2f9b-4e09-a33e-97505c79c78f


Then create the keyfile, here is an example for vlan id 200 on physical interface eth1



root@kayna:~# vi /etc/NetworkManager/system-connections/vlan200

[connection]
id=vlan200
type=vlan
uuid=5985c23f-2f9b-4e09-a33e-97505c79c78f

[vlan]
parent=eth1
id=200

[ipv6]
method=ignore

[ipv4]
method=auto


The interface will not show up in the GUI, but can be seen and managed with nmcli



root@kayna:~# nmcli dev
DEVICE TYPE STATE
eth1.200 vlan connected
eth0 802-3-ethernet disconnected
eth1 802-3-ethernet connected


Stop and start the interface with



root@kayna:~# nmcli con down id vlan200

root@kayna:~# nmcli con up id vlan200

Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/12
state: activated
Connection activated


The interface is created using the eth1.200 format, not the vlan200 format typically used in /etc/network/interfaces



root@kayna:~# ifconfig eth1.200
eth1.200 Link encap:Ethernet HWaddr c8:60:00:00:00:56
inet addr:192.168.1.46 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:185 errors:0 dropped:0 overruns:0 frame:0
TX packets:55 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:29811 (29.8 KB) TX bytes:9549 (9.5 KB)

[#35001] Sunday, September 11, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ameatoes

Total Points: 321
Total Questions: 106
Total Answers: 112

Location: Belarus
Member since Sat, Jul 18, 2020
4 Years ago
;