On 5/17/24 09:56, Arun Mani J via Users wrote:
Hey all.
I'm exploring virt-manager, libvirt etc. I downloaded Debian 12 KDE ISO
and when launched using virt-manager, it does not seem to connect to
network. |nmcli| says it has failed to get an IP address.
However, if I run the same ISO inside GNOME Boxes, then it is able to
connect to network.
I checked the XML configuration of both and found this:
```xml
<interface type="user">
<mac address="52:54:00:ea:f9:69"/>
<model type="virtio"/>
<address type="pci" domain="0x0000" bus="0x01"
slot="0x00"
function="0x0"/>
</interface>
This is so called SLIRP. In this case it's QEMU who assigns IP
addresses. It's not really host visible networking, i.e. host does not
"see" packets between guest and the host. QEMU process sends packets on
the guest's behalf.
```
However, the one created via virt-manager has this:
```xml
<interface type="network">
<mac address="52:54:00:5d:c7:9e"/>
<source network="default"/>
<model type="virtio"/>
<address type="pci" domain="0x0000" bus="0x01"
slot="0x00"
function="0x0"/>
</interface>
```
This uses a bridge created by libvirt and then libvirt spawned dnsmasq
to do DHCP. I'd check whether dnsmasq process is running and whether
there's <dhcp/> section in the 'default' network XML:
https://libvirt.org/formatnetwork.html#nat-based-network
Also, make sure you don't have any (aggressive) firewall rules set which
would prevent guest from talking to dnsmasq.
What I'm not able to understand is, why does the |user| mode
networking
work fine but not |network| mode?
My ultimate goal is to set up |routed| configuration, so one can
directly SSH into the guests.
Routed mode is a bit tricky to set up as you have to manually configure
routing table.
Michal