wagemakers.be
Hello Visitor         Login

Linux kvm private virtual switch with libvirtd

Linux kvm private switch

  1. Create a network xml file
    
    <network>
      <name>privatenet</name>
      <bridge name="privatebr0" />
    </network>
    
    
  2. Import the network xml file

    # virsh net-define /tmp/privatenet.xml 
    Network privatenet created from /tmp/privatenet.xml
     
  3. Verify that the network is created in libvirt
    
    
    [root@vicky networks]# virsh net-list --all
    Name                 State      Autostart
    -----------------------------------------
    default              active     yes       
    privatenet           active     no        
    
    [root@vicky networks]# virsh net-info privatenet
    Name            privatenet
    UUID            b13de960-72cc-4f66-32df-432ce2e45538
    Active:         yes
    Persistent:     no
    Autostart:      no
    Bridge:         privatebr0
  4. Enable auto-start

    virsh # net-list
    Name State Autostart
    -----------------------------------------
    default active yes

    virsh # net-list --all
    Name State Autostart
    -----------------------------------------
    default active yes
    privatenet inactive no

    virsh # net-start privatenet
    Network privatenet started

    virsh # net-autostart privatenet
    Network privatenet marked as autostarted

    virsh #

  5. Start virt-manager

    Add the virtual switch to an existing domain or use it for a new domain.

    privatenet1
  6. Start the domain
    Start the domain in virt-manager or by virsh

    # virsh
    Welcome to virsh, the virtualization interactive terminal.

    Type: 'help' for help with commands
    'quit' to quit

    virsh # list --all
    Id Name State
    ----------------------------------
    - centos6 shut off
    - debian shut off
    - fed1 shut off
    - fed2 shut off
    - mywin shut off
    - sol10 shut off

    virsh # start fed1
    Domain fed1 started

    virsh #