Re: ssh from host to guest using qemu to boot VM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 04/15 15:49, Jobin Raju George wrote:
> Adding "-net nic" to the end of the booting command, I am able to
> connect to the internet now and have 10.0.2.15 as the IP address, but
> still
> 
> ssh username@10.0.2.15
> 
> returns
> 
> ssh: connect to host 10.0.2.15 port 22: Connection timed out

Ugh, you totally missed it, neither 10.0.2.15 nor 22 is in ssh's business.

Should be something like, depending on your hostfwd port:

    ssh username@127.0.0.1 -p 7777

Fam

> 
> 
> On Tue, Apr 15, 2014 at 2:25 PM, Fam Zheng <famz@xxxxxxxxxx> wrote:
> > On Tue, 04/15 14:03, Jobin Raju George wrote:
> >>  Yes, you were right, the port 7777 was already being used when I was doing:
> >>
> >>
> >> -chardev socket,host=localhost,port=7777,server,nowait,id=port1-char \
> >>
> >> However, even after using a unix socket for this socket as:
> >>
> >> -chardev socket,path=/tmp/g2g,server,nowait,id=port1-char
> >>
> >> the VM has booted giving a warning at the host console: Warning: vlan 0
> >> with no nics but when I do ifconfig on the guest I see only lo and I still
> >> get ssh: connect to host 10.0.2.15 port 22: Connection timed out when I try
> >> to ssh; the IP I used to ssh is 10.0.2.15, which according to man
> >> qemu-system-x86_64 is the IP assigned to the first VM booted if static IP
> >> is not assigned. And now there is no internet connection on the guest.
> >
> > That means you have to create a device. Add an "-net nic".
> >
> > Fam
> >
> >>
> >>
> >> On Mon, Apr 14, 2014 at 6:15 PM, Fam Zheng <famz@xxxxxxxxxx> wrote:
> >>
> >> > On Mon, 04/14 17:36, Jobin Raju George wrote:
> >> > > I retried using:
> >> > >
> >> > > /usr/bin/qemu-system-x86_64 \
> >> > > -m 1024 \
> >> > > -name vserialtest \
> >> > > -cdrom ubuntu-12.04-desktop-amd64.iso -hda ubuntu1204-virtio-serial \
> >> > > -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:127.0.0.1:7777-:8001
> >> > >
> >> > > but get the following:
> >> > >
> >> > > qemu-system-x86_64: -net user,hostfwd=tcp:127.0.0.1:7777-:8001: could
> >> > > not set up host forwarding rule 'tcp:127.0.0.1:7777-:8001'
> >> > > qemu-system-x86_64: -net user,hostfwd=tcp:127.0.0.1:7777-:8001: Device
> >> > > 'user' could not be initialized
> >> > >
> >> > >
> >> > > Also tried:
> >> > >
> >> > > -net user,hostfwd=tcp::7777-:8001
> >> > >
> >> > > but get the following error:
> >> > >
> >> > > qemu-system-x86_64: -net user,hostfwd=tcp::7777-:8001: could not set
> >> > > up host forwarding rule 'tcp::7777-:8001'
> >> > > qemu-system-x86_64: -net user,hostfwd=tcp::7777-:8001: Device 'user'
> >> > > could not be initialized
> >> >
> >> > Is the port busy? What does "netstat -ltn" say?
> >> >
> >> > Fam
> >> >
> >> > >
> >> > >
> >> > > On Mon, Apr 14, 2014 at 5:31 PM, Fam Zheng <famz@xxxxxxxxxx> wrote:
> >> > > > On Mon, 04/14 17:14, Jobin Raju George wrote:
> >> > > >> Hey!
> >> > > >>
> >> > > >> How do I setup ssh from the host to the guest using qemu?
> >> > > >>
> >> > > >> 1) I am able to use port redirection when I boot the VM without any
> >> > > >> special parameter(explained in point 2) as follows:
> >> > > >>
> >> > > >> /usr/bin/qemu-system-x86_64 -hda ubuntu1204 -m 512 -redir
> >> > tcp:7777::8001
> >> > > >>
> >> > > >> 2) But when I try to boot using the following
> >> > > >>
> >> > > >> /usr/bin/qemu-system-x86_64 \
> >> > > >> -m 1024 \
> >> > > >> -name vserialtest \
> >> > > >> -cdrom ubuntu-12.04-desktop-amd64.iso \
> >> > > >> -hda ubuntu1204-virtio-serial \
> >> > > >> -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
> >> > > >
> >> > > > Format:
> >> > > >     hostfwd=[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport
> >> > > >
> >> > > > Try:
> >> > > >
> >> > > >     -net user,hostfwd=tcp::7777-:8001
> >> > > >
> >> > > > Fam
> >> > > >
> >> > > >>
> >> > > >> 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.
> >> > > >>
> >> > > >> --
> >> > > >>
> >> > > >> Thanks and regards,
> >> > > >> Jobin Raju George
> >> > > >> Final Year, Information Technology
> >> > > >> College of Engineering Pune
> >> > > >> Alternate e-mail: georgejr10.it@xxxxxxxxxx
> >> > > >> --
> >> > > >> To unsubscribe from this list: send the line "unsubscribe kvm" in
> >> > > >> the body of a message to majordomo@xxxxxxxxxxxxxxx
> >> > > >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >> > >
> >> > >
> >> > >
> >> > > --
> >> > > Thanks and regards,
> >> > >
> >> > > Jobin Raju George
> >> > >
> >> > > Final Year, Information Technology
> >> > >
> >> > > College of Engineering Pune
> >> > >
> >> > > Alternate e-mail: georgejr10.it@xxxxxxxxxx
> >> > > --
> >> > > To unsubscribe from this list: send the line "unsubscribe kvm" in
> >> > > the body of a message to majordomo@xxxxxxxxxxxxxxx
> >> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >> >
> >>
> >>
> >>
> >> --
> >>
> >> Thanks and regards,
> >>
> >> Jobin Raju George
> >>
> >> Final Year, Information Technology
> >>
> >> College of Engineering Pune
> >>
> >> Alternate e-mail: georgejr10.it@xxxxxxxxxx
> 
> 
> 
> -- 
> Thanks and regards,
> 
> Jobin Raju George
> 
> Final Year, Information Technology
> 
> College of Engineering Pune
> 
> Alternate e-mail: georgejr10.it@xxxxxxxxxx
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux