Lesson 5

Dates: 6/12/2017
Linux networking
Linux System Administration


Exercises: Bridged network for VM.


  • Shutdown the VMs:
    
    virsh shutdown kvm3 
    
    Configure the bridged interface: edit file /etc/network/interfaces on the desktop and add the configuration for br0 interface. The configuration file now should look as follows:
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The bridging interface
    auto br0
    iface br0 inet dhcp
            bridge_ports enp4s0
            bridge_stp off
            bridge_fd 0
            bridge_maxwait 0
    
    Bring up the bridged interface:
    
    ifup br0
    
    Check if an IP address has been assigned to interface br0;
    
    ifconfig br0 | grep -w 'inet'
    


  • Configure kvm3 VM for the bridged network: edit the xml configuration file, /etc/libvirt/qemu/kvm3.xml and replace
    
    <interface type='network'>
    
    with
    
    <interface type='bridge'>
    
    Also replace
    
    <source network='default'/>
    
    with
    
    <source bridge='br0'/>
    
    Assign a unique MAC address to the VM in the xml file. For example, for desktop15, put '15' in the last byte like shown below:
    
    <mac address='52:54:00:b1:79:15'/>
    
    Execute command below:
    
    virsh define /etc/libvirt/qemu/kvm3.xml
    
  • Start then VM, then login to its console
    
    virsh start kvm3 
    virsh console kvm3 
    
    Then execute the following command on the VM
    
    ifconfig eth0
    
    The IP address should be on 192.168.5.0 subnet.

    From the desktop, ssh to kvm3. For example, if the IP address is 192.168.5.188:
    
    ssh hostadm@192.168.5.188
    



  • Take me to the Course Website