Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VLAN network interface not configured correctly #11921

Closed
christianlupus opened this issue Mar 7, 2019 · 4 comments · Fixed by #11930
Closed

VLAN network interface not configured correctly #11921

christianlupus opened this issue Mar 7, 2019 · 4 comments · Fixed by #11930

Comments

@christianlupus
Copy link

systemd version the issue has been seen with

241.7-2

Used distribution

Archlinux

Expected behaviour you didn't see
I have a network interface (enp4s0) that is configured to have two IPs (192.168.1.249/24 and 192.168.5.5/24). I want to add a virtual ethernet device vlan1 on the same physical card to use VLAN 1 with its own IP (192.168.4.5/24).

Unexpected behaviour you saw
Both enp4s0 and vlan1 get created but both get the same IP range (namely 192.168.0.249/24 and 192.168.5.5/24). Thus, the 192.168.4.0/24 subnet (in VLAN 1) is not reachable. Additionally, the IPs are now present in the wrong vlan which might cause other effects.

See also my superuser question with more details on the IPs and the setup as well as some logs.

Steps to reproduce the problem
Start with a running configuration with only enp4s0 and its IPs successfully set up. According to man systemd-netdev create a file /etc/systemd/network/vlan1.netdev with the content

[NetDev]
Name=vlan1
Kind=vlan

[VLAN]
Id=1

and a /etc/systemd/network/vlan1.network with

[Match]
Name=vlan1

[Network]
DHCP=no

[Address]
Address=192.168.4.5/24

Futher register the vlan in the main configuration of enp4s0 by adding (or merging)

[Network]
VLAN=enp4s0.1

Rebooting/restarting of the network service brings up the device but with the wrong IPs attached.

Workaround
For now I found a workaround for this problem but I think there is still a problem. Either the documentation is misleading or a bug is present:
If you name the device enp4s0.1 (name of basis interface and vlan ID) instead of vlan1 it works. I do not know if this is due to another mechanism in the kernel or whatever. However adding the device manually (using ip commands) everything can be set up correctly.

@poettering poettering added bug 🐛 Programming errors, that need preferential fixing network labels Mar 7, 2019
@yuwata
Copy link
Member

yuwata commented Mar 8, 2019

Could you show .network file for enp4s0? Sorry, you have already provided detailed information at the linked forum...

@yuwata yuwata removed the bug 🐛 Programming errors, that need preferential fixing label Mar 8, 2019
yuwata added a commit to yuwata/systemd that referenced this issue Mar 8, 2019
@yuwata
Copy link
Member

yuwata commented Mar 8, 2019

Ah, you use MACAddress= for assigning .network file for interfaces. Since vlan1 and enp4s0 have the same mac address, so lan.network is also used for the vlan device, instead of vlan1.network. You can confirm that by networkctl status vlan1 then you can find that Network File: entry is different from you expected.

@yuwata
Copy link
Member

yuwata commented Mar 8, 2019

#11930 should shows something like the following:

test_vlan (__main__.NetworkdNetDevTests) ... 
14: test1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 2004 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether 4e:e3:82:f4:1a:96 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 0 
    dummy addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
15: vlan99@test1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 2000 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 4e:e3:82:f4:1a:96 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535 
    vlan protocol 802.1Q id 99 <REORDER_HDR,GVRP,MVRP,LOOSE_BINDING> addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
14: test1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 2004 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 192.168.24.5/24 brd 192.168.24.255 scope global test1
       valid_lft forever preferred_lft forever
    inet 192.168.25.5/24 brd 192.168.25.255 scope global test1
       valid_lft forever preferred_lft forever
15: vlan99@test1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 2000 qdisc noqueue state UP group default qlen 1000
    inet 192.168.23.5/24 brd 192.168.23.255 scope global vlan99
       valid_lft forever preferred_lft forever
ok

And you can see that test1 and vlan99 interfaces have the same mac address.

@christianlupus
Copy link
Author

Yes, you are right, the vlan1 interface picked the configuration file from the main ethernet device lan.network. I will have to work this out now to get it running as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants