LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   virsh / Failed to start network default (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/virsh-failed-to-start-network-default-4175672429/)

caibbor 04-02-2020 01:37 PM

virsh / Failed to start network default
 
I've been scouring google for the past day trying to figure out why I can't create a default network for my linux guest. One source says the iptables error is harmless, but I still can't create a default network. What's going on here?

the default.xml didn't even exist on my filesystem, so I had to copy it from a forum.

Code:

# pwd
/usr/share/libvirt/networking

# virsh net-undefine default
Network default has been undefined

# virsh net-destroy default
error: failed to get network 'default'
error: Network not found: no network with matching name 'default'

# virsh net-list
 Name  State  Autostart  Persistent
----------------------------------------

# cat default.xml
<network>
  <name>default</name>
  <uuid>afd4e923-66cb-45ca-9120-1e46e72899a3</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr0' 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>

# virsh net-define default.xml
Network default defined from default.xml

# virsh net-autostart default
Network default marked as autostarted

# virsh net-start default
error: Failed to start network default
error: internal error: Failed to apply firewall rules /sbin/iptables -w --table filter --insert LIBVIRT_INP --in-interface virbr0 --protocol tcp --destination-port 67 --jump ACCEPT: iptables: No chain/target/match by that name.

Code:

# uname -a
Linux user-pc 5.3.0-45-generic #37-Ubuntu SMP Thu Mar 26 20:41:27 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

# cat /etc/issue
Ubuntu 19.10 \n \l


caibbor 04-02-2020 01:44 PM

Found the magic bullet. I think I just had to restart the libvertd service...

Code:

virsh net-undefine default
virsh net-destroy default
virsh net-list
systemctl enable --now libvirtd
systemctl enable virtlogd.socket
systemctl restart libvirtd.service
cat default.xml
virsh net-define default.xml
virsh net-autostart default
virsh net-start default


Alessandro_Selli 12-14-2020 06:45 AM

Thank you!
 
Eight months later this post saved my day! No, what am I saying, my week!

virsh --version
6.7.0


Running on Debian 10.
Just a note: my default.xml was located in the directory /etc/libvirt/qemu/networks/, and it was erased by the command virsh net-destroy default.
Luckily I had an old one saved as /etc/libvirt/qemu/networks/default.xml.dpkg-old, which only differed from the original one by the interface's UUID and mac address.
So I only had to copy it into /etc/libvirt/qemu/networks/default.xml and run:

virsh net-define /etc/libvirt/qemu/networks/default.xml
virsh net-autostart default
virsh net-start default

to have the network back online!

Should it be handy to someone else, I'm copying it's content here:

<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh net-edit default
or other application using the libvirt API.
-->

<network>
<name>default</name>
<uuid>df2e3516-fd39-9ac5-4df2-a6125fd75c7c</uuid>
<forward mode='nat'/>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address='a0:47:01:d5:85:c6'/>
<ip address='192.168.0.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.0.2' end='192.168.0.254'/>
</dhcp>
</ip>
</network>


All times are GMT -5. The time now is 05:30 PM.