In this post we will see how to set up networking for KVM hypervisor. Networking is an important part in implementing Virtualization as without networking VM’s can not communicate with each other. Below are the some of the topics covered in this series.

Some advantages of networking:

  1. Your VM can communicate with Hypervisor or machines through network.
  2. Can take remote connection to VM from outer network and Internet.

We can connect VM’s to networking using two techniques

  • NATing: In computer networking, network address translation (NAT) is the process of modifying IP address information in IP packet headers while in transit across a traffic routing device..
  • Bridge network:Network bridging describes the action taken by network equipment to allow two or more communication networks, or two or more network segments, to create an aggregate network.
Related concept:   Converting Sun Virtualbox vmi file To Vmware vmdk file

–From wikipedia

In this post we will see how to do NATing can be done through GUI and some come commands related to networking. Before enabling networking we have to implement IP forwarding on KVM hypervisor.

Implementing NATing in KVM(Through GUI)

KVM networking





5 6 7 8 9 10 11 12 13 14

You can see after networking with NAT we can able to ping to This indicates that networking happen without any issue. Below are some networking related commands you should know.

Through CLI:

Example1: Check if any network is available using virsh command

virsh net-list –all


virsh net-list


Name State Autostart
default active yes
net1 active yes
net2 active yes
NewNAT active yes


Example2: Creating a Network device with NAT

virsh net-create /path/to/your/networking/xml/file


virsh net-create /etc/libvirt/qemu/networks/SecNAT.xml
Network SecNAT created from /etc/libvirt/qemu/networks/SecNAT.xml

virsh net-list output

virsh net-list
Name State Autostart
default active yes
net1 active yes
net2 active yes
NewNAT active yes
SecNAT active no

Related concept:   Advantages of Virtualization


Example3: Enable it at the start of Hypervisor

virsh net-autostart SecNAT
Network SecNAT marked as autostarted

Exampl4: To stop an Network device

virsh net-destroy SecNAT
Network SecNAT destroyed

After destroying network, output of net-list command is


virsh net-list
Name State Autostart
default active yes
net1 active yes
net2 active yes
NewNAT active yes


Example5: Want to get more help on networking, use below command

 virsh help network

Networking (help keyword ‘network’):
net-autostart autostart a network
net-create create a network from an XML file
net-define define (but don’t start) a network from an XML file
net-destroy destroy (stop) a network
net-dumpxml network information in XML
net-edit edit XML configuration for a network
net-info network information
net-list list networks
net-name convert a network UUID to network name
net-start start a (the previously defined) inactive network
net-undefine undefine an inactive network
net-uuid convert a network name to network UUID

Stay tuned to our next post on “KVM virtualization: How to view guest VM’s in Hypervisor/Host machine?”

Related concept:   KVM virtualization: Install KVM hypervisor in Ubuntu/Debian Linux?