-netdev user: guestfwd doesn't work
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Hello!
QEMU emulator version 2.6.1 (Debian 1:2.6.1+
The IP address 192.168.1.46 is assigned to eth0.
qemu-system-x86_64 \
-no-hpet \
-nodefconfig \
-machine accel=kvm \
-cpu host \
-smp 2 \
-drive if=virtio,
-device virtio-
-netdev 'user,id=
-m 1024 \
-initrd yakkety-
-kernel yakkety-
-append 'root=/dev/vda1 modprobe.
Without the guestfwd=... part everything works nicely. With it I get the following message.
qemu-system-x86_64: -netdev user,id=
qemu-system-x86_64: -netdev user,id=
But I just compiled c640f2849ee8775
pas@strange:
qemu-system-x86_64: -net user,guestfwd=
qemu-system-x86_64: -net user,guestfwd=
After poking a bit around it seems that this check fails in slirp/slirp.c: (around line 1074)
if ((guest_
return -1;
}
Because guest_addr, and slirp has equivalent s_addr values.
x86_64-
guest_addr: 12.0.0.2
vnetwork_mask: 12.0.0.2
vhost_addr: 12.0.0.2
vnameserver_addr: 12.0.0.2
guest_addr & mask: 12.0.0.2
Thanks in advance for looking into this!
summary: |
- -netdev user: guestfwd doesn't work (and the error message is useless) + -netdev user: guestfwd doesn't work |
Changed in qemu: | |
status: | New → Invalid |
Not sure whether this is really a bug or working as intended - but apparently, the server IP address from the guest point of view (before the NAT) has to be in the same subnet as the guest itself. So everything should work fine if you use something like this in your first example:
-netdev 'user,id= net0,hostfwd= tcp::2222- :22,guestfwd= tcp:10. 0.2.200: 1234-cmd: nc 192.168.1.46 8842'
(i.e. just replace the 1.2.3.4 with 10.0.2.200)