Part 2: Connecting to the internet

 

How to get retro computers online in 2025 using only a £12 cable (and a smartphone) - part 2

Connecting to the internet

Connecting to Termux using a serial cable is great, and you can use several apps to browse the internet, edit files and read email all through the text-mode terminal. If your retro computer is capable of running a TCP/IP stack, you can do a lot more.

Back in the 90s, the only way of getting computers online from home was to dial-in (via a modem) to a server, usually running some form of SLIP or PPP service. This would assign an IP address, and do all of the translation needed to send IP packets reliably over a serial connection.

Android does have a PPP server built in, but I have no way of accessing it directly from Termux. However, there is an application called Slirp that will run in Termux and provide a SLIP or PPP interface to the controlling terminal or to any other connected tty.

Getting Slirp

You will need a current version of Slirp - I have made mine available, with a few patches, at https://github.com/MarkWllms/slirp-termux

You will need to download the archive, install clang etc in Termux and then 'make' the code in the src directory. Run 'make install' to set up the binary.

Running Slirp

How you run Slirp may depend on your client software. For my Psions, it is enough to connect to Termux as before, and send the command to the shell:

slirp ppp

Then disconnect the client and connect the dial-up software. Your local ip address (on the client) will become 10.0.2.15, and the internet gateway will be set to 10.0.2.0. In theory, slirp should also offer a DNS server on 10.0.2.3. The special address 10.0.2.2 will map to your phone, in case you want to access any services running there.

You can also write a .slirprc config file in your home directory to set up some services on 10.0.2.1 that will only be available to the ppp client (i.e. your retro PDA or computer). This has two advantages:

  • Termux won't let you bind to addresses below 1024, but slirp will.
  • This avoids having any ports open on your network that other people can attach to.

I found that I could set the link speed all the way up to 115,200 bps in TCPUART without any problems, despite the lack of flow control, as the PPP and IP protocols avoid packet loss. However there are a lot of misaligned packets, so maybe I need to adjust mtu settings.

Connecting Slirp directly

Once you have slirp working, you can skip the terminal altogether. Simply use socat to connect the TCPUART client to Slirp instead:

socat exec 'slirp ppp',pty,sigint,rawer tcp-listen:8000,bind=localhost

Comments