{"id":1386,"date":"2016-02-25T10:02:42","date_gmt":"2016-02-25T09:02:42","guid":{"rendered":"https:\/\/www.hutsky.cz\/blog\/?p=1386"},"modified":"2016-02-25T10:02:42","modified_gmt":"2016-02-25T09:02:42","slug":"centos-7-bridge-for-kvm","status":"publish","type":"post","link":"https:\/\/www.hutsky.cz\/blog\/2016\/02\/centos-7-bridge-for-kvm\/","title":{"rendered":"Centos 7 &#8211; bridge for KVM"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-1394\" src=\"https:\/\/www.hutsky.cz\/blog\/wp-content\/uploads\/nicubunu-RPG-map-symbols-stone-bridge-100px.png\" alt=\"nicubunu-RPG-map-symbols-stone-bridge-100px\" width=\"100\" height=\"100\" \/>I got a machine on which I wanted to try Centos 7 and KVM virtualization. As usual, I had to search for how to do a network bridge as it&#8217;s been quite long since I did it last time (on Centos 6). So these are the basic steps. First, dont&#8217;t forget to install <em>bridge-utils<\/em> while installing the KVM-related packages:<\/p>\n<pre class=\"lang:sh decode:true\">yum install qemu-kvm libvirt virt-install bridge-utils ifconfig bind-utils<\/pre>\n<p>Now, this was the default config file for the network interface:<\/p>\n<pre class=\"lang:sh decode:true\"># cat \/etc\/sysconfig\/network-scripts\/ifcfg-enp3s1 \r\nTYPE=Ethernet\r\nBOOTPROTO=dhcp\r\nDEFROUTE=yes\r\nPEERDNS=yes\r\nPEERROUTES=yes\r\nIPV4_FAILURE_FATAL=no\r\nIPV6INIT=yes\r\nIPV6_AUTOCONF=yes\r\nIPV6_DEFROUTE=yes\r\nIPV6_PEERDNS=yes\r\nIPV6_PEERROUTES=yes\r\nIPV6_FAILURE_FATAL=no\r\nNAME=enp3s1\r\nUUID=5435015d-7174-414a-9fa3-9b5ec715a054\r\nDEVICE=enp3s1\r\nONBOOT=yes<\/pre>\n<p>I had to change it to point to a bridge interface called <em>bridge0<\/em>.<\/p>\n<pre class=\"lang:sh decode:true\"># cat \/etc\/sysconfig\/network-scripts\/ifcfg-enp3s1 \r\nDEVICE=\"enp3s1\"\r\nONBOOT=\"yes\"\r\nNM_CONTROLLED=\"no\"\r\n#TYPE=Ethernet\r\nBRIDGE=bridge0\r\nBOOTPROTO=static\r\n<\/pre>\n<p>And this is where the new network configuration goes. It&#8217;s probably worth mentioning that it&#8217;s been changed from DHPC to a static IP address:<\/p>\n<pre class=\"lang:sh decode:true\"># cat \/etc\/sysconfig\/network-scripts\/ifcfg-bridge0\r\nDEVICE=\"bridge0\"\r\nONBOOT=\"yes\"\r\nTYPE=Bridge\r\nBOOTPROTO=static\r\nIPADDR=192.168.0.103\r\nNETMASK=255.255.255.0<\/pre>\n<p>and also that the GATEWAY has been moved to\u00a0<em>\/etc\/sysconfig\/network.<\/em><\/p>\n<pre class=\"lang:sh decode:true\"># cat \/etc\/sysconfig\/network\r\n# Created by anaconda\r\nGATEWAY=192.168.2.1<\/pre>\n<p>After<\/p>\n<pre class=\"lang:sh decode:true\">service network restart<\/pre>\n<p>you should be able to connect KVM VMs directly to the LAN.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I got a machine on which I wanted to try Centos 7 and KVM virtualization. As usual, I had to search for how to do a network bridge as it&#8217;s been quite long since I did it last time (on &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.hutsky.cz\/blog\/2016\/02\/centos-7-bridge-for-kvm\/\"> <span class=\"screen-reader-text\">Centos 7 &#8211; bridge for KVM<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[39,18,38,13],"class_list":["post-1386","post","type-post","status-publish","format-standard","hentry","category-operatingsystems","tag-centos","tag-linux","tag-networking","tag-os"],"_links":{"self":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts\/1386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/comments?post=1386"}],"version-history":[{"count":9,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts\/1386\/revisions"}],"predecessor-version":[{"id":1396,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts\/1386\/revisions\/1396"}],"wp:attachment":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/media?parent=1386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/categories?post=1386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/tags?post=1386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}