What's new

Closed How to : connect to a lan and run tcp/ip under dos

Status
Not open for further replies.

Wingthree

Addict
Joined
May 23, 2017
Posts
9
Reaction
15
Points
71
Assuming a PC with MS-DOS v.6, with a 3COM EtherLink III 3c509B ethernet card.

First of all we need a Packet Driver for this card. It's called 3C5x9PD.COM, so it's executable and can be run from the command prompt or a batch file.

3cpd1.png


Apparently, we need to supply an interrupt vector, <pkt_int_num>, a software interrupt that other applications can use to find the location of the driver in the computer's memory, and use it to get their bits and bytes through the network adaptor on to the network. . These packet drivers usually get interrupt vectors 0x60,0x61,0x62, etc.

3cpd2.png


Note that the card itself has interrupt 10. This is the hardware interrupt of the network adapter, used by the network card to 'get the attention' of the CPU. It can (sometimes / usually) be modified either by jumper settings on the card itself, either with a configuration tool if that came with your NIC, either it's Plug and Play - but no P&P under DOS !
More hardware stuff : I/O base address (can be changed with the option 'parameter' as shown on the screen - in case it conflicts with other devices). This is the I/O address where the CPU can communicate with the NIC. Ethernet Address : Unique address, 'build into' the circuits of the network interface card. (a.k.a. MAC address). used to identify the device, and the computer where it is located, within the ethernet network. If you're on a network with Dynamic Host Configuration (dynamic IP addresses !), The DHCP server will associate an IP address to this MAC address.

As there is no general standard for DOS TCP/IP, DOS applications include their own TCP/IP stack. Next step is thus to setup your DOS TCP applications (mail ? browser, ...) and enter your network data in their configuration files, dialog boxes etc. These applications will know how to communicate with the packet driver, either by looking for it in the memory until they find it. It is also possible that you need to enter this location (0x60) in the configuration of your software.

For the sake of argument, well now install Trumpet DOS TCP/IP stack. It is conceived as a more general TCP/IP stack that several programs could use. (like Winsock does for Windows). It comes with some applications like finger, ping and FTP, and as it is a standard interface, it should be possible to write other applications for it as well - so if you're not yet a programmer, you might find some Trumpet-compatible TCP/IP applications on the web.

As we are talking about LAN, Local Area Network, it is assumed that you have, or will, set up a local network (e.g. 2 old PC's with network cards and a cross-link cable, or straight cable and a hub, etc ...). You have now become (by default) the network administrator, so you decide which pc gets what IP address, what your subnetmask will be, etc. Just make sure it makes sense. There's an excellent TCP/IP Primer in the You do not have permission to view the full content of this post. Log in or register now. section of this web site - look for Daryll's TCP/IP primer - addressing and subnetting on the near side of the web. Note that the addresses etc. given in the following example are realistic for a home network.

The executable for Trumpet's DOS TCP/IP stack is tcpdrv.exe. You can supply all your network parameters (ip address, netmask, ...) as command line options. (there's a link to the readme file further down). You can also make environment variables to hold these values, and tcpdrv will read them and use them.

tcpdrv.exe will also look for a packet driver, and if you have installed one, it will find it and use it.

So a very simple way to provide TCP/IP connectivity to a DOS pc would be to collect all the software mentioned, put these files in a directory, and create a batch file to

  1. load the packet driver
  2. set network parameters
  3. run tcpdrv
here's a sample batch file


echo off
cls
ECHO connecting over TCP/IP

REM load packet driver at interrupt vector 0x60
3c5x9pd 0x60

REM set network information in environment variables as parameters for trumpet

set IP=10.0.0.3
set GATEWAY=10.0.0.1
set NETMASK=255.255.255.0
set DOMAIN=
set DNS=212.35.2.1


load Trumpet TCP/IP stack
tcpdrv


ECHO testing network with ping
ping 10.0.0.3

ECHO if ping was successful, you're on


This batch file can now be seen both as a command to get your PC on the LAN over TCP, and as a configuration file (edit the batch file to change network parameters). When it's run, you clearly see how the packet driver is loaded, then how TCP is installed taking the network parameters you've entered.

trumpet.png


This seems to work - piece of cake. But I haven't tested this - the other PC, the one I should connect to, is temporary out of order due to a hard disk crash, ... But it looks as if it might work, doesn't it ?

Dial up connection to the internet with DOS TCP/IP
Although this is supposedly more complicated than connecting to a LAN, there's far more documentation to be found on the web, so in a way it's even easier.

It is done in 4 simple steps :

  1. connect your modem to a serial port of your PC
  2. use some software to make your modem dial another computer (your internet provider)
  3. let a program set up a PPP connection with the computer at the other side.
  4. find a way to relay the results of the ppp negotiations (dynamic IP address etc ? ) to the TCP/IP software.
The first step is easy : just plug it in. The characteristics ('properties') of the serial port taken all together make it a COM port ( a communication port). E.g. If your modem is on COM2, and your BIOS says that COM2 uses interrupt 4 and I/O address 2F8, then all communications software know where to find the modem, and use it to communicate with a remote system. This does mean that you'll have let this software know at what port your modem is, or which interrupt and I/O address it uses. This, and other modem commands (such as : which number to dial) can be put in a modem script or dialer script.

For step 2, 3 and 4, you may come across several different solutions :
Step 2 and 3 are usually combined in 1 program (a PPP-dialer). They usually can be used interactive : you type some modem commands (the 'modem string' and a command to make the modem dial a telephone number) and other input on the keyboard, they show the reply of the remote system on the screen. Or you can let them read the commands, the telephone number, username, password ... from a text file (script).
Instead of PPP (Point to Point Protocol), there's also SLIP, which is older and less advanced, but uses far less memory (which matters when you're using a really old machine. You'll need to find a provider that still supports SLIP, PPP is the standard these days.

PPP Packet Drivers
TCP/IP software is often designed to work with PPP connections. In some cases, you may need to load an additional piece of software to enable the communication between the TCP/IP level and the PPP level. Or the dialer will arrange that for you and take care if this 4th step as well. Some TCP/IP programs will even take care of everything from the dialing up to and including the IP layer - or at least pretend they do so by loading the software for step 2, 3 and 4 themselves. You may even come across applications that cover everything, like a web browser for DOS that covers the whole range from dialing to showing web pages, in complete disregard of the layered approach of OSI and TCP/IP reference model. The layered approach, however, allows you to use the same connection configuration for whatever application you want to run : mail programs, web browsers, file transfer ...

These programs (often called 'packet drivers') will allow IP packets to run over your telephone line if a PPP connection has been established, establishing the necessary 'host to network' connection for TCP/IP. The TCP/IP applications, however, will need some 'network information' such as the IP address of your provider, the IP address of your PC, the subnet mask, (and maybe some more addresses e.g. a DNS server etc). If this information is static (always the same), it can be provided in configuration files (text files that software can read from, like the .ini files under Windows).

Dynamic IP addresses
Often your Internet Service Provider will assign you an IP address dynamically (every time you connect, you get whatever IP address the ISP has available at that time. It is supplied while the You do not have permission to view the full content of this post. Log in or register now. is established. You then need a way to inform the TCP applications of this address. People using TCP/IP under DOS have developed several ways to handle that, by saving this info in 'environment variables', exporting them into text files, etc. Study some examples such as Arachne (WWW Browser for DOS), Barebones E-mail for DOS, etc.



Well-known internet connection software for DOS:
  • EtherPPP : the ppp.exe dials and supplies the ppp layer by remaining in the memory where it can be reached through a software interrupt. It's older and more limited than Dospppd.
  • DossPPPd : the dialer and ppp layer are separate files. You can combine the ppp driver with any dialup- program that can dial and connect, then exit without closing the connection (Chat0.exe in the DOSppp distribution, or Miniterm.exe that comes with Arachne web browser for DOS, or NetDial, or Comtool, etc). Dospppd uses batch files and environment variables to handle dynamically assigned IP addresses.
  • KLOS PPP. KLOSS is/was a sofware developing company. They had there own DOS internet connection software, of which the demo version (PPPDEMO) and shareware version (PPPSHARE) are/were freely available. Very robust, and with user-friendly menus (contrary to Etherppp and DOSppp, where everything is done at the prompt or by writing scrips and batch files).
  • FTP Software Inc. used to distribute commercial DOS TCP/IP networking software (called PC/TCP). Their approach was to supply packet drivers for a specific range of 'supported network cards' + an interface to PPP and SLIP connections and some generic drivers for unsupported network adapters)
The first three are freeware/shareware, the 4th one is a commercial product from the 80's so it might be hard to find.

Do It Yourself
The following example uses dospppd for the ppp layer, and miniterm as dialer. miniterm is the dialer used by Arachne (copyright Arachne Labs). Miniterm uses arachne.cfg as configuration file.To dial a modem, the file may look like this :

[dialer]
Dialer @MINITERM.EXE>PPP.LOG
UseTerminal Yes
Port 1
Irq 4
Base 0x3f8
Mode 8N1
Speed 115200
InitString AT&F1
DialString ATDT
PhoneNumber 034004321
Autologin No
PPPusername johnyBgoode
PPPpassword 123456

The dospppd distribution contains 2 types of packet drivers : pppd.exe and epppd.exe. The difference is that epppd emulates an ethernet card; this means that after the connection is set up, it 'behaves' as an ethernet network adapter. This is to allow software that expects an connection over ethernet to communicate with the packet driver as if it were an (ethernet) network card. Both pppd and epppd can be used with command line options, or with a configuration file that contains the information the packet driver needs. Like this :

com1
115200
modem
asyncmap 0
user johnyBgoode
passwd 123456



Password an username are repeated because the remote computer (my internet provider) will want to check them at this stage (i.e. during PPP negotiations, not during the dial-up / login. These are two different authentication protocols (PAP : Password Authentication Protocol : you are asked to log in with username and password -- CHAP : Challenge Handshake Authentication Protocol). Dospppd can handle both.

Next, all it takes is to run these 2 commands (e.g. in a bat file).

cls
echo off

REM Connecting to Yoohoo ...

miniterm
pppdd file ppp.cfg

This is what it looks like on screen

dialing
minitrm1.png


connecting
minitrm2.png


starting ppp
minitrm3.png


If the connection is made, pppd will collect IP (network) information from the remote computer (also visible on this screenshot) and create a batch file, IP-UP.BAT, that 'sets' this information in environment variables.



set myip=63.235.200.47
set remip=63.235.0.18
set netmask=255.0.0.0
set peermru=1500

You have now established a 'host-to-network' connection capable of running IP, For applications to use this connection, they need a TCP/IP stack : software that implements TCP/IP protocols. With DOS internet and other TCP/IP programs, this TCP/IP stack is usually integrated in the program. You do need, however, to inform the application that you're going to use, of the IP configuration.

About 50% of all DOS internet applications and TCP/IP software read their network information from a configuration file called wattcp.cfg. DOS provides > and >> to 'direct' output of a command or program to a file, so this can be used to write the values set in IP-UP.BAT to a text file such as wattcp.cfg. E.g. echo myip=%myip% >> wattcp.cfg will add the line myip=63.235.200.47 to the wattcp.cfg file.

> creates a new file, deleting any previous file with the same name. >> adds a line to an existing file or creates one of none exist. %____% indicates an environment variable. If this sounds like Chinese (while you are not), you may have to look up DOS in the You do not have permission to view the full content of this post. Log in or register now. section for more on DOS commands and batch files.

We add this to our batch file to automate the process, and add some cleanup (remove files from previous sessions so they won't interfere with the new session).
cls
echo off

REM remove files from previous session
if exist wattcp.cfg del wattcp.cfg > NUL
if exist ip-up.bat del ip-up.bat > NUL

ECHO Connecting to Yoohoo ...

miniterm
pppdd file ppp.cfg

REM call ip-up.bat to set IP info as environment variable
call ip-up.bat

REM write IP info from environment variables to wattcp.cfg
ECHO myip=%myip% > wattcp.cfg
ECHO remip=%remip% >> wattcp.cfg
ECHO remip=%remip% >> wattcp.cfg
ECHO netmask=%netmask% >> wattcp.cfg
ECHO peermru=%peermru% >> wattcp.cfg


If you have an application that uses a different configuration file in stead of wattcp.cfg, you can of course redirect the output to that file. If your application uses environment variables but with different names (e.g. my_ip i.s.o. myip), you can create this variable and assign it its value with a statement like set my_ip=%myip%. You might want to use this technique to set environment variables for the Trumpet TCP/IP discussed earlier.

Your application might need information that is not provided by the ip-up variables : the address of a DNS server for instance. So you can either

  • create an additional variable : set nameserver=212.35.2.2.
  • write this address to wattcp.cfg : echo dns=212.35.2.2 >> wattcp.cfg. (check whether your application expects "nameserver", "nameserv", "dns", or something else as keyword for the DNS address)
  • combine these 2 methods :
    set nameserver=212.35.2.2
    ECHO dns=%nameserver% >> wattcp.cfg
  • write all additional information in a separate text file (e.g. my_isp.txt, and add the contents of this text file to the wattcp.cfg file with TYPE my_isp.txt >> wattcp.cfg.
  • create a batch file, similar to ip-up.bat, that creates environment variables with additional isp data (e.g. my_isp.bat). Call this batch file to set all these variables, just as you did with ip_up.bat.
you can -- according to which of the above methods you choose/need, add a matching statement to the batch file that you use to establish your connection. And you're ready to get on the internet with a DOS computer.

You may have noticed that this is a rather general (or vague) how to. You'll still need to figure out and decide a few things yourself. The main idea was to demonstrate how the physical and datalink layer are implemented (on a DOS computer), and then provide an "interface" to TCP/IP applications.

You do need some basic DOS knowledge to understand all this, (or learn very fast from the context.)

More :
  • You do not have permission to view the full content of this post. Log in or register now. Ethernet Packet Drivers
  • You do not have permission to view the full content of this post. Log in or register now.
  • You do not have permission to view the full content of this post. Log in or register now.
  • You do not have permission to view the full content of this post. Log in or register now.
  • You do not have permission to view the full content of this post. Log in or register now. for Trumpet DOS TCP/IP.
  • You do not have permission to view the full content of this post. Log in or register now.
    Makers of (commercial) TCP/IP stacks for Windows (Winsock) and DOS.
  • You do not have permission to view the full content of this post. Log in or register now. More information on the subject, and links to TCP/IP stacks and internet applications for DOS (from You do not have permission to view the full content of this post. Log in or register now.).
  • Wattcp. The name is derived from University of Waterloo, and wattcp.com is today an Arab dating site, but the original writer of wattcp maintains a website at You do not have permission to view the full content of this post. Log in or register now.
    Wattcp is free to use and you can distribute it as long as you're not selling it (i.e. you can make copies and give them to others. And it's still being developed further. That makes it an excellent choice if you need TCP/IP for DOS
  • You do not have permission to view the full content of this post. Log in or register now., by John Chapman.
  • You do not have permission to view the full content of this post. Log in or register now. Graphical Web Browser for DOS. (Arachne Labs)
download :
  • You do not have permission to view the full content of this post. Log in or register now. (You may want to search the web for more recent versions ...)
  • You do not have permission to view the full content of this post. Log in or register now. : An open source DOS implementation, backwards compatible with legacy MS-DOS, and including TCP/IP networking (using Crynwr packet drivers and some of the techniques explained on this page).
 

Attachments

Status
Not open for further replies.

Similar threads

Back
Top