{"id":3126,"date":"2023-12-22T14:08:27","date_gmt":"2023-12-22T14:08:27","guid":{"rendered":"https:\/\/voodoo.business\/?p=3126"},"modified":"2023-12-28T06:30:36","modified_gmt":"2023-12-28T06:30:36","slug":"adding-an-internal-network-to-kvm","status":"publish","type":"post","link":"https:\/\/www.voodoo.business\/blog\/2023\/12\/22\/adding-an-internal-network-to-kvm\/","title":{"rendered":"Adding an internal network to KVM"},"content":{"rendered":"\n<p>A private network connects select virtual machines to other virtual machines on the same host, and to the host itself, I usually use it to use samba shares between all virtual machines without giving those virtual machines access to the internet.<\/p>\n\n\n\n<p>To do this, you will need to add a vridge to the host computer without an actual network interface that the bridge connects to, you can also add DHCP if you don&#8217;t care to hard code the IP addresses, the virtual machine can then use this interface to talk to other virtual machines or the host itself, A virtual machine can have both this network interface and another that does have access to the internet if you so chose<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>1- Create the file \/etc\/libvirt\/qemu\/networks\/private.xml with the following contents<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;network&gt;\n  &lt;name&gt;private&lt;\/name&gt;\n  &lt;bridge name=\"privbr\"\/&gt;\n  &lt;ip address=\"192.168.8.1\" netmask=\"255.255.255.0\"&gt;\n    &lt;dhcp&gt;\n      &lt;range start=\"192.168.8.2\" end=\"192.168.8.254\"\/&gt;\n    &lt;\/dhcp&gt;\n  &lt;\/ip&gt;\n&lt;\/network&gt;<\/pre>\n\n\n\n<p>Now, tell KVM about it<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">virsh net-define \/etc\/libvirt\/qemu\/networks\/private.xml<\/pre>\n\n\n\n<p>Now, make sure it comes up with every reboot<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">virsh net-start private\nvirsh net-autostart private<\/pre>\n\n\n\n<p>Last but not least, modify the virtual machine to use it, in the guest configuration, add the following right after the existing<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">    &lt;interface type='bridge'&gt;\n      &lt;mac address='00:16:3e:5d:c7:9e'\/&gt;\n      &lt;source bridge='privbr'\/&gt;\n      &lt;model type='e1000e'\/&gt;\n      &lt;address type='pci' domain='0x0000' bus='0x09' slot='0x00' function='0x0'\/&gt;\n    &lt;\/interface&gt;<\/pre>\n\n\n\n<p>The instructions here are for Debian 12 (Bookworm), but may apply to older versions of the distro<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A private network connects select virtual machines to other virtual machines on the same host, and to the host itself, I usually use it to use samba shares between all virtual machines without giving those virtual machines access to the internet. To do this, you will need to add a vridge to the host computer [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3126","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/3126","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/comments?post=3126"}],"version-history":[{"count":4,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/3126\/revisions"}],"predecessor-version":[{"id":3142,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/3126\/revisions\/3142"}],"wp:attachment":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/media?parent=3126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/categories?post=3126"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/tags?post=3126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}