Skip to content

Virsh

Network

#
virsh net-list --all
#
virsh net-dumpxml <network>
#
virsh net-start <network>
#
virsh net-dhcp-leases NAT-network
 Expiry Time           MAC address         Protocol   IP address          Hostname        Client ID or DUID
----------------------------------------------------------------------------------------------------------------
 2020-10-06 18:15:16   52:54:00:91:2e:7b   ipv4       192.168.22.101/24   vm-win10        01:52:54:00:91:2e:7b

Issue: NAT not working

Reason: nftables using in libvirtd by default Solution: set firewall_backend=iptables option in /etc/libvirt/network.conf since we are using iptables-nft instead of nftables. After that:

systemctl restart libvirtd.service
Check iptables NAT
# sudo iptables -t nat -L LIBVIRT_PRT -n -v
Chain LIBVIRT_PRT (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 RETURN     0    --  *      wlp0s20f0u5  192.168.22.0/24      224.0.0.0/24        
    0     0 RETURN     0    --  *      wlp0s20f0u5  192.168.22.0/24      255.255.255.255     
  756 39352 MASQUERADE  6    --  *      wlp0s20f0u5  192.168.22.0/24     !192.168.22.0/24      masq ports: 1024-65535
  608 96508 MASQUERADE  17   --  *      wlp0s20f0u5  192.168.22.0/24     !192.168.22.0/24      masq ports: 1024-65535
    2   120 MASQUERADE  0    --  *      wlp0s20f0u5  192.168.22.0/24     !192.168.22.0/24