Hello, i am trying to create a couple of fedora 40 server vms using my host installation of fedora 40 server. I cannot access the cockpit of my vms when i use the default virtual network created by my host machine. I am using the cockpit machines gui to manage the vms. I also tried to create bridges and vlan so that i can have my vms on a different subnet as like my host is on 192.168.29.xx and i want my vms to be 192.168.100.xx and so on. I have tried following a couple of tutorials but none of those have worked so far. If anyone can suggest me how to properly configure this i would be very grateful. Thank you in advance.
It sounds like you have a problem with the virtual network configuration.
Let’s check your setup:
sudo virsh net-list --all
sudo virsh list --all
Hi here is the output:
sudo virsh net-list --all
sudo virsh net-dumpxml NET_NAME
sudo virsh list --all
sudo virsh dumpxml VM_NAME --xpath //interface
Name State Autostart Persistent
--------------------------------------------
default active yes yes
error: failed to get network 'NET_NAME'
error: Network not found: no network with matching name 'NET_NAME'
Id Name State
----------------------
2 next running
error: failed to get domain 'VM_NAME'
I did a fresh reinstall just in case and yeah i still cannot access the vm using deafault connection. I can ping normally from host and also ssh works, just the cockpit web panel never shows up.
sudo virsh net-dumpxml default
sudo virsh dumpxml next --xpath //interface
<network connections='1'>
<name>default</name>
<uuid>bc7a9d2b-aceb-4166-b988-6d7ac0bb4dad</uuid>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address='REDACTED'/>
<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>
<interface type="network">
<mac address="REDACTED"/>
<source network="default" portid="49dc71f9-6f0d-42ac-92d0-4ac10c0504aa" bridge="virbr0"/>
<target dev="vnet1"/>
<model type="virtio"/>
<alias name="net0"/>
<address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</interface>
Also just to be sure that the problem is not limited to cockpit i ran portainer using docker and it also does not show up.
This seems like a problem in the default configuration maybe? Even a fresh installayion and starting a fresh vm with default virtual network is not allow cockpit and web services for some reason.
Your guest network configuration looks correct.
But there’s a known issue related to the virtual networking service:
Virsh not detecting devices properly - #2 by vgaetera
Hi i did the command below and did a reboot but the issue still persists.
sudo systemctl --now enable virtnetworkd.service
Also the xml output of
sudo virsh net-dumpxml default
sudo virsh dumpxml next --xpath //interface
is same as before
Make sure you have installed all the necessary host packages:
sudo dnf install \
cockpit \
cockpit-machines \
libvirt-daemon-driver-interface \
libvirt-daemon-driver-network \
libvirt-daemon-driver-nodedev \
libvirt-daemon-driver-qemu \
libvirt-daemon-driver-storage-core \
qemu-audio-spice \
qemu-char-spice \
qemu-device-display-qxl \
qemu-device-display-virtio-gpu \
qemu-device-display-virtio-vga \
qemu-device-usb-redirect \
qemu-system-x86-core
Package cockpit-321-1.fc40.x86_64 is already installed.
Package cockpit-machines-315-1.fc40.noarch is already installed.
Package libvirt-daemon-driver-interface-10.1.0-3.fc40.x86_64 is already installed.
Package libvirt-daemon-driver-network-10.1.0-3.fc40.x86_64 is already installed.
Package libvirt-daemon-driver-nodedev-10.1.0-3.fc40.x86_64 is already installed.
Package libvirt-daemon-driver-qemu-10.1.0-3.fc40.x86_64 is already installed.
Package libvirt-daemon-driver-storage-core-10.1.0-3.fc40.x86_64 is already installed.
Package qemu-audio-spice-2:8.2.2-1.fc40.x86_64 is already installed.
Package qemu-char-spice-2:8.2.2-1.fc40.x86_64 is already installed.
Package qemu-device-display-qxl-2:8.2.2-1.fc40.x86_64 is already installed.
Package qemu-device-display-virtio-gpu-2:8.2.2-1.fc40.x86_64 is already installed.
Package qemu-device-display-virtio-vga-2:8.2.2-1.fc40.x86_64 is already installed.
Package qemu-device-usb-redirect-2:8.2.2-1.fc40.x86_64 is already installed.
Package qemu-system-x86-core-2:8.2.2-1.fc40.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
@vgaetera If its possible could you try this on a machine you have? Installing fedora 40 server and then creating a vm using the host. I have tried to fix this for 4 days now but to no avail…
I have tested virtualization in Cockpit on a Fedora 40 host and it works for me.
However note that Cockpit requires creating VMs in system mode with administrative access in order to connect guests to a virtual bridge.
We need more details about the problem:
- What specific step fails for you?
- What is the error message?
It does not work for me in the sense i do not get any specific error messages by cockpit, i do get a ip assigned different from my host machine when using the default vitual network but i cannot open cockpit of the vm when i visit cockpit of the vm. Like my host is on 192.168.29.10 but vm is on 192,168.120.208, do i need to specify any routing? Also is your virtual network on the same subnet as host?
Make sure you use this:
- Cockpit: Administrative access
- Create new virtual machine > Connection: System
Navigate to “VM > Network interfaces > Edit” and verify:
- Interface type: Virtual network
- Source: default
The guest should get an IP from the your default virtual network:
You can access the guest like this:
- Connect to the Cockpit of your virtualization server.
- Attach the guest by its IP using the “Add new host” dialogue.
I configured a setup similar to yours with nested virtualization.
My main setup is more complicated combining multiple virtual networks with different routing methods.
I have done the above steps exactly like this.
You can access the guest like this:
Connect to the Cockpit of your virtualization server. Attach the guest by its IP using the “Add new host” dialogue.
I cannot visit the cockpit of my vm server still after doing the above and there is “Add new host” for physical devices did you meant to say to add a network host?
Please don’t confuse a virtualization server with a virtual machine.
- Virtualization server - the host running libvirt services.
- Virtualization client - the host running virsh.
- Virtual machine (VM) - the guest system.
The virtualization server and client are usually the same host.
Each Cockpit instance can work as a proxy to connect to other Cockpit instances.
Click the button in the top left corner that looks like this:
It should expand a menu with the “Add new host” button.
The “Add new host” dialogue looks like this:
- Host:
192.168.122.123
- IP address from the guest console - User name:
admin
- user configured during the guest installation
If this fails, then collect the resulting error message.
Hi i can access cockpit now but i cannot have any webservices like portainer up and visit them, i cannot seem to visit them using my browser.
I did managed to my host vm and can access the cockpit of my vm, what i cannot do is use my browser and visit webservices on 192.168.122.123 like portainer, that includes accessing cockpit of the vm directly using my browser instead of adding a host.
My host fedora server is on a different subnet (by the default virtual network the connection gets assigned to a different subnet) than the vm but i am access it through the same network connection.
I run the client browser and libvirt services on the same host, so it works for me.
If this is different for you, then the virtual network configuration should be changed.
Use “open” or better “routed” forward mode if you want to provide isolation and traffic filtering with firewall rules, otherwise a shared host bridge is the preferred option.
Note that the “open” and “routed” modes require adding a static route on the LAN router to the virtual network via the IP of the virtualization server.