PPP configuration on linux host

From DOSBoxWiki
Jump to navigationJump to search

DOSBox supports modem connection using tcp sockets. In this page, we describe a simple networking ppp configuration on linux (ubuntu) host. With socat or similar tools on host's side, you can connect these sockets with pppd, and the DOSBox guest can access internet as well.

WARNING!

The included scripts and manuals are dangerous! It needs sudo or root access to the target host, uses external dependencies, can cause damage and irrecoverable package dependency problems via apt installing, and may be harmful when you are not familiar with tcp/ip ipv4 networking or linux iptables/pppd/etc. tools.

Prerequisities under ubuntu

Internet settings

A working internet connection is essential. 192.168.7.0/30 network must be unused! Otherwise network range collision will happen, causing unpredictable results! In this example, it leaves garbage in iptables after exiting, so a reboot or an iptables chain purging may be necessary! Make sure that no telnet service is running on the system, and also no other application uses the TCP 23 port! Otherwise the following steps or scripts will cause damage!

Required ubuntu packages

And also the following packages need to be installed (may need some other ppp stuff, depending on linux flavour):

apt-get install bash dosbox iptables p7zip-full ppp sudo wget

Launch a networked session under ubuntu

Creating working directory

Open a terminal, then create a standalone folder and then enter it, e.g.

mkdir ~/dosppp
cd ~/dosppp

Getting lynx-bobcat application

wget -nc http://www.fdisk.com/doslynx/bobcats/bcat-e07.exe

Extract bobcat

md5sum: 8ec09c609b4a2148d249f77e22e670b1

7z x bcat-e07.exe

Creating files

The following filenames are case sensitive! Save these 5 files as textfiles to the actual directory ( ~/dosppp in our example )!

Create runme.sh

#!/bin/bash
#
# by Peter Naszvadi, 2012-2016
#
Uid="$(find "$0" -printf '%U' -quit)"
sudo -u "#$Uid" wget -nc http://www.fdisk.com/doslynx/bobcats/bcat-e07.exe
sudo -u "#$Uid" bash ./setup.sh
sudo -u "#$Uid" nohup dosbox -conf dosppp.cnf &
Pid="$!"
Serial="/dev/serial$$"
grep -q 1 /proc/sys/net/ipv4/ip_forward || \
    ( echo 1 1>/proc/sys/net/ipv4/ip_forward )
iptables -L -t nat | grep '^MASQ.*192\.168\.7\.0/30' || \
    iptables -t nat -A POSTROUTING -s 192.168.7.0/30 -j MASQUERADE
while ps $Pid >/dev/null
do
    if sleep 0.1 && pgrep socat
    then
        echo Socat is already running...
    else
        socat TCP4-LISTEN:23 PTY,link="${Serial}" &
        Pid2="$!"
    fi
    sleep 0.5
    if pgrep pppd
    then
        echo pppd is running...
        sleep 1
    else
        pppd "${Serial##*/}" defaultroute mtu 576 192.168.7.1:192.168.7.2
    fi
done
echo dosbox exited
kill -9 "$Pid2"
pkill -9 pppd
[ -e "$Serial" ] && rm "$Serial"
exit 0

Set attributes of runme.sh:

chmod 755 runme.sh

Create BCATDIAL.BAT

@echo off
NETDIAL BASE 0x3F8 IRQ 4 9600
epppd base 0x3F8 irq 4 pktvec 0x60 9600 asyncmap 0 crtscts 
call IP-UP.bat
set MYIP=192.168.7.2
echo my_ip=%MYIP% > path.cfg
set remip=192.168.7.1
echo gateway=%remip% >> path.cfg
set netmask=255.255.255.252
echo netmask=%netmask% >> path.cfg
set nameserver=8.8.8.8
echo nameserver=8.8.8.8 >> path.cfg
cd .\bobcat
if exist history.htm del history.htm >nul
lynx -show_cursor -cache=5
cd ..
termin 0x60 
netdial BASE 0x60 IRQ 4 hangup

Create dosppp.cnf

[dosbox]
memsize=32
[serial]
serial1=modem listenport:2323
[autoexec]
mount c .
c:
bcatdial.bat

Create NETDIAL.SCR

send "ATZ\r"
recv 15000 "OK"
send "ATDTlocalhost\r"
recv 60000 "~"

Create setup.sh

#!/bin/sh
set -eu
test -e NEWUSER.BAT || 7z x bcat-e07.exe
test -e  NETDIAL.EXE || cp ./CONFIG/NETDIAL.EXE ./NETDIAL.EXE
test -e  EPPPD.EXE || cp ./CONFIG/EPPPD.EXE ./EPPPD.EXE
test -e  HOLDIT.EXE || cp ./CONFIG/HOLDIT.EXE ./HOLDIT.EXE
test -e  SETSCRN.COM || cp ./CONFIG/SETSCRN.COM ./SETSCRN.COM
test -e  TERMIN.COM || cp ./CONFIG/TERMIN.COM ./TERMIN.COM
test -e  ./BOBCAT/LYNX.CFG || cp ./CONFIG/LYNX.CFG ./BOBCAT/LYNX.CFG
test -e  ./BOBCAT/WATTCP.CFG || cp ./CONFIG/WATTCP.STD ./BOBCAT/WATTCP.CFG
test -e  ./BOBCAT/LYNXRC || cp ./CONFIG/LYNXRC ./BOBCAT/LYNXRC
test -e  ./BOBCAT/HOTLIST.HTM || cp ./CONFIG/HOTLIST.HTM ./BOBCAT/HOTLIST.HTM
test -e  ./BOBCAT/FTP.HTM || cp ./CONFIG/FTP.HTM ./BOBCAT/FTP.HTM
test -e  ./BOBCAT/GOPHER.HTM || cp ./CONFIG/GOPHER.HTM ./BOBCAT/GOPHER.HTM
test -e  ./BOBCAT/WWW.HTM || cp ./CONFIG/WWW.HTM ./BOBCAT/WWW.HTM
test -e  ./BOBCAT/TELNET.HTM || cp ./CONFIG/TELNET.HTM ./BOBCAT/TELNET.HTM
test -e  ./BOBCAT/IRC.HTM || cp ./CONFIG/IRC.HTM ./BOBCAT/IRC.HTM
test -e  ./BOBCAT/FORMS.HTM || cp ./CONFIG/FORMS.HTM ./BOBCAT/FORMS.HTM
test -e  ./MINITEL/WATTCP.CFG || cp ./CONFIG/WATTCP.STD ./MINITEL/WATTCP.CFG
test -e  ./FTP/WATTCP.CFG || cp ./CONFIG/WATTCP.STD ./FTP/WATTCP.CFG
test -e  ./BOBCAT/EXTERNAL/FTP.BAT || cp ./CONFIG/FTP.TAB ./BOBCAT/EXTERNAL/FTP.BAT
test -e  ./BOBCAT/EXTERNAL/HTTP.BAT || cp ./CONFIG/HTTP.TAB ./BOBCAT/EXTERNAL/HTTP.BAT
test -e  ./BOBCAT/EXTERNAL/GOPHER.BAT || cp ./CONFIG/GOPHER.TAB ./BOBCAT/EXTERNAL/GOPHER.BAT
test -e  ./BOBCAT/EXTERNAL/TELNET.BAT || cp ./CONFIG/TELNET.TAB ./BOBCAT/EXTERNAL/TELNET.BAT
test -e  ./BOBCAT/EXTERNAL/IRC.BAT || cp ./CONFIG/IRC.TAB ./BOBCAT/EXTERNAL/IRC.BAT
test -e  SCRIPIT.DEF || cp ../DOCS/SCRIPIT.DEF ODSCRIPIT.DEF
test -e  NETDIAL.STD || cp ../DOCS/NETDIAL.STD NETDIAL.STD

Launch runme.sh

sudo ./runme.sh

If everything is okay, you can get similar result like this:

Dosbox epppd lynx.gif

Links

Visit for more information: http://www.vogons.org/viewtopic.php?t=27920