3

I am creating a new QEMU/KVM virtual machine using libvirt CLI in Debian Linux.

According the tutorial, I must activate the default network using the following command:

sudo virsh net-start default

But issuing the command results in the following error messages:

error: Failed to start network default

error: internal error: Network is already in use by interface enp3s0

What should I do?

UPDATE

$ sudo virsh net-dumpxml default
<network>
  <name>default</name>
  <uuid>5aa3a984-c586-45e1-8f74-82aae05832f3</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='52:54:00:3b:bf:c3'/>
  <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>
$ sudo virsh net-info default
Name:           default
UUID:           5aa3a984-c586-45e1-8f74-82aae05832f3
Active:         no
Persistent:     yes
Autostart:      yes
Bridge:         virbr0
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether c8:5b:76:e9:fb:ab brd ff:ff:ff:ff:ff:ff
    altname enxc85b76e9fbab
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000
    link/ether c8:3d:d4:87:aa:6d brd ff:ff:ff:ff:ff:ff
    altname wlxc83dd487aa6d
$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether c8:5b:76:e9:fb:ab brd ff:ff:ff:ff:ff:ff
    altname enxc85b76e9fbab
    inet 192.168.122.36/24 brd 192.168.122.255 scope global dynamic noprefixroute enp3s0
       valid_lft 603262sec preferred_lft 603262sec
    inet6 fe80::f3e2:a270:4aff:6497/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether c8:3d:d4:87:aa:6d brd ff:ff:ff:ff:ff:ff
    altname wlxc83dd487aa6d
    inet 192.168.124.199/23 brd 192.168.125.255 scope global dynamic noprefixroute wlp2s0
       valid_lft 5633sec preferred_lft 5633sec
    inet6 fe80::2284:c4a0:69f7:fc4f/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
$ ip route
default via 192.168.122.254 dev enp3s0 proto dhcp src 192.168.122.36 metric 100 
default via 192.168.124.254 dev wlp2s0 proto dhcp src 192.168.124.199 metric 600 
192.168.122.0/24 dev enp3s0 proto kernel scope link src 192.168.122.36 metric 100 
192.168.124.0/23 dev wlp2s0 proto kernel scope link src 192.168.124.199 metric 600 
0

1 Answer 1

7

The 192.168.122.0/24 subnet for the default virtual network configured by libvirt happens to match the one on your enp3s0 interface.

So one of them must change. Likely easier to change the subnet of libvirt's default network.

Run:

sudo virsh net-edit default

And change all occurrences of 192.168.122 to 192.168.26 for instance (26 chosen at random and not overlapping with the other networks on your other interfaces).

Could be automated with for instance:

sudo EDITOR="perl -pi -e 's/192\.168\.\K122/26/g'" virsh net-edit default

It doesn't have to be under 192.168, but you should use a subnet within the ranges of IPv4 addresses reserved for private use from RFC1918.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.