1

I setup a new Ubuntu 18.04 server and spend some time fighting with netplan. I only need a very simple network config, but for some reason it does not work and I have no idea what is wrong.

I need a VLAN with a static IP.

The problem: As soon as I configure any static IP (either on the physical interface or the VLAN) I loose any connection.

This is my current (not working) yaml (it is the only yaml, so there is no other config interfering)

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0: #the physical interface
    match:
      macaddress: "xx:xx:xx"
    dhcp4: no

    #this is the same IP I would get with dhcp
    addresses: [ "10.1.0.1/24" ]
    gateway4: 10.1.0.254
vlans:
  lab1:
    id: 10
    link: eth0
    dhcp4: no
    addresses: [ "10.1.10.100/24" ]

After applying the config I got following IF<->IP:
eth0 <-> 10.1.0.1
lab1 <-> 10.1.0.1

And I was unable to connect to the server via ssh or ping it at this IP.

Configuration after running netplan generate:

10-netplan-eth0.network

[Match]
MACAddress=xx:xx:xx

[Network]
Address=10.1.0.1/24
Gateway=10.1.0.254
VLAN=lab1

10-netplan-lab1.network

[Match]
Name=lab1

[Network]
Address=10.1.10.100/24

10-netplan-lab1.netdev

[NetDev]
Name=lab1
Kind=vlan

[VLAN]
Id=10

If I change both to dhcp4: yes and remove the addresses/gateway, I get the same addresses as statically configured above from DHCP and ssh/ping work for the VLAN address.

If I change eth0 to dhcp4: yes and leave the static config for lab1, lab1 gets a DHCP assigned address.

Why is the static address for lab1 ignored?

Note: I was assured the switching/routing is correctly configured, but I am willing to check this again.

  • Could you run netplan generate and add the resulting configuration to your question? It will probably be in /run/systemd/network/. – Kenny Rasschaert Aug 13 '18 at 11:29
  • @KennyRasschaert Just added the configuration – user9113868 Aug 13 '18 at 11:51
  • Is cloud-init interfering with your configuration ? Do you have a /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg or at least a /etc/cloud directory ? – Ludovic Kuty Mar 13 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.