Why is systemd not configuring the VLANs' IPs correctly?

Christian Wolf

I am running an Archlinux machine and I want to get VLANs running. According to Archluinx Wiki I have tried to configure.

What I want to achieve: Network card enp4s0 gets 2 IPv4 addresses 192.168.0.249 and 192.168.5.5 both /24. Additionally I want to create a virtual controller vlan1 that is in VLAN with id=1 with the IPv4 192.168.4.5/24.

I have a running configuration without the VLAN thing in my productive system. I tried to add the other parts to the configuration like the following:

# In /etc/systemd/network/lan.network
[Match]
MACAddress=<MAC of the physical interface>

[Address]
Address=192.168.0.249/24
[Address]
Address=192.168.5.5/24

[Route]
Gateway=192.168.5.1

[Network]
VLAN=vlan1 # <--- This line is new
DNS=8.8.8.8

I added also two more files in /etc/systemd/network:

# vlan1.netdev
[NetDev]
Name=vlan1
Kind=vlan

[VLAN]
Id=1

and

# vlan1.network
[Match]
Name=vlan1

[Network]
DHCP=no

[Address]
Address=192.168.4.5/24

systemd-networking서비스를 다시 시작 (또는 재부팅)하면 vlan1인터페이스가 생성됩니다. 그러나 파일 vlan1.network은 완전히 무시되는 것 같습니다. 새 인터페이스는에서 복사 된 IP를 가져옵니다 enp4s0. 192.168.4.0/24네트워크는 모든 어댑터에 할당되지 않습니다. 따라서 잘못된 장치에 대한 경로가있는 동안에는 이러한 기계에 도달 할 수 없습니다.

다음은 출력입니다 ip addr.

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
    valid_lft forever preferred_lft forever
2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc htb state UP group default qlen 1000
    link/ether 40:8d:5c:4e:53:cb brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.249/24 brd 192.168.0.255 scope global enp4s0
    valid_lft forever preferred_lft forever
    inet 192.168.5.5/24 brd 192.168.5.255 scope global enp4s0
    valid_lft forever preferred_lft forever
    inet6 2a02:8070:c1a0:7000:428d:5cff:fe4e:53cb/64 scope global dynamic mngtmpaddr noprefixroute 
    valid_lft 413147sec preferred_lft 110747sec
    inet6 fe80::428d:5cff:fe4e:53cb/64 scope link 
    valid_lft forever preferred_lft forever
4: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc fq_codel state UNKNOWN group default qlen 100
    link/none 
    inet 10.1.22.1 peer 10.1.22.2/32 scope global tun0
    valid_lft forever preferred_lft forever
    inet6 fe80::106a:de17:dd6e:3f34/64 scope link stable-privacy 
    valid_lft forever preferred_lft forever
5: tun1: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc fq_codel state UNKNOWN group default qlen 100
    link/none 
    inet 10.1.21.1 peer 10.1.21.2/32 scope global tun1
    valid_lft forever preferred_lft forever
    inet6 fe80::7d1b:3f04:e82c:6a60/64 scope link stable-privacy 
    valid_lft forever preferred_lft forever
6: tun2: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc fq_codel state UNKNOWN group default qlen 100
    link/none 
    inet 10.1.20.1 peer 10.1.20.2/32 scope global tun2
    valid_lft forever preferred_lft forever
    inet6 fe80::33ad:9ca3:121a:4360/64 scope link stable-privacy 
    valid_lft forever preferred_lft forever
7: br-281bb5420586: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:fb:44:85:f8 brd ff:ff:ff:ff:ff:ff
    inet 172.19.0.1/16 brd 172.19.255.255 scope global br-281bb5420586
    valid_lft forever preferred_lft forever
    inet6 fe80::42:fbff:fe44:85f8/64 scope link 
    valid_lft forever preferred_lft forever
8: br-4b99362f92cc: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:46:95:82:a7 brd ff:ff:ff:ff:ff:ff
    inet 172.25.0.1/16 brd 172.25.255.255 scope global br-4b99362f92cc
    valid_lft forever preferred_lft forever
9: br-57b5f61b2f20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:64:eb:e6:4a brd ff:ff:ff:ff:ff:ff
    inet 172.20.0.1/16 brd 172.20.255.255 scope global br-57b5f61b2f20
    valid_lft forever preferred_lft forever
    inet6 fe80::42:64ff:feeb:e64a/64 scope link 
    valid_lft forever preferred_lft forever
10: br-8487e108bf3a: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:b2:2d:b1:cc brd ff:ff:ff:ff:ff:ff
    inet 172.18.0.1/16 brd 172.18.255.255 scope global br-8487e108bf3a
    valid_lft forever preferred_lft forever
    inet6 fe80::42:b2ff:fe2d:b1cc/64 scope link 
    valid_lft forever preferred_lft forever
11: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:55:c5:93:a9 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
    valid_lft forever preferred_lft forever
    inet6 fe80::42:55ff:fec5:93a9/64 scope link 
    valid_lft forever preferred_lft forever
13: vethf7a4cfe@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-281bb5420586 state UP group default 
    link/ether 7a:51:cf:e0:33:d3 brd ff:ff:ff:ff:ff:ff link-netnsid 1
    inet6 fe80::7851:cfff:fee0:33d3/64 scope link 
    valid_lft forever preferred_lft forever
15: vethe7356fb@if14: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default 
    link/ether 1a:98:38:e8:3e:b8 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet6 fe80::1898:38ff:fee8:3eb8/64 scope link 
    valid_lft forever preferred_lft forever
17: veth22fb0d5@if16: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-8487e108bf3a state UP group default 
    link/ether ca:ec:ab:6f:02:74 brd ff:ff:ff:ff:ff:ff link-netnsid 5
    inet6 fe80::c8ec:abff:fe6f:274/64 scope link 
    valid_lft forever preferred_lft forever
19: veth685a449@if18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-281bb5420586 state UP group default 
    link/ether ee:10:fa:61:78:a8 brd ff:ff:ff:ff:ff:ff link-netnsid 4
    inet6 fe80::ec10:faff:fe61:78a8/64 scope link 
    valid_lft forever preferred_lft forever
21: veth1000b45@if20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-57b5f61b2f20 state UP group default 
    link/ether ee:b4:13:46:79:c2 brd ff:ff:ff:ff:ff:ff link-netnsid 2
    inet6 fe80::ecb4:13ff:fe46:79c2/64 scope link 
    valid_lft forever preferred_lft forever
23: vethffd57b1@if22: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-8487e108bf3a state UP group default 
    link/ether 5a:a3:01:3f:85:1a brd ff:ff:ff:ff:ff:ff link-netnsid 3
    inet6 fe80::58a3:1ff:fe3f:851a/64 scope link 
    valid_lft forever preferred_lft forever
25: veth8051ebf@if24: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-281bb5420586 state UP group default 
    link/ether 86:17:70:25:44:d3 brd ff:ff:ff:ff:ff:ff link-netnsid 6
    inet6 fe80::8417:70ff:fe25:44d3/64 scope link 
    valid_lft forever preferred_lft forever
27: vethe305af6@if26: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-57b5f61b2f20 state UP group default 
    link/ether 7e:a9:d3:b5:31:14 brd ff:ff:ff:ff:ff:ff link-netnsid 7
    inet6 fe80::7ca9:d3ff:feb5:3114/64 scope link 
    valid_lft forever preferred_lft forever
29: veth7c4a3b4@if28: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-281bb5420586 state UP group default 
    link/ether 32:b2:a0:f3:8d:ad brd ff:ff:ff:ff:ff:ff link-netnsid 8
    inet6 fe80::30b2:a0ff:fef3:8dad/64 scope link 
    valid_lft forever preferred_lft forever
30: vlan1@enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 40:8d:5c:4e:53:cb brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.249/24 brd 192.168.0.255 scope global vlan1
    valid_lft forever preferred_lft forever
    inet 192.168.5.5/24 brd 192.168.5.255 scope global vlan1
    valid_lft forever preferred_lft forever
    inet6 fe80::428d:5cff:fe4e:53cb/64 scope link 
    valid_lft forever preferred_lft forever

당신은이 참조 vlan1부착 잘못된 IP를 가지고있다. 이 명령 ip route은이를 추가로 확인합니다.

default via 192.168.5.1 dev enp4s0 proto static 
default via 192.168.5.1 dev vlan1 proto static 
10.1.1.0/24 via 10.1.21.2 dev tun1 
10.1.20.0/24 via 10.1.20.2 dev tun2 
10.1.20.2 dev tun2 proto kernel scope link src 10.1.20.1 
10.1.21.0/24 via 10.1.21.2 dev tun1 
10.1.21.2 dev tun1 proto kernel scope link src 10.1.21.1 
10.1.22.0/24 via 10.1.22.2 dev tun0 
10.1.22.2 dev tun0 proto kernel scope link src 10.1.22.1 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 
172.18.0.0/16 dev br-8487e108bf3a proto kernel scope link src 172.18.0.1 
172.19.0.0/16 dev br-281bb5420586 proto kernel scope link src 172.19.0.1 
172.20.0.0/16 dev br-57b5f61b2f20 proto kernel scope link src 172.20.0.1 
172.25.0.0/16 dev br-4b99362f92cc proto kernel scope link src 172.25.0.1 linkdown 
192.168.0.0/24 dev enp4s0 proto kernel scope link src 192.168.0.249 
192.168.0.0/24 dev vlan1 proto kernel scope link src 192.168.0.249 
192.168.5.0/24 dev enp4s0 proto kernel scope link src 192.168.5.5 
192.168.5.0/24 dev vlan1 proto kernel scope link src 192.168.5.5 
192.168.6.0/24 via 10.1.21.2 dev tun1 

프로덕션 머신을 엉망으로 만드는 것을 피하기 위해 소규모 가상 환경에서 시도해 보았지만 동작은 완벽하게 유용합니다. vlan인터페이스는 파일에 구성된 IP 가져 옵니다 *.network. 원래 경로는 복사 되지 않습니다 (기껏해야 끔찍해 보입니다).

In the logs of systemd-networkd.service the following lines appear after the restart:

Feb 26 17:54:31 server-hh systemd[1]: Starting Network Service...
Feb 26 17:54:31 server-hh systemd-networkd[21461]: veth7c4a3b4: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: vethe305af6: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: veth8051ebf: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: vethffd57b1: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: veth1000b45: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: veth685a449: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: veth22fb0d5: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: vethe7356fb: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: vethf7a4cfe: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: docker0: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: br-8487e108bf3a: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: br-57b5f61b2f20: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: br-281bb5420586: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: tun2: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: tun1: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: tun0: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: enp4s0: Gained IPv6LL
Feb 26 17:54:31 server-hh systemd-networkd[21461]: Enumeration completed
Feb 26 17:54:31 server-hh systemd[1]: Started Network Service.
Feb 26 17:54:31 server-hh systemd-networkd[21461]: vlan1: netdev ready
Feb 26 17:54:31 server-hh systemd-networkd[21461]: vlan1: Gained carrier
Feb 26 17:54:31 server-hh systemd-networkd[21461]: vlan1: Could not bring up interface: Invalid argument
Feb 26 17:54:32 server-hh systemd-networkd[21461]: enp4s0: Configured
Feb 26 17:54:33 server-hh systemd-networkd[21461]: vlan1: Gained IPv6LL
Feb 26 17:54:45 server-hh systemd-networkd[21461]: vlan1: Configured
Feb 26 17:58:43 server-hh systemd-networkd[21461]: vlan1: Lost carrier

The error in the logs are 1:1 in the logs of the test system as well. This seems to be a bug regarding the logging output as far as I understood.

Maybe I am simply silly or overdue but I do not get the reason why this happens only in the production server and not in the test server. Do you have any suggestions where I can look further in order to get into this problem?

yuwata

You should not use MACAddress= in [Match] section if the .network file contains VLAN=.

For details, see comments in https://github.com/systemd/systemd/issues/11921.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Why do end device need to support VLANS?

분류에서Dev

Set routing metrics for static IPs with systemd-networkd?

분류에서Dev

Configuring routing with systemd-networkd via a gateway results in error: Could not set route: Network is unreachable

분류에서Dev

Why are unicode characters not rendering correctly

분류에서Dev

Configuring routing with systemd-networkd and a non-network-address destination results in an error: Could not set route: Invalid argument

분류에서Dev

Why is my calculation total not updating correctly in Acrobat?

분류에서Dev

Why Python doesnt append correctly from cursor

분류에서Dev

Why is the Pay rent Method Not working Correctly?

분류에서Dev

Why is my computer not running VIrtualBox correctly?

분류에서Dev

Confused why systemd service doesn't start at boot

분류에서Dev

When to tag physical ports on private VLANs?

분류에서Dev

Configuring Mame

분류에서Dev

Configuring OpenVPN

분류에서Dev

Why isn't my inner loop working correctly?

분류에서Dev

why this way return an instance of my object correctly, but this way does not

분류에서Dev

Why doesn't Chrome 37 on OS X display this HTML correctly?

분류에서Dev

Why decode using base64 not working correctly in C#

분류에서Dev

Why is my js only working correctly when the page is refreshed?

분류에서Dev

Why is this code not working correctly? Won't take the elif statements

분류에서Dev

RedHat의 IPS pkgrecv

분류에서Dev

Configuring PhpRedis in Laravel 7

분류에서Dev

Configuring Message Listener Container

분류에서Dev

Configuring two internet connections

분류에서Dev

Configuring priority in rabbitmq

분류에서Dev

Configuring jmxAgent in Camel

분류에서Dev

Configuring zlib for compiling and installation

분류에서Dev

Configuring secondary core in OpenOCD

분류에서Dev

Problems configuring OpenVPN Server

분류에서Dev

Configuring websvn Ubuntu

Related 관련 기사

  1. 1

    Why do end device need to support VLANS?

  2. 2

    Set routing metrics for static IPs with systemd-networkd?

  3. 3

    Configuring routing with systemd-networkd via a gateway results in error: Could not set route: Network is unreachable

  4. 4

    Why are unicode characters not rendering correctly

  5. 5

    Configuring routing with systemd-networkd and a non-network-address destination results in an error: Could not set route: Invalid argument

  6. 6

    Why is my calculation total not updating correctly in Acrobat?

  7. 7

    Why Python doesnt append correctly from cursor

  8. 8

    Why is the Pay rent Method Not working Correctly?

  9. 9

    Why is my computer not running VIrtualBox correctly?

  10. 10

    Confused why systemd service doesn't start at boot

  11. 11

    When to tag physical ports on private VLANs?

  12. 12

    Configuring Mame

  13. 13

    Configuring OpenVPN

  14. 14

    Why isn't my inner loop working correctly?

  15. 15

    why this way return an instance of my object correctly, but this way does not

  16. 16

    Why doesn't Chrome 37 on OS X display this HTML correctly?

  17. 17

    Why decode using base64 not working correctly in C#

  18. 18

    Why is my js only working correctly when the page is refreshed?

  19. 19

    Why is this code not working correctly? Won't take the elif statements

  20. 20

    RedHat의 IPS pkgrecv

  21. 21

    Configuring PhpRedis in Laravel 7

  22. 22

    Configuring Message Listener Container

  23. 23

    Configuring two internet connections

  24. 24

    Configuring priority in rabbitmq

  25. 25

    Configuring jmxAgent in Camel

  26. 26

    Configuring zlib for compiling and installation

  27. 27

    Configuring secondary core in OpenOCD

  28. 28

    Problems configuring OpenVPN Server

  29. 29

    Configuring websvn Ubuntu

뜨겁다태그

보관