Score:0

Netplan: Trunk vlans with individual gateways

br flag

Ubuntu 21.10 (Linux 5.13.0-1016-raspi aarch64)

On my router, I have 3 vlans, each with their own subnets. I have set up a trunk link carrying all 3 vlans over 1 ethernet cable to my Ubuntu box. I would like to set up the trunk link on the ubuntu side using netplan. There is a dns server configured locally on the ubuntu box as well. Here is the configuration I would like to commit. Please tell me if it is wrong:

network:

version: 2
renderer: networkd
ethernets:
    eth0:
        dhcp4: false
vlans:
    eth0.5:
        id: 5
        link: eth0
        addresses: [ "x.x.x.5/24" ]
        routes:
         - to: default
           via: x.x.x.1
        nameservers:
            addresses: [ "x.x.x.5" ]
    eth0.100:
        id: 100
        link: eth0
        addresses: [ "y.y.y.5/24" ]
        routes:
         - to: default
           via: y.y.y.1
        nameservers:
            addresses: [ "y.y.y.5" ]
    eth0.200:
        id: 200
        link: eth0
        addresses: [ "z.z.z.5/24" ]
        routes:
         - to: default
           via: z.z.z.1
        nameservers:
            addresses: [ "z.z.z.5" ]
Score:0
br flag

There are two devices connected each to other by Ethernet cable with 802.1Q VLAN trunk in your network. The router and the Ubuntu Box. Am I right?

Is displayed configuration taken from (or prepared to paste to) the Ubuntu box? If yes, there is problem concerning multiple default gateways. You have 3 GW's in your setting in one device. This is wrong. Only one GW can be in one system excluding special cases you use iproute2 and separate routing setting for each VLAN/network. If more gateways are used simultaneously then real outgoing GW (of the three configured) is selected randomly. Packet responses from Ubuntu to router can use other interface(s) than incoming packets. It is confusing for router and may cause troubles in communication.

The trunk and its setting you pasted can be used either

  • a) with only 1 GW or
  • b) if each of 3 VLAN configuration parts is used for another device, e.g. for 3 virtual machines sitting inside your Ubuntu box and connected via separate VLAN.

Please, try to explain your idea and usage purpose of your setting in detail to get better answer.

revengineer avatar
br flag
Thank you for your response. You are correct that the router is connected to the Ubuntu box via 802.1Q VLAN trunk. The displayed configuration is prepared to go onto the Ubuntu box, but not yet deployed. Since my router does not support mDNS, I am using the Ubuntu box to host Avahi on each of the 3 networks. What routes would I need to include for each VLAN so that all 3 networks can talk to each other?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.