sparc-solaris networking not working

2020-06-19 Thread Michele Denber

I started my virtual SparcStation 5 like this:

$ qemu-system-sparc -nographic -bios ss5.bin -m 32 -rtc
base="1999-04-19" -hda sunos414.img -net nic,model=lance -net
user,hostfwd=tcp::4422-:22,hostfwd=tcp::4423-:23


following the recommendation here:
https://stackoverflow.com/questions/53315086/transferring-file-to-virtual-machine-qemu-using-tcp-port--not-working


But when the guest starts, I can't access my LAN (192.168.0.x).

sunss5 login: root
Apr 18 19:09:07 sunss5 login: ROOT LOGIN console
Last login: Sun Apr 18 19:00:45 on console
SunOS Release 4.1.4 (GENERIC) #2: Fri Oct 14 11:09:47 PDT 1994
sunss5# ping 192.168.0.1
^Csunss5# ping 10.0.2.2
10.0.2.2 is alive
sunss5# ping 192.168.0.2
^Csunss5# ifconfig -a
le0: flags=63
inet 10.0.2.15 netmask ff00 broadcast 10.0.0.0
ether 52:54:0:12:34:56
lo0: flags=49
inet 127.0.0.1 netmask ff00
sunss5# cat /etc/hosts
#
# Sun Host Database
#
# If the NIS is running, this file is only consulted when booting
#
127.0.0.1localhost
#
10.0.2.15sunss5 loghost
sunss5#
sunss5# cat /etc/defaultrouter
10.0.2.2
sunss5# netstat -r
Routing tables
Destination  Gateway  FlagsRefcnt Use
Interface
localhostlocalhostUH   1 171lo0
default  10.0.2.2 UG   0 18 le0
arpanet  sunss5   U2 83 le0
sunss5#

And in the Ubuntu host:
$ netstat -tulpn | grep qemu
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp0  0 0.0.0.0:4422 0.0.0.0:*   LISTEN
19688/qemu-system-s
tcp0  0 0.0.0.0:4423 0.0.0.0:*   LISTEN

The funny thing is that if I start ftp to a machine on the LAN, it will
connect OK but I can't transfer any files (it just hangs when I do a PUT).

sunss5# ftp 192.168.0.78
Connected to 192.168.0.78.
220 avon FTP server ready.
Name (192.168.0.78:root):
...

Or even ftp to the ubuntu host doesn't work

sunss5# ftp
ftp> op
(to) 10.0.2.2
Connected to 10.0.2.2.
220 (vsFTPd 3.0.3)
Name (10.0.2.2:root): ftpuser
331 Please specify the password.
Password:
230 Login successful.
ftp> bin
200 Switching to Binary mode.
ftp> put
(local-file) libsuntool.so.0.54
(remote-file) libsuntool.so.0.54
500 Illegal PORT command.
425 Use PORT or PASV first.
ftp> quote PASV
227 Entering Passive Mode (127,0,0,1,39,26).
ftp> put
(local-file) libsuntool.so.0.54
(remote-file) libsuntool.so.0.54
500 Illegal PORT command.
ftp>


What am I doing wrong here?

- Michele




Re: sparc-solaris networking not working

2020-06-19 Thread Peter Maydell
On Fri, 19 Jun 2020 at 22:24, Michele Denber  wrote:
>
> I started my virtual SparcStation 5 like this:
>
> $ qemu-system-sparc -nographic -bios ss5.bin -m 32 -rtc base="1999-04-19" 
> -hda sunos414.img -net nic,model=lance -net 
> user,hostfwd=tcp::4422-:22,hostfwd=tcp::4423-:23
>
>
> following the recommendation here: 
> https://stackoverflow.com/questions/53315086/transferring-file-to-virtual-machine-qemu-using-tcp-port--not-working
>
> But when the guest starts, I can't access my LAN (192.168.0.x).
>
> sunss5 login: root
> Apr 18 19:09:07 sunss5 login: ROOT LOGIN console
> Last login: Sun Apr 18 19:00:45 on console
> SunOS Release 4.1.4 (GENERIC) #2: Fri Oct 14 11:09:47 PDT 1994
> sunss5# ping 192.168.0.1
> ^Csunss5# ping 10.0.2.2
> 10.0.2.2 is alive
> sunss5# ping 192.168.0.2

Ping does not work with user-mode networking; don't try to use
it to see whether networking works or not, because it will
mislead you.

> The funny thing is that if I start ftp to a machine on the LAN, it will 
> connect OK but I can't transfer any files (it just hangs when I do a PUT).
>
> sunss5# ftp 192.168.0.78
> Connected to 192.168.0.78.
> 220 avon FTP server ready.
> Name (192.168.0.78:root):
> ...

ftp is a weird protocol that by default requires the
server to connect back to the client. This will not work
via user-mode networking, because the outside world
can't connect into the guest (unless you set up specific
port-forwarding). In theory PASV mode ought to work
(but see below).

You can see that the guest has successfully connected
because it's received the 220 response string back,
so networking is basically functional.

> Or even ftp to the ubuntu host doesn't work
>
> sunss5# ftp
> ftp> op
> (to) 10.0.2.2
> Connected to 10.0.2.2.
> 220 (vsFTPd 3.0.3)
> Name (10.0.2.2:root): ftpuser
> 331 Please specify the password.
> Password:
> 230 Login successful.
> ftp> bin
> 200 Switching to Binary mode.
> ftp> put
> (local-file) libsuntool.so.0.54
> (remote-file) libsuntool.so.0.54
> 500 Illegal PORT command.
> 425 Use PORT or PASV first.
> ftp> quote PASV
> 227 Entering Passive Mode (127,0,0,1,39,26).

I think here that PASV mode has failed because you're trying
to connect to an ftp server on the host machine. To the ftp
server, the guest in the VM looks like it's connecting
to localhost (127.0.0.1), so the server says "OK, the
data port you should use for PASV is 127.0.0.1:10010".
But when that gets back to the guest FTP client, it tries
to connect to 127.0.0.1 which is the guest VM's loopback.
PASV to some other host ought to work; PASV to the VM host's
actual IP address on 192.168.x.x (ie not to the 10.0.2.2
magic address that says "give me localhost on the host")
might work.

> What am I doing wrong here?

You've had the bad luck to pick two things (ping and ftp)
which are weird and complicated in ways that user-mode
networking can't handle. Try something simpler, like HTTP
or SSH. (You might also consider bridge-mode networking
if user-mode's deficiencies are deal-breakers for you,
but be aware that it is a lot more complicated to set up.)

thanks
-- PMM



Re: sparc-solaris networking not working

2020-06-20 Thread Michele Denber

On 06-19-2020 6:08 PM, Peter Maydell wrote:

Ping does not work with user-mode networking; don't try to use
it to see whether networking works or not, because it will
mislead you.

Oh!  That's good to know.  I guess I was misled by this page:
https://en.wikibooks.org/wiki/QEMU/SunOS_4.1.4 where it says

"We can even check with the ping command from the guest that the host is
alive:

# ping 10.0.2.2
10.0.2.2 is alive"



You can see that the guest has successfully connected
because it's received the 220 response string back,
so networking is basically functional.

Which is why I can't figure out why I'm not getting files to transfer.
Some things work fine.  Like I can telnet from the host to the guest:

$ telnet localhost 4423

But I can't transfer files with telnet.

... PASV to the VM host's
actual IP address on 192.168.x.x (ie not to the 10.0.2.2
magic address that says "give me localhost on the host")
might work.

Unfortunately, that doesn't work either.  It does create the file on the
destination but it is zero-length and no data ever gets transferred.
I've tried it with a bunch of different ftp servers, on Solaris 10,
Solaris 11, Win 7, Win XP, Raspberry Pi, and Android.

sunss5# ftp
ftp> op 192.168.0.78
Connected to 192.168.0.78.
220 avon FTP server ready.
Name (192.168.0.78:root): denber
331 Password required for denber.
Password:
230 User denber logged in.
ftp> bin
200 Type set to I.
ftp> quote PASV
227 Entering Passive Mode (192,168,0,78,170,250)
ftp> put
(local-file) libsuntool.so.0.54
(remote-file) libsuntool.so.0.54
502 Illegal PORT Command
^C
^Z
Stopped
sunss5#


You've had the bad luck to pick two things (ping and ftp)
which are weird and complicated in ways that user-mode
networking can't handle. Try something simpler, like HTTP
or SSH.

Unfortunately, Solaris 1.1 does not have ssh.  It also doesn't have
curl, so http is out too.  It does have rcp but that doesn't work either:
sunss5# rcp libsuntool.so.0.54
192.168.0.78:/export/home/denber/libsuntool.so.0.54
192.168.0.78: unknown host
sunss5#

But this rcp, from the Ubuntu host to the SunOS guest /almost /works:

~$ sudo rcp localhost:/lib/libsuntool.so.0.54 .
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is SHA256:dxNOCRlyR2qzbIqbIyxmFKQ+9UnBTXonCIo2LTByJXc.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
root@localhost's password:
Permission denied, please try again.


Nor does rlogin:
sunss5# rlogin 192.168.0.78
192.168.0.78: unknown host
sunss5# rlogin 10.0.2.2
10.0.2.2: unknown host

Or rsh:
sunss5# rsh -n 192.168.0.78 ls
192.168.0.78: unknown host

I also don't have netcat or wget.  I'm about out of ideas here.  I just
want to transfer a few files off the guest.

  (You might also consider bridge-mode networking
if user-mode's deficiencies are deal-breakers for you,
but be aware that it is a lot more complicated to set up.)

Is that the section in https://en.wikibooks.org/wiki/QEMU/SunOS_4.1.4
called "Using a TAP Device"?

- Michele