{"id":334,"date":"2021-03-16T21:35:47","date_gmt":"2021-03-16T21:35:47","guid":{"rendered":"https:\/\/maboc.nl\/?p=334"},"modified":"2021-03-16T22:25:37","modified_gmt":"2021-03-16T22:25:37","slug":"create-bridge-device-on-my-kvm-host","status":"publish","type":"post","link":"https:\/\/maboc.nl\/?p=334","title":{"rendered":"Create bridge device on my KVM  host"},"content":{"rendered":"<p>I installed KVM on my debian host. Since I have 8 cores and 32GB RAM I have room to play around \ud83d\ude42 And since I have some experience with KVM it was the obvious choice.<\/p>\n<p>Installing KVM : easy &#8230; apt is your friend<br \/>\nCreating an VM : easy &#8230; Maybe I&#8217;ll once write it up<\/p>\n<p>I could connect to the VM, using the console. However from within the VM I could only ping itself. I forgot to create a (virtual) bridge device which connect the VMs to the host machine.<\/p>\n<p>So what to do:<br \/>\nCreate br0.xml<\/p>\n<pre style=\"font-family:courier; font-size:smaller;\">\r\nroot@radijs:~# cat br0.xml \r\n&lt;network>\r\n  &lt;name>br0&lt;\/name>\r\n  &lt;forward mode='nat'>\r\n    &lt;nat>\r\n      &lt;port start='1024' end='65535'\/>\r\n    &lt;\/nat>\r\n  &lt;\/forward>\r\n  &lt;bridge name='br0' stp='on' delay='0'\/>\r\n  &lt;ip address='192.168.3.1' netmask='255.255.255.0'>\r\n    &lt;dhcp>\r\n      &lt;range start='192.168.3.2' end='192.168.3.20'\/>\r\n    &lt;\/dhcp>\r\n  &lt;\/ip>\r\n&lt;\/network>\r\nroot@radijs:~#\r\n<\/pre>\n<p>Make KVM aware of the bridge:<\/p>\n<pre style=\"font-family:courier; font-size:smaller;\">\r\nroot@radijs:~# virsh net-define br0.xml \r\nNetwork br0 defined from br0.xml\r\n\r\nroot@radijs:~#\r\n<\/pre>\n<p>Start the just defined bridge:<\/p>\n<pre style=\"font-family:courier; font-size:smaller;\">\r\nroot@radijs:~# virsh net-start br0\r\nNetwork br0 started\r\n\r\nroot@radijs:~# \r\n<\/pre>\n<p>Make sure it will autostart,<\/p>\n<pre style=\"font-family:courier; font-size:smaller;\">\r\nroot@radijs:~# virsh net-autostart br0\r\nNetwork br0 marked as autostarted\r\n\r\nroot@radijs:~#\r\n<\/pre>\n<p>Do I now actually have a bridge:<\/p>\n<pre style=\"font-family:courier; font-size:smaller;\">\r\nroot@radijs:~# virsh net-list\r\n Name   State    Autostart   Persistent\r\n-----------------------------------------\r\n br0    active   yes         yes\r\n\r\nroot@radijs:~#\r\n\r\n<\/pre>\n<p>Yes I have.<\/p>\n<p>The proof of the pudding is in the eating:&#8230;Can I now reach the world from my VM&#8217;s?<br \/>\nI can not show you&#8230;.but yes &#8230;.I can.<\/p>\n<p>Success!!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I installed KVM on my debian host. Since I have 8 cores and 32GB RAM I have room to play around \ud83d\ude42 And since I have some experience with KVM it was the obvious choice. Installing KVM : easy &#8230; apt is your friend Creating an VM : easy &#8230; Maybe I&#8217;ll once write it [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[54,62,58],"class_list":["post-334","post","type-post","status-publish","format-standard","hentry","category-kvm","tag-debian","tag-kvm","tag-linux"],"_links":{"self":[{"href":"https:\/\/maboc.nl\/index.php?rest_route=\/wp\/v2\/posts\/334","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/maboc.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/maboc.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/maboc.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/maboc.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=334"}],"version-history":[{"count":6,"href":"https:\/\/maboc.nl\/index.php?rest_route=\/wp\/v2\/posts\/334\/revisions"}],"predecessor-version":[{"id":340,"href":"https:\/\/maboc.nl\/index.php?rest_route=\/wp\/v2\/posts\/334\/revisions\/340"}],"wp:attachment":[{"href":"https:\/\/maboc.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/maboc.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/maboc.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}