3

I am trying to setup the following using systemd networkd on debian 9:

  • Interface eth0 ip address from DHCP server
  • Interface vlan5 on eth0 vlan id 5 with static ip address: 172.16.0.1

This is the configuration:

/etc/systemd/network/20-wired.network

[Match]
Name=eth0

[Network]
DHCP=ipv4
VLAN=vlan5

/etc/systemd/network/vlan5.netdev

[NetDev]
Name=vlan5
Kind=vlan

[VLAN]
Id=5

/etc/systemd/network/vlan5.network

[Match]
Name=vlan5

[Network]
DHCP=no
Address=172.16.0.1/24

When I execute ip addr show:

4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 78:a5:04:f1:12:46 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.31/24 brd 192.168.1.255 scope global dynamic eth0
       valid_lft 2854sec preferred_lft 2854sec
    inet 192.168.1.85/24 brd 192.168.1.255 scope global secondary eth0
       valid_lft forever preferred_lft forever
    inet6 2a02:a03f:8584:e200:7aa5:4ff:fef1:1246/64 scope global deprecated mngtmpaddr noprefixroute dynamic
       valid_lft 56463sec preferred_lft 0sec
    inet6 fe80::7aa5:4ff:fef1:1246/64 scope link
       valid_lft forever preferred_lft forever
5: vlan5@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 78:a5:04:f1:12:46 brd ff:ff:ff:ff:ff:ff
    inet 172.16.0.1/24 brd 172.16.0.255 scope global vlan5
       valid_lft forever preferred_lft forever
    inet 169.254.243.53/16 brd 169.254.255.255 scope global vlan5
       valid_lft forever preferred_lft forever
    inet6 fe80::7aa5:4ff:fef1:1246/64 scope link
       valid_lft forever preferred_lft forever

Which confirms that eth0 got an ip address from our dhcp, for whatever reason he even has 2 ip addresses: 192.168.1.31 and 192.168.1.85 but atleast it works.

Vlan5 also has 2 ip addresses: 172.16.0.1/24 and 169.254.243.53/16. If I connect a host on this vlan with ip 172.16.0.15, I cannot access 172.16.0.1.

If I connect a host with ip 169.254.243.55, I can access the host through 169.254.243.53, so it seems that the vlan atleast works.

But I cannot figure out why this 169.254.243.53 address is added to the vlan5 interface and why I can't access 172.16.0.1. Any ideas?

1 Answer 1

1

Naturally I don't know your exact setup, but I think two things are going on here. My setup is similar to yours in that I have a native (untagged) VLAN with subnet 192.168.1.0/24 and VLAN20 running on the same interface with subnet 192.168.2.0/24.

Firstly the 169.254.243.53 address is an automatically-assigned link local address. I've disabled this on mine with LinkLocalAddressing=no as below:

# cat eth0.network 
[Match]
Name=eth0

[Link]
RequiredForOnline=yes

[Network]
Address=192.168.1.14/24
Gateway=192.168.1.1
DHCP=no
DNS=192.168.1.7
NTP=192.168.1.7
LLDP=yes
EmitLLDP=yes
LinkLocalAddressing=no
VLAN=vlan20

I'm not using DHCP on this device to configure the interface, so I have to configure things like DNS, NTP and the default gateway, which brings me to the second thing: what does your routing table look like, i.e. the output of ip route, on both devices?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .