Issues with VLAN bridges and untagged traffic - using systemd-networkd
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Issues with VLAN bridges and untagged traffic - using systemd-networkd
Hi All,
First forum post, Ive tried asking around in other locations, but to no avail. I figured a Linux forum might have some awesome greybeards who are willing to share their knowledge
So Ive moved over recently to using networkd to get my vlans and bridges setup for VMs, and almost everything is working like a charm.
In short I can create bridges for VLANS but cant create one for the untagged traffic
I have:
Trunk port (lets call it eth0) with 3 vlans (home, domain and lab) and the native untagged traffic
each vlan goes to a separate bridge which my vms connect to, and my host is living in the native untagged world. I want to create another bridge that will pass untagged traffic out
If i create a bridge without vlans my files look like this:
All is good, VMs and host all live happily on the LAN
Now I make the spicy sauce with the VLANs, as this post is going to be long I will show you only the eth0 and domain network files (however there are 4 files for each of the other vlan/bridge combos)
At this point my host is on the native untagged LAN, my guests can connect to the bridge and communicate on the VLAN.
I cannot work out how I add another bridge for this untagged traffic, as I want the option of adding virtual devices to it. I tried adding a new VLAN called mgt on VLAN 1 but that went down badly, if I look at ip link i dont see the bridge but i do see something called mgt@eth0 which has confused the hell out of me
I have also tried mixing these two solutions together to put a vlan aware bridge in front of the three bridges for each VLAN - that way I could connect virtual machines to any bridge. An example of what I did was to replace the eth0.network with a bridge like this...
I certainly don't have a grey beard but Ill take a crack at this one as I have worked on many types of switches and routers. Unfortunately I have not played around with this on Linux but after your post I am quite tempted to do so. You seem to have the knowledge of tagged and untagged vlans so I am sure it is just a matter of finding the correct setting. I found on older switch software, specifically Cisco the that if you did not specifically set a native vlan then it would automatically use vlan 1 as the "management" or untagged if you will. Anyway, what I am getting to is that on older software the management or untagged vlan would need to be manually set as management. If there is perhaps maybe a setting somewhere that does this?
I don't necessary mean creating a vlan and calling it management but basically taking any vlan and changing a setting that specifically sets it as a management vlan. This is just one scenario that comes to mind.
Another scenario could be similar to when setting up a IPT and PC through the same cable and tagging the IPT for lets say vlan400 and the data traffic as untagged on vlan300 as an example.
First a couple of caveats: I don't use systemd-networkd, and I don't work with virtual machines. I do have quite a bit of experience with bridges and VLANs on Linux.
Just so we're talking the same language, a bridge is a way to connect two or more interfaces; physical or virtual(VM).
NOTE: You can't have IP addresses assigned to your physical interfaces when creating bridges. I'm old-school so I use ifconfig:
host# ifconfig eth0 0.0.0.0/0 down
host# ifconfig eth1 0.0.0.0/0 down
host# ifconfig wlan0 0.0.0.0/0 down
You can now create a simple bridge from the command line:
host# brctl addbr BR-01 (create a bridge-virtual-interface [BVI])
host# brctl addif BR-01 eth0 (add an ethernet interface to the BVI)
host# brctl addif BR-01 eth1 (...if you have 2 ethernet ports)
host# brtcl addif BR-01 wlan0 (add an 802.11 interface to the BVI)
VLANs are a construct to separate computers into segregated broadcast domains. VLANs are attached to interfaces, either physical or virtual, such as a bridge-virtual-interface.
host# vconfig add BR-01 11
host# vconfig add BR-01 22
host# vconfig add BR-01 33
Now you can add IP addresses to your interfaces:
host# ifconfig BR-01 172.16.1.1/24 up (untagged)
host# ifconfig BR-01.11 192.168.11.1/24 up (tagged)
host# ifconfig BR-01.22 192.168.22.1/24 up (tagged)
host# ifconfig BR-01.33 192.168.33.1/24 up (tagged)
For troubleshooting, after you've created your bridges and VLANs, run a few commands:
host# brctl show
host# ifconfig -a
host# cd /proc/net/vlan
host# ls -al
host# cat BR-01.11
Don't confuse a Virtual Machines's ethernet interface with a BVI, it's really more of a physical interface... even though it's virtual.
How you convert this command-line nonsense to systemd-networkd config files is up to you.... sorry.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.