KVM: Difference between revisions

Jump to navigation Jump to search
1,216 bytes added ,  5 July 2018
→‎Install packages and start libvirtd: configure bridged networking
Line 44: Line 44:
----------------------------------------------------------
----------------------------------------------------------
  default              active    yes          yes
  default              active    yes          yes
</source>
Default configuration allows all VMs to access other VMs but not the network that the host machine is on. You can check the private network created by default:
<source lang="bash">
# virsh net-dumpxml default
<network>
  <name>default</name>
  <uuid>51beab57-eb0c-40b9-bb5e-957f31c1b489</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='52:54:00:f0:c0:2d'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254'/>
    </dhcp>
  </ip>
</network>
</source>
Add the following line to <span class="package">/etc/sysconfig/network-scripts/ifconfig-enp3s0</span>:
<source lang="ini">
BRIDGE=br0
</source>
Create a new file <span class="package">/etc/sysconfig/network-scripts/ifcfg-br0</span>:
<source lang="ini">
DEVICE="br0"
# I am getting ip from DHCP server #
BOOTPROTO="dhcp"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
ONBOOT="yes"
TYPE="Bridge"
DELAY="0"
</source>
Restart the networking service:
<source lang="bash">
# systemctl restart NetworkManager
</source>
Check with brctl command:
<source lang="bash">
# brctl show
</source>
</source>

Navigation menu