www/content/retro/fake.md
Simon Marsh ee15ce0ca4
All checks were successful
continuous-integration/drone/push Build is passing
update VOIP and retro services
2022-10-01 16:22:26 +01:00

208 lines
5.1 KiB
Markdown

---
title: "Modem Emulator"
geekdocDescription: "Modem Emulator Service"
weight: 20
---
No modem ? no problem.
If you don't have a physical modem you can still get that retro vibe by
accessing dn42 using the modem emulator service. This service presents a
series of TCP/IP ports that emulate a subset of the Hayes AT command set
and which are speed limited to specific baud rates. The modem can dial
directly to the fr-par1 shell service for that CLI experience, or get
full dn42 access via a PPP session.
The service is intended to be used as a fake serial port in a retro VM or
connected to directly using a serial terminal.
## Accessing the modem emulator service
- dialup.burble.dn42:_(10000 + baud/100)_
The modem emulator is accessed by connecting to dialup.burble.dn42
on ports corresponding to specific baud rates, as detailed in the table
below.
| Port | BAUD | Port | BAUD | Port | BAUD |
|:--|:--|:--|:--|:--|:--|
| _10003_ | 300 | _10012_ | 1200 | _10024_ | 2400 |
| _10048_ | 4800 | _10096_ | 9600 | _10144_ | 14400 |
| _10192_ | 19200 | _10288_ | 28800 | _10336_ | 33600 |
| _10560_ | 56000 | _11150_ | 115000 |
{{<hint info>}}
Low baud rates give a great experience when using a serial terminal and
the shell service but aren't so much fun when using PPP. Conversely, using
a serial terminal and higher baud rates is a bit dull and they are better
suited to the PPP service.
{{</hint>}}
The emulated modem is able to dial two services depending on the number used.
| Dial Number | Service |
|:--|:--|
|54311|fr-par1 shell server|
|4242|PPP dialup service|
## Dialling the fr-par1 shell server
Use a terminal emulator and dial **54311** to access the fr-par1 shell server.
Once the modem connects, use your burble.dn42 username and password to log in.
{{<hint info>}}
You can set a burble.dn42 password using the [services portal](https://svc.burble.dn42).
{{</hint>}}
{{<hint info>}}
Don't forget to set a terminal type once you've logged in, e.g. `export TERM=vt102`
{{</hint>}}
## Dialing the PPP server
- Dial **4242** to access the PPP server.
- Use username: *dn42*, password: *dn42* to log in.
- Once you see the PPP initiation string, connect your PPP client.
- PPP authentication should not be required.
## Example shell session using socat and minicom
Example on how to connect to the shell server using socat and minicom at 2400 baud
```text
$ socat -d -d pty,rawer tcp:dialup.burble.dn42:10024 &
...
... socat[xxx] N PTY is /dev/pts/2
...
$ minicom -D /dev/pts/2
```
Within minicom type **ATDT54311** to dial the shell server.
```text
Welcome to minicom 2.8
OPTIONS: I18n
Port /dev/pts/2, 14:01:58
Press CTRL-A Z for help on special keys
ATDT54311
CONNECT 2400
Ubuntu 22.04.1 LTS
shell-fr-par1 login:
```
You can now log in using your burble.dn42 username and password.
## Example PPP connection using QEMU and Windows XP
Add a virtual serial port to QEMU using `-chardev` and `-device`.
e.g. for windows XP connecting at 115k
```text
qemu-system-i386 -enable-kvm -cpu host -m 1024 -vga std -device AC97 -hda winxp.img -chardev socket,id=bdn42,port=11150,host=dialup.burble.dn42,server=off -device pci-serial,chardev=bdn42
```
Create a PPP dialup connection with username dn42 and password dn42, enable the option
to prompt for username and password on connect.
![Enable chat prompt](/retro/xpconfig.png)
Start the connection and when then chat box opens:
- Type **ATDT4242** to dial the PPP service
- Log in using username dn42 / password dn42
- Hit continue when you see the PPP connect string
<video src="/retro/xpconnect.webm" width="1024" autoplay="true" loop="true"></video>
The following chat script provided by 04dco should provide automatic login for win95 onwards:
```text
;
; This is a script file that automatically logs you in
; to establish a dn42 dial-up PPP connection.
;
; Main entry point to script
;
proc main
integer nTries = 3
; This is the login prompt and timeout values
string szLogin = "modem-server Login: "
integer nLoginTimeout = 5
; This is the password prompt and timeout values
string szPW = "Password: "
integer nPWTimeout = 5
; This is the prompt once your password is verified
string szPrompt = "Last login: "
; Attempt to login at most 'nTries' times
while 0 < nTries do
; Wait for the login prompt before entering
; the user ID, timeout after x seconds
waitfor szLogin then DoLogin
until nLoginTimeout
TryAgain:
transmit "^M" ; ping
nTries = nTries - 1
endwhile
goto BailOut
DoLogin:
; Enter user ID
transmit $USERID, raw
transmit "^M"
; Wait for the password prompt
waitfor szPW until nPWTimeout
if FALSE == $SUCCESS then
goto TryAgain
endif
; Send the password
transmit $PASSWORD, raw
transmit "^M"
; Wait for the prompt
waitfor szPrompt
goto Done
BailOut:
; Something isn't responding. Halt the script
; and let the user handle it manually.
set screen keyboard on
halt
Done:
endproc
```
## Source code
The modem emulator is a small golang server and the source code is available on the
[burble.dn42 git server](https://git.burble.com/burble.dn42/modemulator)