{"id":515,"date":"2017-06-05T22:22:07","date_gmt":"2017-06-05T21:22:07","guid":{"rendered":"http:\/\/darkandscary.co.uk\/?p=515"},"modified":"2017-06-05T22:22:07","modified_gmt":"2017-06-05T21:22:07","slug":"creating-virtual-networks-in-kvm","status":"publish","type":"post","link":"https:\/\/darkandscary.co.uk\/?p=515","title":{"rendered":"Creating virtual networks in KVM"},"content":{"rendered":"<p>In earlier posts I installed the KVM hypervisor on an openSUSE Leap system and added a bridged network connection. That will allow virtual machines to use IP addresses on my house network. However, what if I want to use &#8216;private&#8217; networks for the experiments I wish to run? That is easily done so let&#8217;s see\u00a0how to\u00a0create networks and address ranges as follows:<\/p>\n<pre><div class='content-column one_half'>'management'<\/div><div class='content-column one_half'>192.168.99.0\/24<\/div>\r\n<div class='content-column one_half'>'site1'<\/div><div class='content-column one_half'>192.168.100.0\/24<\/div>\r\n<div class='content-column one_half'>'site2vlan1'<\/div><div class='content-column one_half'>192.168.101.0\/24<\/div>\r\n<div class='content-column one_half'>'site2vlan2'<\/div><div class='content-column one_half'>192.168.102.0\/24<\/div><\/pre>\n<p>Bring up the &#8216;details&#8217; pane for the hypervisor and select the &#8216;Virtual Networks&#8217; tab as follows:<\/p>\n<figure id=\"attachment_533\" aria-describedby=\"caption-attachment-533\" style=\"width: 756px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/Bare-network-list.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-533 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/Bare-network-list.png\" alt=\"\" width=\"756\" height=\"528\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/Bare-network-list.png 756w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/Bare-network-list-300x210.png 300w\" sizes=\"auto, (max-width: 756px) 100vw, 756px\" \/><\/a><figcaption id=\"caption-attachment-533\" class=\"wp-caption-text\">The list of virtual networks, currently empty<\/figcaption><\/figure>\n<p>Clicking on the small blue cross opens the dialog for adding a new network. Let&#8217;s define the &#8216;management&#8217; LAN as follows:<\/p>\n<figure id=\"attachment_535\" aria-describedby=\"caption-attachment-535\" style=\"width: 389px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-535 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-1.png\" alt=\"\" width=\"389\" height=\"511\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-1.png 389w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-1-228x300.png 228w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/a><figcaption id=\"caption-attachment-535\" class=\"wp-caption-text\">Setting the name of the management LAN<\/figcaption><\/figure>\n<p>Next, define the IP address and subnet mask (192.168.99.0\/24) and untick the &#8216;Enable DHCPv4&#8217; option. DHCP will be provided by the virtual Mikrotek router.<\/p>\n<figure id=\"attachment_537\" aria-describedby=\"caption-attachment-537\" style=\"width: 389px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-537 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-2.png\" alt=\"\" width=\"389\" height=\"476\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-2.png 389w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-2-245x300.png 245w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/a><figcaption id=\"caption-attachment-537\" class=\"wp-caption-text\">Setting the IP address range and disabling DHCP<\/figcaption><\/figure>\n<p>On the next pane, disable IPv6 for the time being.<\/p>\n<figure id=\"attachment_539\" aria-describedby=\"caption-attachment-539\" style=\"width: 389px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-539 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-3.png\" alt=\"\" width=\"389\" height=\"476\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-3.png 389w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-3-245x300.png 245w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/a><figcaption id=\"caption-attachment-539\" class=\"wp-caption-text\">Disable IPv6 for this network<\/figcaption><\/figure>\n<p>Finally, select the option to create an isolated network and keep the DNS Domain Name as shown.<\/p>\n<figure id=\"attachment_541\" aria-describedby=\"caption-attachment-541\" style=\"width: 389px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-541 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-4.png\" alt=\"\" width=\"389\" height=\"476\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-4.png 389w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/define-management-lan-4-245x300.png 245w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/a><figcaption id=\"caption-attachment-541\" class=\"wp-caption-text\">Creating an isolated network called &#8216;management&#8217;<\/figcaption><\/figure>\n<p>Repeating the process for the other networks produces a network list as follows:<\/p>\n<figure id=\"attachment_545\" aria-describedby=\"caption-attachment-545\" style=\"width: 756px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/network-list.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-545 size-full\" src=\"http:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/network-list.png\" alt=\"\" width=\"756\" height=\"528\" srcset=\"https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/network-list.png 756w, https:\/\/darkandscary.co.uk\/wp-content\/uploads\/2017\/06\/network-list-300x210.png 300w\" sizes=\"auto, (max-width: 756px) 100vw, 756px\" \/><\/a><figcaption id=\"caption-attachment-545\" class=\"wp-caption-text\">The completed list of virtual networks<\/figcaption><\/figure>\n<p>As a final check to see that everything is working as expected, bring up a console as the root user and type the following commands:<\/p>\n<p><code>virsh net-list<\/code><\/p>\n<pre>virsh net-list\r\n Name                 State      Autostart     Persistent\r\n----------------------------------------------------------\r\n management           active     yes           yes\r\n site1                active     yes           yes\r\n site2vlan1           active     yes           yes\r\n site2vlan2           active     yes           yes\r\n<\/pre>\n<p><code>ip addr<\/code><\/p>\n<pre>ip addr\r\n1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1\r\n    link\/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\r\n    inet 127.0.0.1\/8 scope host lo\r\n       valid_lft forever preferred_lft forever\r\n    inet6 ::1\/128 scope host \r\n       valid_lft forever preferred_lft forever\r\n2: eth0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000\r\n    link\/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff\r\n3: br0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc noqueue state UP group default qlen 1000\r\n    link\/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff\r\n    inet 192.168.1.101\/24 brd 192.168.1.255 scope global br0\r\n       valid_lft forever preferred_lft forever\r\n    inet6 fd00::1:8ca0:7c31:ae16:2e0e\/64 scope global temporary dynamic \r\n       valid_lft 6233sec preferred_lft 6233sec\r\n    inet6 fd00::1:12bf:48ff:fe88:f355\/64 scope global mngtmpaddr dynamic \r\n       valid_lft 6233sec preferred_lft 6233sec\r\n    inet6 fe80::12bf:48ff:fe88:f355\/64 scope link \r\n       valid_lft forever preferred_lft forever\r\n4: virbr0: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc noqueue state DOWN group default qlen 1000\r\n    link\/ether 52:54:00:c4:63:38 brd ff:ff:ff:ff:ff:ff\r\n    inet 192.168.99.1\/24 brd 192.168.99.255 scope global virbr0\r\n       valid_lft forever preferred_lft forever\r\n5: virbr0-nic: &lt;BROADCAST,MULTICAST&gt; mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000\r\n    link\/ether 52:54:00:c4:63:38 brd ff:ff:ff:ff:ff:ff\r\n6: virbr1: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc noqueue state DOWN group default qlen 1000\r\n    link\/ether 52:54:00:53:8a:0c brd ff:ff:ff:ff:ff:ff\r\n    inet 192.168.100.1\/24 brd 192.168.100.255 scope global virbr1\r\n       valid_lft forever preferred_lft forever\r\n7: virbr1-nic: &lt;BROADCAST,MULTICAST&gt; mtu 1500 qdisc pfifo_fast master virbr1 state DOWN group default qlen 1000\r\n    link\/ether 52:54:00:53:8a:0c brd ff:ff:ff:ff:ff:ff\r\n8: virbr2: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc noqueue state DOWN group default qlen 1000\r\n    link\/ether 52:54:00:cf:6f:e2 brd ff:ff:ff:ff:ff:ff\r\n    inet 192.168.101.1\/24 brd 192.168.101.255 scope global virbr2\r\n       valid_lft forever preferred_lft forever\r\n9: virbr2-nic: &lt;BROADCAST,MULTICAST&gt; mtu 1500 qdisc pfifo_fast master virbr2 state DOWN group default qlen 1000\r\n    link\/ether 52:54:00:cf:6f:e2 brd ff:ff:ff:ff:ff:ff\r\n10: virbr3: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc noqueue state DOWN group default qlen 1000\r\n    link\/ether 52:54:00:26:84:24 brd ff:ff:ff:ff:ff:ff\r\n    inet 192.168.102.1\/24 brd 192.168.102.255 scope global virbr3\r\n       valid_lft forever preferred_lft forever\r\n11: virbr3-nic: &lt;BROADCAST,MULTICAST&gt; mtu 1500 qdisc pfifo_fast master virbr3 state DOWN group default qlen 1000\r\n    link\/ether 52:54:00:26:84:24 brd ff:ff:ff:ff:ff:ff\r\n<\/pre>\n<p>The results\u00a0show the four virtual networks <code>(virbr0 to virbr3)<\/code>, but they\u00a0also show that four virtual network adapters <code>(virbr0-nic to virbr3-nic)<\/code> have been created that connect each of these new networks to the host machine itself.<\/p>\n<p>In another post, the virtual Mikrotek router will be installed and a basic configuration applied to allow it to route between the four virtual networks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In earlier posts I installed the KVM hypervisor on an openSUSE Leap system and added a bridged network connection. That will allow virtual machines to use IP addresses on my house network. However, what if I want to use &#8216;private&#8217; networks for the experiments I wish to run? That is easily done so let&#8217;s see\u00a0how &hellip; <a href=\"https:\/\/darkandscary.co.uk\/?p=515\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Creating virtual networks in KVM<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,21],"tags":[],"class_list":["post-515","post","type-post","status-publish","format-standard","hentry","category-linux","category-virtualisation"],"_links":{"self":[{"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=515"}],"version-history":[{"count":16,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/515\/revisions"}],"predecessor-version":[{"id":559,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/515\/revisions\/559"}],"wp:attachment":[{"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/darkandscary.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}