{"id":14794,"date":"2025-09-16T23:43:46","date_gmt":"2025-09-17T06:43:46","guid":{"rendered":"https:\/\/www.apolonio.com\/blog\/?p=14794"},"modified":"2025-09-16T23:43:46","modified_gmt":"2025-09-17T06:43:46","slug":"vlans-on-qemu-kvm","status":"publish","type":"post","link":"https:\/\/www.apolonio.com\/blog\/?p=14794","title":{"rendered":"Vlans on QEMU-KVM"},"content":{"rendered":"\n<p>Cool. I figured out how to configure my KVM host to use a trunked VLAN for multiple subnet access.  I can now land a VM on any subnet.  Still reviewing if my process is right but here is a script.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nVMINT=\"en0\"\nVLANINT=\"vmnetwork\"\nBRIDGE=\"vmbridge\"\nVLANTAG=199\n\n# Bridge should already exist but here is how to create it\nnmcli connection add type bridge \\\n  ifname ${BRIDGE} \\\n  con-name ${BRIDGE}\n\n# Attach VLAN interface to the bridge\nnmcli connection add type vlan \\\n  ifname ${VLANINT}${VLANTAG} \\\n  con-name ${VLANINT}${VLANTAG} \\\n  dev ${VMINT} id ${VLANTAG} \\\n  master ${BRIDGE}\n\nnmcli con mod ${BRIDGE} ipv4.method \"disabled\"\nnmcli con mod ${BRIDGE} ipv6.method \"disabled\"\n\ncat &lt;&lt; ENDOFFILE > $VLANINT.xml \n&lt;network>\n  &lt;name>'$VLANINT'&lt;\/name>\n  &lt;forward mode='bridge'\/>\n  &lt;bridge name='$BRIDGE'\/>\n&lt;\/network>\nENDOFFILE\n\nvirsh net-define ${VLANINT}.xml\nvirsh net-start ${VLANINT}\nvirsh net-autostart ${VLANINT}<\/code><\/pre>\n\n\n\n<p>Really cool, another step towards bailing on ESXi.<\/p>\n\n\n\n<p>Weight: 330.6<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cool. I figured out how to configure my KVM host to use a trunked VLAN for multiple subnet access. I can now land a VM on any subnet. Still reviewing if my process is right but here is a script. &hellip; <a href=\"https:\/\/www.apolonio.com\/blog\/?p=14794\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25,14,11,3,12,9],"tags":[],"class_list":["post-14794","post","type-post","status-publish","format-standard","hentry","category-fitbit","category-new-toys","category-technical","category-training","category-virtualization","category-weighin"],"_links":{"self":[{"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14794","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14794"}],"version-history":[{"count":1,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14794\/revisions"}],"predecessor-version":[{"id":14795,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14794\/revisions\/14795"}],"wp:attachment":[{"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}