How do I setup ssh from the host to the guest using qemu? I am able to use port redirection when I boot the VM without any special parameters, as follows:
/usr/bin/qemu-system-x86_64 -hda ubuntu1204 -m 512 -redir tcp:7777::8001
But when I try to boot using the following:
/usr/bin/qemu-system-x86_64 \
-m 1024 \
-name vserialtest \
-hda ubuntu1204 \
-chardev socket,host=localhost,port=7777,server,nowait,id=port1-char \
-device virtio-serial \
-device virtserialport,id=port1,chardev=port1-char,name=org.fedoraproject.port.0 \
-net user,hostfwd=tcp:7777::8001
I get the following error and the VM does not boot:
qemu-system-x86_64: -net user,hostfwd=tcp:7777::8001: invalid host
forwarding rule 'tcp:7777::8001'
qemu-system-x86_64: -net user,hostfwd=tcp:7777::8001: Device 'user'
could not be initialized
Please note that I am able to boot the VM without the -net
parameter
without any issues, however, I want to setup ssh from the host to the
guest. ssh from guest to host works fine as expected.
Edit
I have tried using
-net user,hostfwd=tcp::7777-:8001
as well as
-net user,hostfwd=tcp::7777:8001
but still the error persists and the VM does not boot.