PDP-10 / klh10

Community maintained version of Kenneth L. Harrenstien's PDP-10 emulator.
Other
59 stars 7 forks source link

Question: How to setup networking #65

Closed oilcan-productions closed 2 years ago

oilcan-productions commented 2 years ago

I am running ITS from this repo https://github.com/PDP-10/its My home network is 192.168.0.0/24 I have built and installed on a Raspberry Pi 4 with wired Ethernet, Static IP 192.168.1.223. I also reserve 192.168.1.45 on the router to make sure it does not get handed out by DHCP. When I SSH into the Pi I cannot Ping or FTP to 192.168.1.100 or ping 192.168.0.45 once ITS is running.

Is there any other step I am missing? I also tried setting the gateway to .223 but that did not work either.

Any help would be appreciated Mike

larsbrinkhoff commented 2 years ago

Hello,

It seems from your information you have already read https://github.com/PDP-10/its/blob/master/doc/networking.md#klh10 , correct? The gist of it is that ITS should respond to 192.168.1.100.

You may need to do echo 1 > /proc/sys/net/ipv4/ip_forward

@eswenson1, any insights?

Rhialto commented 2 years ago

When connecting a virtual machine (such as klh) to the Internet, there are basically two ways of going about it: routed or bridged (one could call it unrouted).

The bridged approach was traditionally done with BPF (Berkeley Packet Filter). It sends and receives Ethernet frames. BPF is a "listening in" method on a chosen network interface. More recently this method has been abstracted somewhat with the pcap library (IFMETH=pcap). There is also a library called VDE (virtual device ethernet) which sets up virtual ethernet switches and networks (IFMETH=vde). There is also another convenient method where a virtual "tap" interface is created (which you can see in the host's list of network interfaces), plust a "virtual cable" which the VM can connect to and send/receive frames. The tap interfaceis bridged to the interface connected to your LAN (IFMETH=tap+bridge). A "bridge" is basically a repeater: everything it sees on one side, it repeats to the other side (whether the other side will want to see them or not). This way the VM will see everything that's going on in the LAN. The big advantage of the tap+bridge method is that it generally can be set up before the VM is started, and then doesn't need root privileges any more.

The routed method generally involves using a dedicated interface; usually a virtual one (or sometimes a real physical interface with no cables). This dedicated interface is connected to the outside world by setting up routing. This means that only packets with the correct destination address will be sent there. This has the advantage that the receiver will have less work filtering out the stuff it doesn't want to see. Again, the VM can connect to this dedicated interface in various ways. pcap and tap make sense (if is a tap interface), but not tap+bridge (that would create another tap interface plus a bridge; it should be able to work but is needlessly complicated). IFMETH=tun is a variant that works on IP level (or at least: a protocol level above Ethernet) and would be suitable for getting data in and out of an IMP. A trun interface can also be set up beforehand.

I am not sure if this is explicit enough in the documentation. Maybe we should add it somewhere.

In retrospect, I made the mistake in klh that it sets up too much of these things for you. They differ annoyingly between different Unix systems which makes the code extra complicated. It would be simpler to tell the user to use some ifconfig and/or route commands to set up most of it beforehand (or to include these in the klh config file as shell escapes or something). That makes it a lot easier to work with all possible networking variants that people could want.

oilcan-productions commented 2 years ago

Thanks for the explanations. All make sense. What are the assumptions made in the ITS build in terms of networking setup in terms of configuration, MAC addresses, interface setup etc.? I think at this point it is safe to assume that I have forgotten more about ITS than I remember, and I am running up a steep learning curve at this point trying to catch up with everything that happened since ca. 1982 when I last looked at ITS.

Thanks for your help

Mike

oilcan-productions commented 2 years ago

@larsbrinkhoff I also checked and the ip_forward is already set to 1

pi@rpi-400:~/pdp10/its$ cat /proc/sys/net/ipv4/ip_forward
1
oilcan-productions commented 2 years ago

So I built KA10 now. Running ./start as normal user gives me an access denied and ITS crashes. running as sudo ./start I get the below and ITS starts. but I still cannot get to it.

pi@rpi-400:~/pdp10/its$ sudo ./start 

KA-10 simulator V4.0-0 Current        git commit id: 39ff585e
/home/pi/pdp10/its/out/pdp10-ka/run-22> at tk 10000 speed=300
Listening on port 10000
/home/pi/pdp10/its/out/pdp10-ka/run-25> at dpk 10002 speed=4800
Listening on port 10002
/home/pi/pdp10/its/out/pdp10-ka/run-26> at dpk line=11,10019 speed=4800
Line 11 Listening on port 10019
/home/pi/pdp10/its/out/pdp10-ka/run-27> at dpk line=15,10020 speed=4800
Line 15 Listening on port 10020
/home/pi/pdp10/its/out/pdp10-ka/run-29> at mty 10003 speed=50000
Listening on port 10003
Sockets: bind error 98 - Address already in use
/home/pi/pdp10/its/out/pdp10-ka/run-30> at mty line=9,10018 speed=9600
Can't open network port: 10018
/home/pi/pdp10/its/out/pdp10-ka/run-31> at mty line=8,10017 speed=9600
Line 8 Listening on port 10017
/home/pi/pdp10/its/out/pdp10-ka/run-32> at mty line=7,10016;notelnet speed=50000
Line 7 Listening on port 10016
/home/pi/pdp10/its/out/pdp10-ka/run-33> at mty line=6,10015 speed=9600
Line 6 Listening on port 10015
/home/pi/pdp10/its/out/pdp10-ka/run-35> at ten11 10011
Listening on port 10011
/home/pi/pdp10/its/out/pdp10-ka/run-37> at auxcpu 10006
Listening on port 10006
/home/pi/pdp10/its/out/pdp10-ka/run-40> set imp ip=192.168.2.101/24
IMP DHCP disabled
/home/pi/pdp10/its/out/pdp10-ka/run-43> at imp tap:tap0
Eth: opened OS device tap0
Fri Feb 11 16:34:57 2022
Sockets: _eth_write(tap):  error 5 - Input/output error
IMP: Eth: Error Transmitting packet: Input/output error
You may need to run as root.
Fri Feb 11 16:34:58 2022
Sockets: _eth_write(tap):  error 5 - Input/output error
IMP: Eth: Error Transmitting packet: Input/output error
You may need to run as root.
Eth: closed tap0
IMP: MAC Address Conflict on LAN for address E2:6C:84:1D:34:A3
eswenson1 commented 2 years ago

@oilcan-productions If we can find someway for a real-time chat (IRC, Slack, etc.) then perhaps we can discuss your setup with KLH10. I have a KLH10-based ITS system running on the Internet and accessible via SUPDUP. I choose not to expose other services to the internet, but have managed to test them out too. At one point I had outbound TELNET/SMTP working from ITS to the internet (as well as inbound SMTP). I may have managed to break some of this a while back, but might be able to get it working again as a comparison with your setup.

I've never been able to get KA10-based networking to work due to its lack of TUN support. The virtual hosts I've tried to get network set up on (with KA10) have not been able to support TAP.

oilcan-productions commented 2 years ago

@eswenson1 happy to go down which ever route you are OK with, I have Teams, Facebook Messenger, WhatsApp, readily available. Have not had an IRC user in decades but up for that as well of course.

eswenson1 commented 2 years ago

Perhaps you can send me your WhatsApp contact info via email? My email address is eric @ swenson.org.

eswenson1 commented 2 years ago

@bictorv @olican-productions tried running KLH10 on raspbian bullseye (debian-derived) Linux distro and despite using the same (similar) INI as mine, his never creates a tun device, and says this on startup:

Salvager 261

CRASH has no files, User File Directory DELETED

[dpimp: Using default interface "eth0"]
[dpimp: ifc "eth0" => ether dc:a6:32:e5:32:5]
[dpimp:   inet 192.168.0.223]
[dpimp:   netmask 255.255.255.0]
[dpimp:   net 192.168.0.0]
[dpimp:   gwdef 192.168.0.223]
[dpimp:   GUEST 192.168.1.100]
[dpimp: ARP cached 192.168.0.223 = dc:a6:32:e5:32:5]
[dpimp: Enabled net.ipv4.conf.eth0.proxy_arp]
[dpimp: Enabled net.ipv4.ip_forward]
[dpimp: Enabled net.ipv4.conf.eth0.arp_accept]

Mine says this:

Salvager 263

.TEMP. has no files, User File Directory DELETED
.MSGS. has no files, User File Directory DELETED

[dpchaos: ifc "" => chaos 5460]
[dpchaos:  chaos   5401 => ip 127.0.0.1:42044]
[dpimp: ifc "tun1"]
[dpimp:   tun 50.116.1.142]
[dpimp:   GUEST 192.168.0.100]

Why is his setup NOT using a tun device while mine is? Any ideas?

bictorv commented 2 years ago

It's hard to knwo exactly without seeing the actual ini file, but I guess that you might be using different versions of klh.

It recently changed behaviour, so if you specify the gwaddr parameter, it uses ifmeth=pcap (because the gwaddr param doesn't make any sense for ifmeth=tun), and if you specify the tunaddr parameter, it uses ifmeth=tun (because it doesn't make sense for pcap). See https://github.com/PDP-10/klh10/commit/b5601a46c7dd03e3e046b0c2cbcbba7823ef866f.

If @oilcan-productions uses gwaddr=192.168.0.223, change it to tunaddr=192.160.0.233, and I think it will start working as you expect.

eswenson1 commented 2 years ago

Ah thanks, Björn. I'm sure that's it. I remembered -- and mentioned to Mike that I was using a different (older) version of KLH10, but had forgotten about the INI file keyword change. Mike, can you make that change and see if it starts using the run device?

oilcan-productions commented 2 years ago

@eswenson1 @bictorv thank you that was it. Now I can FTP into the ITS machine at 192.168.1.100. Maybe I should submit a PR for the Network doc to at least have a note that on Raspian that is what is needed to get it to work.

bictorv commented 2 years ago

I have a vague memory of fixing the networking docs...