QEMU NixOs installation no internet connection

Hi. Sorry for a newbie question.
I’m trying to install NixOS on a qemu kvm virtual machine. My host operating system is Linux Mint.

  • I’ve downloaded an iso file nixos-minimal-24.05.4090.224042e9a303-x86_64-linux
  • created a vm file using
    qemu-img create -f qcow2 nixos.img 40G
  • launched a vm
    qemu-system-x86_64 -enable-kvm -m 4G -cdrom ~/Downloadsnixos-minimal-24.05.4090.224042e9a303-x86_64-linux.iso -drive file=nixos.img,format=qcow2 -boot d
    also tried with -net nic -net user

The system starts and I can start an installation but I’m facing internet connection issues.
The ip address was assigned and the interface is up.
I’m using a wired connection.


But when I try to ping anything it doedn’t work

I’ve googled and it seems like the connection should work out of the box in qemu.
Looking for some help with that.
Thanks in advance.

*My main (host) operating system is: *

  • Kernel: 6.8.0-41-generic arch: x86_64 bits: 64 compiler: gcc v: 13.2.0*
  • Desktop: Cinnamon v: 6.2.9 tk: GTK v: 3.24.41 wm: Muffin dm: LightDM*
  • Distro: Linux Mint 22 Wilma base: Ubuntu 24.04 noble*

Easier these days to use Distrobox. (& Box Buddy)

1 Like

Hi there,
I use virtmanager/libvirtd for running a standard nixos VM with an Debian host. Qemu will probably setup a virtual network for your VM and is not connected to your machine or internet. If you could provide some host network information, that would help to analyze or solve the question.

One way to do this is to setup a bridge, as I did, on the host and connect the VM to that bridge. You have to provide a mac address to the vm and an entry for a dhcp server in your network.

1 Like

Thanks for the advice! I’d setup up a bridge and it started working.
There are different ways of doing that.
Creating a netplan config, using brctl, ip command.
I’ve found the most simple way here Really Simple Network Bridging With qemu | spad.uk