When working with OpenStack image creation using KVM/libvirt, many administrators encounter the frustrating error:
ERROR Error in network device parameters: Virtual network 'default' does not exist: Network not found: no network with matching name 'default'
This typically occurs when trying to create a CentOS image using virt-install with the --network network=default
parameter, as shown in the original example.
Libvirt provides several networking modes:
- NAT (default): The traditional 'default' network that provides NAT-based connectivity
- Bridge networking: Direct attachment to physical interfaces
- Private networking: Isolated virtual networks
- Passthrough: Direct hardware access
Here are three approaches to resolve this issue:
Option 1: Create the Default Network
First check existing networks:
virsh net-list --all
Then create the default network if missing:
cat > /tmp/default-network.xml <<EOF
<network>
<name>default</name>
<bridge name="virbr0"/>
<forward mode="nat"/>
<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>
EOF
virsh net-define /tmp/default-network.xml
virsh net-start default
virsh net-autostart default
Option 2: Use Bridge Networking
For production environments, bridge networking is often preferred:
# Create a bridge interface (example for CentOS/RHEL)
nmcli con add type bridge ifname br0
nmcli con add type bridge-slave ifname eth0 master br0
nmcli con up br0
# Then modify virt-install command:
--network bridge=br0
Option 3: RDO-Specific Approach
For RDO deployments, Neutron typically handles networking. You might want to:
# Install necessary packages
yum install -y openstack-neutron openstack-neutron-ml2
# Configure networking in nova.conf:
[libvirt]
virt_type=kvm
inject_password=true
inject_key=true
inject_partition=-1
live_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE
After implementing any solution, verify with:
virsh net-list
ip addr show
brctl show
Here's a modified version that works without the default network:
virt-install --virt-type kvm --name centos-6.4 --ram 1024 \
--cdrom=/data/isos/CentOS-6.4-x86_64-netinstall.iso \
--disk /tmp/centos-6.4.qcow2,format=qcow2 \
--network none \
--graphics vnc,listen=0.0.0.0 --noautoconsole \
--os-type=linux --os-variant=rhel6
You can then attach networking later using virsh edit commands.
When working with libvirt for KVM virtualization (particularly in OpenStack/RDO environments), you might encounter this common error:
ERROR Error in network device parameters: Virtual network 'default' does not exist: Network not found: no network with matching name 'default'
Unlike some virtualization platforms that automatically create default networks, libvirt requires explicit network configuration. The "default" network is just a common convention - not an automatic feature.
To list available networks:
# virsh net-list --all
Name State Autostart Persistent
--------------------------------------------------------
For most OpenStack/KVM use cases, a NAT network works well. Create an XML definition file (e.g., nat-network.xml):
<network>
<name>nat_network</name>
<forward mode='nat'/>
<bridge name='virbr1' stp='on' delay='0'/>
<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>
Then create and activate it:
# virsh net-define nat-network.xml
# virsh net-start nat_network
# virsh net-autostart nat_network
With your network created, adjust your VM creation command:
# virt-install --virt-type kvm --name centos-6.4 --ram 1024 \
--cdrom=/data/isos/CentOS-6.4-x86_64-netinstall.iso \
--disk /tmp/centos-6.4.qcow2,format=qcow2 \
--network network=nat_network \
--graphics vnc,listen=0.0.0.0 --noautoconsole \
--os-type=linux --os-variant=rhel6
RDO deployments typically manage their own networking through Neutron. For image creation, you have two approaches:
- Bridged Networking: Connect directly to your physical network
- Isolated NAT: Use the NAT network we created above
For bridged networking (requires host network configuration):
--network bridge=br0
After VM creation, verify network access:
# virsh console centos-6.4
[root@localhost ~]# ping 8.8.8.8
[root@localhost ~]# ip addr show