4

I don't know if I am on the right forum but here's my issue :

I have installed a guest Debian Sparc64 with QEMU on a MacOS 10.9.5. I try to get ssh access between host and guest, without success.

I want to find a simple solution. From what I have seen, I launch Sparc64 with following options :

qemu-system-sparc64 -hda debian_sparc64.img -m 2048 -net nic -net user,hostfwd=tcp::2222-:22 -nographic

Then, I try to connect to guest from my MacOS host with :

ssh -p 2222 localhost

Unfortunately, the above command doesn't ask a password, it stays locked.

If someone could see what's wrong, this would be fine to let me know.

Regards

UPDATE 1:

When QEMU VM is running,

here are the results, on MacOS host, of :

nmap localhost -p 22

Starting Nmap 6.47 ( http://nmap.org ) at 2017-09-16 22:44 CEST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000097s latency).
PORT   STATE SERVICE
22/tcp open  ssh

and the results, also on MacOS host, of :

nmap localhost -p 2222

Starting Nmap 6.47 ( http://nmap.org ) at 2017-09-16 22:45 CEST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00012s latency).
PORT     STATE SERVICE
2222/tcp open  EtherNet/IP-1

I forgot to say that QEMU image used ( debian 9.0 Sparc64 guest) has not by default "SSH server" running on it, as it is showed with this command under root :

# ps aux | grep ssh 
root       299  0.0  0.0   7168  1952 ttyS0    S+   22:51   0:00 grep ssh

I have nethertheless "SSH Client" (I mean the "ssh" command), but I don't know how to connect to MacOS host from the Debian Sparc64 guest.

The problem is that I can't install others packages than ones provided by Debian-Sparc64 QEMU image because I have not the network on this guest ( i.e I can't use apt-get install ).

If anyone could see how to circumvent this issue ?

Surely it would be necessary to install networking (port 80) on guest but with a MacOS host, it seems to be difficult, with bridging and virtual interfaces ...

Any help is welcome

UPDATE 2:

From @Stefan M's advices, after installing Squid, I tried to use guestfwd option by launching this way :

  qemu-system-sparc64 -hda debian_sparc64.img -m 2048 -net user,guestfwd=tcp::3128-:3128 -nographic

and I get the following error :

qemu-system-sparc64: -net user,guestfwd=tcp::3128-:3128: could not open guest forwarding device 'guestfwd.tcp.3128'
qemu-system-sparc64: -net user,guestfwd=tcp::3128-:3128: Device 'user' could not be initialized

Could you tell me what I have to do (results got with MacOS 10.9.5) ?

UPDATE 3:

I have found a tutorial on this link. Following this page, I did :

  1. First Installed TUN/TAP drivers to bridge the NIC from the VM to my OS X host

  2. launched QEMU with :

qemu-system-sparc64 -hda debian_sparc64.img -m 2048 -net nic -net tap,script=no,downscript=no -nographic

  1. Once QEMU has booted, I run into other terminal on Host (MacOS 10.9.5) : ifconfig tap0 192.168.1.21

Indeed, my local network uses 192.168.1.x IP.

  1. Into /etc/network/interfaces of guest Debian Sparc64, I have set :

auto eth0 iface eth0 inet static address 192.168.1.20 netmask 255.255.255.0 gateway 192.168.1.21

Unfortunately, I can't get SSH access from MacOS host to Guest or from Guest to MacOS host (by doing for example : "ssh [email protected]" from host), even by launching qemu-system-sparc64 with root.

If someone could see what's wrong.

Regards

3
  • 1
    Is the SSH daemon actually running on the Debian host?
    – Kusalananda
    Sep 16, 2017 at 19:34
  • @Kusalananda it is a real problem, the image that I use has no SSH server package installed and I have no networking, so impossible to install it with apt-get install . I don't know what to do
    – youpilat13
    Sep 16, 2017 at 21:06
  • This question helped me get my vm up and working with ssh thanks! What I need to do to get it working was add PermitRootLogin yes to /etc/ssh/sshd_config before I could login. I don't normally allow ssh login with root, but this was a burner vm and I just wanted to get it to work.
    – Kuberchaun
    Sep 13, 2021 at 18:28

1 Answer 1

3

Please try first whether the host is reachable at all. This can easily be done using nmap. For your case this should suffice:

nmap localhost -p 22

If it says that the port is open, you should look into the sshd on the guest. If it is filtered, maybe a firewall-issue on your guest (incoming) or your host (outgoing/incoming from local).

On the update:

Simply put, you have two choices:

1) Use bridged networking for example as described in here, that way you can install the sshd.

2) Use guestfwd. As you already established a connection (port forwarding) via qemu in one direction, you can easily do the same the other way around:

  • Install a proxy on your host (squid, tinyproxy, whatever)
  • Point the guest to your proxy: (below untested part of your command):

guestfwd=tcp::3128-:3128

  • Last, but not least: Use http_proxy for the apt commands or set the variable system-wide.

When you finally have the sshd running, you should be able to connect to the guest system via ssh.

On the second update:

If I understand the documentation correctly, you should give the IP-Adresses along as well. My guess is that you try to forward the port to the same host (possibly from guest to guest).

guestfwd=[tcp]:server:port-dev

Forward guest TCP connections to the IP address server on port port to the character device dev

So it should be something along this:

guestfwd=tcp:10.0.2.100:3128-tcp:10.10.1.1:3128

This would send all connects on the port 3128 from the guest to IP 10.10.1.1 to 10.0.2.100.

2
  • -@Stefan M . Can you take a look on my last results into UPDATE 2 please ?
    – youpilat13
    Sep 25, 2017 at 16:51
  • -@Stefan M. Thanks for your answer. Nethertheless, I would like to know how choosing correct IP's in your last command "guestfwd=tcp:10.0.2.100:3128-tcp:10.10.1.1:3128" : with this range that you suggest, it doesn't work. I tried also with "-net user,guestfwd=tcp:127.0.0.1:3128-tcp:10.10.1.1:3128" and "-net user,guestfwd=tcp:127.0.0.1:3128-tcp:10.10.1.1:3128" but without success. Have I to install Squid on guest too (here a debian 9 Sparc 64) ??
    – youpilat13
    Sep 30, 2017 at 16:41

You must log in to answer this question.

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