I am running Ubuntu Server 18.04 on qemu.

Here is the command I execute to launch the machine:

qemu-system-x86_64 \
  -cdrom ubuntu- \
  -drive file=ubuntu-18.04-server-amd64.img.qcow2,format=qcow2 \
  -m 4G \
  -smp 2 \
  -net nic,addr=0x10
  -vga virtio \

I am trying to expose an IP from the qemu machine which is accessible my host machine, but qemu is only showing me a local IP which is How can I change this?

1 Answer 1


One way to go would be to declare "user mode" host networking, and use forwarding of certain host ports to guest ports. For instance, the qemu command line might have the following additional declaration:

-net user,hostfwd=tcp::10022-:22

That declaration links up the guest for "user mode" networking, where it basically shares the host's interface for Internet access, and in addition (by the hostfwd=... part), provides forwarding for incoming or local tcp connections on host port 10022 to be forwarded to guest port 22.

The user mode networking is a simple choice for many use cases.

See also man qemu-system-x86 for additional host side methods (such as tap and bridge), as well as online documentation, e.g., Qemu Network Options

  • Thanks, from the host machine, I am trying to access a file that is hosted on the nginx of qemu machine. on the qemu machine I can access a file via localhost/myfile so it's basically on port 80 of the qemu machine.
    – Benjamin
    Dec 19, 2018 at 13:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .