brutman_dos_networking.html (45056B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2 <html> 3 <head> 4 <!-- Global site tag (gtag.js) - Google Analytics --> 5 <script async src="https://www.googletagmanager.com/gtag/js?id=G-P2ZC21XQ1H"></script> 6 <script> 7 window.dataLayer = window.dataLayer || []; 8 function gtag(){dataLayer.push(arguments);} 9 gtag('js', new Date()); 10 11 gtag('config', 'G-P2ZC21XQ1H'); 12 </script> 13 14 15 <meta content="M Brutman" name="author"> 16 <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> 17 <title>DOS TCP/IP Networking with Packet Drivers</title> 18 19 <style type="text/css"> 20 h1 {font-size:200%;line-height:225%} 21 h2 {font-size:150%;line-height:175%;font-weight: bold;} 22 h3 {font-size:100%;line-height:125%;font-weight: bold;} 23 .setting { font-family: monospace; } 24 .explain { font-style: italic; } 25 </style> 26 </head> 27 28 <body> 29 <!-- #brutmanlabs.org_serving_banner here --> 30 31 <h1 style="text-align: center;">DOS TCP/IP Networking with Packet Drivers</h1> 32 <div style="text-align: center;"><span style="font-style: italic;">Why on Earth would anybody want to do that?</span></div> 33 <h2><img src="IBM_PC_AT_Linksys_small.gif" alt="Stylized IBM PC AT with Linksys router" style="width: 400px; height: 175px;" align="right" vspace="100">Table of Contents</h2> 34 <div style="margin-left: 40px;"> 35 <a href="#Introduction">Introduction</a><br> 36 <a href="#Survey">A survey of DOS networking techniques</a><br> 37 <div style="margin-left: 40px;"><a href="#Common_devices_used_to_connect_">Common devices used to connect 38 computers</a><br> 39 <a href="#Less_common_devices_used_to_connect">Less common devices used to connect computers</a><br> 40 <a href="#Software_solutions_for_serial_ports:">Software solutions for 41 serial ports</a><br> 42 <a href="#Software_solutions_for_parallel_ports:">Software solutions 43 for parallel ports</a><br> 44 <a href="#Protocol_suites_for_network_cards">Protocol suites for 45 network adapters</a><br> 46 <a href="#High_level_applications">High level applications</a><br> 47 <a href="#Miscellaneous_notes">Miscellaneous notes</a> 48 </div> 49 <a href="#CloserLook">A closer look at TCP/IP</a><br> 50 <a href="#DOS_and_TCPIP">DOS and TCP/IP</a><br> 51 <a href="#A_Warning_About_DOS">A warning about old PC hardware and DOS</a><br> 52 <a href="#Packet_drivers">Packet drivers</a><br> 53 <a href="#Using_a_packet_driver">Using a packet driver</a><br> 54 <a href="#Choosing_Hardware">Choosing Hardware</a><br> 55 <a href="#Some_notes_on_networking_software">Some notes on networking 56 software</a><br> 57 <a href="#Additional_resources">Additional resources</a> 58 </div> 59 <br> 60 <hr style="width: 100%; height: 2px;"> 61 <h2><a name="Introduction"></a>Introduction</h2> 62 <p style="font-style: italic; margin-left: 40px;">From Wikipedia: 63 "Sneakernet" is an informal term describing the transfer 64 of electronic information, especially computer files, by physically 65 moving removable media such as magnetic tape, floppy disks, compact 66 discs, USB flash drives (thumb drives, USB stick), or external hard 67 drives from one computer to another. This is usually in lieu of 68 transferring the information over a computer network. The name is a 69 tongue-in-cheek sound-alike to Ethernet, and refers to the use of 70 someone wearing sneakers as the transport mechanism for the data.</p> 71 <p>DOS has been an obsolete operating system for close to twenty years 72 but it still shows up in a few places:</p> 73 <ul> 74 <li>In embedded applications like cash registers, lab equipment, and 75 industrial equipment that keep doing what they were designed to do 20 76 years ago.</li> 77 <li>For running old software that people might be still using in 78 their businesses. (Sometimes on real hardware, and sometimes in a 79 virtual machine.)</li> 80 <li>Hobbyists experimenting with old computers that run DOS</li> 81 </ul> 82 <p>Back when DOS was a current operating system many machines were not 83 network connected at all. Back then people did not have home networks 84 and networking equipment was much more expensive. If people had any 85 sort of connectivity it might have been to use a bulletin board system 86 (BBS) through a dial-up modem or to talk to a Novell Netware server 87 running on their local network. "Sneakernet", or the art of carrying 88 software around on floppy disks, was the standard method of moving data 89 around.</p> 90 <p>Networking started to become more popular as businesses obtained 91 multiple computers and they needed a way to communicate. This drove the 92 cost of networking adapters and equipment down, which made it more 93 affordable for home users. The growth of DSL and cable modem devices in 94 the early 2000s made home networks almost a requirement, if only to 95 allow sharing the one connection point to the Internet. 96 </p> 97 <p>The good news is that networking adapters and equipment is as 98 inexpensive as it will ever get, and most machines running DOS can 99 easily make use of used equipment that people are just throwing away. 100 And although DOS came a little bit before the era of widespread 101 networking on home computers, there was enough overlap such that 102 reasonably good networking software exists for DOS.</p> 103 <p>On a modern operating system networking is a standard function and 104 great effort has been made to make it easy to setup. Networking for DOS 105 is always an add-on feature so it takes a little bit of work to set up, 106 but nothing too difficult. 107 </p> 108 <p>Even the slowest DOS machines dating back to the early 1980s can do 109 the following once networked: 110 </p> 111 <ul> 112 <li>Get a network address automatically from a router using DHCP</li> 113 <li>Set their date and time from a network time server on the 114 Internet </li> 115 <li>Send and receive files using FTP client</li> 116 <li>Use Telnet to connect Unix systems and online BBSes</li> 117 <li>Connect to Internet Relay Chat (IRC) servers </li> 118 <li>Fetch files from HTTP servers</li> 119 <li>Send and receive files as an FTP server</li> 120 </ul> 121 <p>Almost every old machine can use floppy disks or the serial port for 122 data transfer and for a machine that is rarely used that is all you 123 need. But if you enable networking you get the following advantages:</p> 124 <ul> 125 <li>Transferring data using floppy drives is slow and painful. Floppy 126 drives need periodic maintenance and floppy diskettes wear out.</li> 127 <li>Ethernet adapters are far faster than serial ports. A 128 typical serial port on an 8088 class system is good for about 1KB per 129 second of data transfer if everything is running perfectly. The same 130 system with an Ethernet adapter can transfer data 30 to 100 times 131 faster 132 depending on the Ethernet device being used. On an 80486 system the 133 advantage becomes even greater because transferring data using Ethernet 134 is more efficient than through a serial port.</li> 135 <li>Data transfer over Ethernet is more reliable than over a serial 136 port. You will get faster transfers speeds because there is less chance 137 of errors and the hardware helps to detect errors.</li> 138 </ul> 139 <p>Using a home network cuts down on your time "doing the floppy 140 shuffle" and saves wear and tear on your system. It also saves you 141 time. 142 </p> 143 <p>Being realistic, you are not going to want to use DOS to surf the 144 web. Modern web sites are generally too complex to render on old 145 machines and the extensive use of Javascript has made it difficult for 146 old machines. But for basic file transfer and running some useful 147 utilities like SNTP (Simple Network Time Protocol) it can not be beat. 148 And it enables some fun uses too, like chatting on Internet Relay Chat 149 (IRC).</p> 150 <h2><a name="Survey"></a>A survey of DOS networking techniques 151 </h2> 152 <p>There are lots of ways to connect computers together. This page 153 primarily discusses TCP/IP and packet drivers (to be introduced later). 154 Before getting into the details of those I'd like to present a brief 155 survey of ways to network PCs running DOS. 156 </p> 157 <h3><a name="Common_devices_used_to_connect_"></a>Common devices used 158 to connect computers 159 </h3> 160 <ul> 161 <li>Serial ports: a serial port is a simple hardware interface that 162 was in widespread use on PCs until a few years ago when manufacturers 163 generally stopped including them on motherboards. Originally they were 164 used to connect low speed devices such as printers, modems and mice. A 165 computer can use the serial port and a modem to connect to another 166 computer with a serial port and modem through the telephone 167 system. For computers that are close by a "null modem" device or cable 168 can be used to connect the serial ports of the two computers 169 directly together, eliminating the need for modems. The word "serial" 170 is 171 a description of how the bits of data are sent - the port effectively 172 sends one bit of data at at time down the wire. Typical speeds range 173 from 110 bits per second to 115,000 bits per second. </li> 174 <li>Parallel ports: a parallel port is a slightly more complex port 175 that can send data to a device faster than a serial port. Parallel 176 ports are faster than serial ports because they can send eight bits of 177 data down eight different wires at the same time. Parallel ports were 178 originally used to connect pinters but they were enhanced to allow 179 fairly high speed data transfer with other devices, such as CD-ROM 180 drives, scanners, portable hard drives, etc. Like the serial port, 181 parallel ports have fallen out of favor.</li> 182 <li>Ethernet adapterss: An Ethernet adapter or Network Interface Card 183 (NIC) allows a computer to attach to a Local Area Network (LAN) that 184 uses the 185 Ethernet standards. Ethernet originally allowed for 10Mb/s (megabits 186 per second) data rates and has been enhanced several times. Modern 187 Ethernets generally operate at 100 or 1000Mb/s. An Ethernet adapter 188 might not actually be in the form of a card - Ethernet can be added 189 using a 190 parallel port, through a USB adapter, or even directly included on a 191 motherboard. </li> 192 </ul> 193 <h3><a name="Less_common_devices_used_to_connect"></a>Less common 194 devices used to connect computers</h3> 195 <ul> 196 <li>ARCNET was a popular microcomputer networking technology in the 197 early 1980s </li> 198 <li>Token Ring was a competitor to Ethernet for networking introduced 199 by IBM. Token Ring was a good technology but it lost out to Ethernet 200 which had greater market support and generally cost less.</li> 201 </ul> 202 <h3><a name="Software_solutions_for_serial_ports:"></a>Software 203 solutions for serial ports</h3> 204 <p>Serial ports are relatively easy devices to program and lots of 205 people wrote software that uses the serial port. As a result, there was 206 a great variety of programs that used different rules for sending data. 207 Examples include:</p> 208 <ul> 209 <li>Terminal emulators that just made the PC look like a generic 210 terminal to whatever was on the other end of the serial port</li> 211 <li>Terminal emulators with file transfer protocols such as Kermit, 212 Xmodem, Ymodem and Zmodem built into them. Some of the early file 213 transfer protocols were not specified very well leading to all sorts of 214 strange and wonderful glitches and incompatibilities.</li> 215 <li>Low-end networking solutions that allowed for file and printer 216 sharing. These allowed for simple networks but were limited by the 217 speed of the serial port and the point-to-point nature of the serial 218 port.<br> 219 </li> 220 <li>TCP/IP using Serial Line Internet Protocol (SLIP) or PPP 221 (Point-to-Point Protocol). TCP/IP, SLIP and PPP had the benefit of 222 being fairly well defined so interoperability was not much of a 223 concern. As modems became faster and operating systems became 224 networking aware more home computer users progressed from calling 225 simple BBSes to Internet Service Providers using TCP/IP, enabled by 226 SLIP and PPP.</li> 227 </ul> 228 <h3><a name="Software_solutions_for_parallel_ports:"></a>Software 229 solutions for parallel ports</h3> 230 <p>Parallel ports were not used for communications as much as serial 231 ports were. Often there was just one parallel port compared with two 232 serial ports on a computer, and the parallel port was often connected 233 to a printer. Serial ports supported "hot plugging" (removing and 234 connecting devices while running) while parallel ports did not, so 235 swapping devices on a parallel port often required shutting the 236 computer and the devices off.</p> 237 <p> 238 A notable exception was LapLink by Traveling Software. LapLink provided 239 software and a special cable that allowed two computers to directly 240 connect to each other through their parallel ports. The software 241 allowed the computers to move files back and forth. Later versions of 242 DOS provided a similar function with INTERLNK and INTERSRV.</p> 243 <p>TCP/IP over the parallel port was also possible using a protocol 244 called Parallel Line Internet Protocol (PLIP).</p> 245 <p>Transfers on the parallel port were inherently faster than those 246 over 247 serial ports because of the nature of the parallel port. Parallel ports 248 also evolved to operate at faster and faster speeds using improved 249 handshaking on the wires and even DMA. Those enhancements were made to 250 improve the speeds of connected devices, but they would help data 251 transfer of any type. 252 </p> 253 <h3><a name="Protocol_suites_for_network_cards"></a>Protocol suites for 254 network adapters</h3> 255 Network adapters are quite a bit more complex than serial and parallel 256 ports and usually a network adapter is used with a set of protocols. 257 The 258 set of protocols are designed to work together and are more commonly 259 known as protocol suite. Functions of the protocol suite include data 260 sending and receiving form the hardware, basic routing of data packets, 261 creating virtual connections between applications, etc. 262 <p>Protocol suites are interesting but most people do not interact with 263 them; they use applications that hide the details of the protocol suite 264 and underlying data transfer medium.</p> 265 <ul> 266 <li>IPX/SPX: Internetwork Packet Exchange/Sequenced Packet Exchange 267 was an early competitor to TCP/IP that is often associated with Novell 268 NetWare. </li> 269 <li>TCP/IP: Transmission Control Protocol/Internet Protocol is the 270 predominant set of protocols used over Ethernet today. Besides Ethernet 271 it runs well over serial links using SLIP or PPP, Token Ring, wireless 272 variants of Ethernet, and almost any other networking technology that 273 you can think of.</li> 274 <li>NetBIOS: Originally developed for IBM to run on the IBM PC 275 Network, NetBIOS is actually an API and not a protocol. The NetBIOS 276 Frames (NBF) protocol is what ran "over the wire" on the original IBM 277 PC Network which NetBIOS was designed for. The NetBIOS API was 278 preserved when IBM introduced Token Ring; an emulator was provided for 279 the new networking technology. Novell supported NetBIOS by running it 280 over IPX/SPX with a protocol called NBX. And NetBIOS can run today 281 directly over TCP/IP using a protocol called NBT.</li> 282 <li>SNA: Systems Network Architecture was a networking suite from 283 IBM. Originally designed for connecting terminals to IBM mainframes, 284 SNA evolved to becomes a more complete protocol suite but it failed to 285 attract users outside of IBM customers.</li> 286 </ul> 287 <h3><a name="High_level_applications"></a>High level applications</h3> 288 <ul> 289 <li>NetWare: Novell Netware was one of the original file serving 290 operating systems available for PCs. NetWare implemented its file and 291 printer sharing using NetWare 292 Core Protocol (NCP) which ran on top of IPX/SPX. A disadvantage of 293 NetWare is that you generally need a dedicated server although that 294 server can probably run in a virtual machine now. Your local computer 295 would run a NetWare client to access files on the server using either 296 IPX/SPX or TCP/IP. </li> 297 <li>Server Message Block (SMB): SMB provides for file and printer 298 sharing. 299 Originally it was designed to run using the NetBIOS API, which in turn 300 can run over NBF, IPX/SPX or TCP/IP. Most people have used this in 301 Windows and just refer to it as "file and print sharing." The current 302 version of this is called Common Internet File System (CIFS).</li> 303 <li>TCP/IP applications: TCP/IP is the foundation of the Internet and 304 if there was an idea for using a network to do something, there is a 305 probably a program for it that uses TCP/IP. Examples include: 306 <ul> 307 <li>File sharing using FTP and NFS</li> 308 <li>Printing to remote printers</li> 309 <li>Telnet or SSH to allow you to use remote computers just like 310 you were sitting in front of them.</li> 311 <li>Web servers and web browsers</li> 312 <li>Chat programs</li> 313 <li>etc ...</li> 314 </ul> 315 </li> 316 </ul> 317 <h3><a name="Miscellaneous_notes"></a>Miscellaneous notes</h3> 318 <ul> 319 <li>An Ethernet device is a device that connects to an internet 320 network. Often it is an adapter that plugs into your computer, but it 321 can 322 be something different like a device that plugs into your parallel port 323 and then connects to your Ethernet network. On other architectures 324 Ethernet was sometimes attached using a SCSI bus. So when you read 325 "Ethernet adapter", keep an open mind - it might not be on a card.</li> 326 </ul> 327 <h2><a name="CloserLook"></a>A closer look at TCP/IP</h2> 328 <p>TCP/IP is the protocol suite that the Internet is built on and the 329 term "Internet" refers to a global system of interconnected computer 330 networks that use TCP/IP. In addition to powering the Internet, TCP/IP 331 is used on countless private networks. Simply put, TCP/IP allows 332 computers to send and receive data across these networks. The path the 333 data takes might be confined to one room in your house or might span 334 several continents and satellites; TCP/IP is robust enough to handle it 335 all.</p> 336 <p>TCP/IP is composed of layers of protocols: 337 </p> 338 <ul> 339 <li>Internet Protocol (IP): This is the lowest layer of TCP/IP - 340 anything "closer to the wire" than this is covered by the standards for 341 the device that you are using, for example Ethernet or Token Ring. IP 342 packets contain information such as the source IP address and the 343 target IP address, but not much more. IP packets are not 344 guaranteed to arrive in the order they were transmitted or arrive at 345 all! IP packets can be sent to individual machines or groups of 346 machines.</li> 347 <li>User Datagram Protocol (UDP): UDP is a higher level protocol that 348 rides inside of the IP packet payload; another way to say this is that 349 IP encapsulates UDP. UDP adds the concept of "ports" to the network so 350 that a packet does not just target a machine anymore; it can target 351 a specific application running on that machine listening to a specific 352 port. (A good real world analogy is that an IP address is like a 353 building number, and a port is like a mailbox number for an apartment 354 in that building.) Like IP packets, UDP packets are delivered on a 355 "best effort" basis - UDP packets are not guaranteed to arrive in order 356 or arrive 357 at all. Each UDP packet is a self contained unit, like 358 a single piece of mail.</li> 359 <li>TCP: TCP is another high level protocol that rides inside of IP 360 packets. TCP also uses ports to target specific applications, but 361 unlike UDP 362 where the port works kind of like a mailbox for single packets TCP uses 363 the ports to establish connections between two applications that last 364 for a longer time. The real world analogy is that of a telephone 365 connection - instead of hanging up and redialing after each word you 366 stay on the connection that you already made. Unlike UDP, TCP 367 guarantees that the data sent will arrive and it will be in order. TCP 368 does this by adding meta data to each packet that allows it to detect 369 when a packet has been lost or arrived out of squence.</li> 370 </ul> 371 <p>In addition to IP, UDP and TCP there are additional protocols that 372 help. Examples include ICMP, ARP, and DNS. Most of these other 373 protocols work silently in the background so you do not need to worry 374 about them.</p> 375 <p>TCP/IP is a fairly comprehensive protocol and it can be ver 376 complicated. A full implementation requires more memory than is usually 377 available on an old PC. With some sensible performance and feature 378 trade-offs it is possible to get a reasonably complete TCP/IP 379 implementation running on an old PC with decent performance. Smaller 380 machines can run TCP/IP, but they often wind up making trade-offs that 381 hurt performance or limit features.</p> 382 <p><img style="width: 150px; height: 158px;" alt="carrier pigeon line drawing" src="carrier_pigeon.jpg" align="right">While most people associate TCP/IP with high performance 383 networking, 384 it can be used on very low performance networking technologies. For 385 example:</p> 386 <ul> 387 <li>Bongo drums (<a href="http://eagle.auc.ca/%7Edreid/index.html">http://eagle.auc.ca/~dreid/index.html</a>)</li> 388 <li>Carrier pigeon (<a href="http://www.ietf.org/rfc/rfc1149.txt">http://www.ietf.org/rfc/rfc1149.txt</a>)</li> 389 </ul> 390 <p>I would stick to classic Ethernet over these two alternatives - they 391 tend to drop a lot of packets.</p> 392 <h2><a name="DOS_and_TCPIP"></a>DOS and TCP/IP 393 </h2> 394 <p>As noted earlier, DOS generally predates the widespread use of 395 TCP/IP. That means that TCP/IP is going to be a feature of your 396 programs and not integrated into the operating system at all.</p> 397 <p>On a DOS PC there are generally two ways to used TCP/IP in 398 applications:</p> 399 <ul> 400 <li>TCP/IP is built into an application that does something with it, 401 like 402 transfer files or update the time. Examples include the NCSA Telnet 403 program, programs that use the WATTCP TCP/IP library or programs that 404 use the 405 mTCP TCP/IP library. </li> 406 <li>TCP/IP is provided a Terminate and Stay Resident (TSR) program 407 that is loaded as a separate piece of software. After loading the 408 TCP/IP 409 TSR you then run another application which uses it to do something. The 410 application accesses TCP/IP through a software interrupt. A good 411 example of this is Trumpet by Peter Tattam.</li> 412 </ul> 413 <p>The first approach generally works well because the TCP/IP code and 414 application are combined together in one program, reducing complexity 415 and improving performance. But it also makes every application that 416 needs the TCP/IP code bigger in size because the application has to 417 include its 418 own copy of TCP/IP. A change to TCP/IP also requires all of the 419 affected programs to be updated. On the other hand, the TCP/IP code is 420 included can be tailored and customized to the specific application. 421 </p> 422 <p> The second approach allows multiple applications to share the 423 TCP/IP code, allowing them to be smaller on disk. If the TCP/IP code 424 needs to be changed the programs do not need to change too - you can 425 just swap out the TCP/IP part. This makes the TCP/IP code more of an 426 operating system extension or a dynamically shared library that other 427 programs can use. But performance is not as good as with the first 428 approach and the 429 "one size fits all" philosophy leads to some design compromises that 430 may not be good for the individual programs. 431 </p> 432 <p>The approach that you choose will probably be driven by the 433 applications that you want to use. A pragmatic approach says to find 434 the application that you like and use that, letting it worry about 435 about how it gets access to TCP/IP services.</p> 436 <h2><a name="A_Warning_About_DOS"></a>A warning About old PC 437 hardware and DOS</h2> 438 <p>If you are not comfortable installing new hardware in your machine, 439 editing CONFIG.SYS, or trying to debug hardware that has not been 440 supported in years, then TCP/IP in DOS is not for you. At 441 a minimum you are going to have to:</p> 442 <ul> 443 <li>Install your Ethernet hardware. This implies successfully 444 avoiding IRQ and port conflicts on your system.</li> 445 <li>Get the right cabling. Cabling for newer adapters using RJ45 446 jacks 447 and CAT5 wiring is generally easy but older adapters using Thinnet or 448 AUI 449 can be challenging and difficult to diagnose if problems arise.</li> 450 <li>Find the right packet driver for your adapter and parameters. 451 Older adapters often have open source packet drivers and are well 452 understood. If 453 your adapter does not have a packet driver you might be able to use an 454 ODI 455 or NDIS driver with a "shim" that makes it look like a packet driver.</li> 456 <li>Possibly debug your network setup. Not all problems will be the 457 fault of the old PC. Bad cabling, flakey routers, and network 458 configuration problems are not unheard of.</li> 459 </ul> 460 <p>On the other hand, the rewards are well worth it. Blasting files 461 around 462 the house at speeds ranging from 25KB per second (on a slow machine 463 with a parallel-port Ethernet adapter) to 600KB per second (on a high 464 end 386 with a 16 bit NE2000 compatible adapter) sure beats the heck 465 out of 'sneakernet.' And once it is setup there is little to no 466 maintenance required to keep it setup.</p> 467 <h2><a name="Packet_drivers"></a>Packet drivers</h2> 468 <p>At the beginning of the networking era for DOS PCs there were very 469 few 470 network adapters to choose from and network applications were highly 471 specialized. As a result, networking applications generally included 472 code to talk to a few specific models of network adapters directly. 473 This 474 was a simple approach that worked back when there were few network 475 adapters, but you can see a few problems with it.</p> 476 <ul> 477 <li>If a new network adapter were introduced none of the existing 478 applications would be able to use it.</li> 479 <li>Even if the applications changed to support the new network 480 adapters 481 coming out the applications would have to grow to accomodate all of 482 them or you would have to have several versions of the same program, 483 each targeting a specific network adapter.</li> 484 <li>If there was a bug in the network adapter part of the code the 485 whole 486 application had to be shipped again.</li> 487 </ul> 488 <p>This was not a sustainable way to do software development.</p> 489 <p> 490 In 1986 FTP Software Inc. created the PC/TCP Packet Driver 491 specification which defined an API for sending and receiving packets 492 over networking devices. A device manufacturer needed to provide a 493 packet driver, which was a small TSR that provided the API in the form 494 of software interrupts. Application software would use the API to send 495 and receive packets. Decoupling the network hardware programming from 496 the applications made the applications smaller and less complex while 497 allowing them to handle new adapters with no changes, provided that the 498 new adapters provided a packet driver. The packet driver for an adapter 499 is 500 effectively the device driver for the adapter.</p> 501 <p><img style="width: 361px; height: 206px;" alt="Packet driver diagram" src="packet_driver_diagram.gif" align="right">Another way to look at 502 it is that your networking software never really 503 talks directly to the networking hardware. It talks to the packet 504 driver for that hardware, and as far as the networking software is 505 concerned all packet drivers all look and behave the same way. The 506 complexity of the hardware is hidden by the packet driver. An 8-bit 507 Western Digital WD8003 Ethernet card from 1989 is very different from a 508 NE2000 clone in a 486 PC, yet the packet drivers for each card make 509 them look the same to the rest of the system. 510 </p> 511 <p>Inside the packet driver is code to talk to a specific piece of 512 hardware. That hardware might be a network adapter, an Ethernet chipset 513 connected through the parallel port, or even just a plain serial port. 514 Your TCP/IP code really does not care because the packet driver 515 provides a consistent way to send packets and receive packets from the 516 chosen network hardware. A packet driver makes the hardware and network 517 accessible in an easy manner.</p> 518 <p>The PC/TCP packet driver specification can be found at <a href="http://crynwr.com/packet_driver.html">http://crynwr.com/packet_driver.html</a> 519 .</p> 520 <p>The Network Driver Interface Specification (NDIS) is a similar API 521 used primarily with Microsoft Windows. Open Data-Link Interface (ODI) 522 is another similar API that was used primarily by Novell NetWare and 523 Apple Macintosh environments. If your adapter does not provide a packet 524 driver you might be able to use DIS_PKT which provides NDIS to packet 525 driver translation or ODIPKT which provides ODI to packet driver 526 translation. 527 </p> 528 <h2><a name="Using_a_packet_driver"></a>Using a packet driver</h2> 529 <p>Packet drivers are usually specific to a particular model of 530 Ethernet device. Here are some places to look for a packet driver for a 531 specific Ethernet device. 532 </p> 533 <ul> 534 <li>The original floppy disks or CD-ROM that came with your Ethernet 535 adapter</li> 536 <li>Crynwr software, the author of many open source packet drivers 537 for older adapters: <a href="http://crynwr.com/drivers/">http://crynwr.com/drivers/</a> 538 .</li> 539 <li>Georg Potthast's site: <a href="http://www.georgpotthast.de/sioux/packet.htm">http://www.georgpotthast.de/sioux/packet.htm</a></li> 540 <li>The Internet - just Google for your adapters model number</li> 541 </ul> 542 <p>The packet driver is a DOS TSR (Terminate and Stay Resident) 543 utility. When a TSR returns you to the command line it has stopped 544 running, but it leaves itself loaded in memory which allows other 545 programs to call it and use the code. This behavior makes it look like 546 an extension to DOS; once it is loaded your computer knows how to do 547 something new. (In this 548 case, talk to a piece of networking hardware.)</p> 549 <p> 550 When the packet driver loads it is going to look for the Ethernet 551 adapter and 552 try to communicate with it to ensure that the Ethernet adapter is 553 available. To find the Ethernet adapter, the packet driver is going to 554 talk to a 555 set of I/O ports. Usually you have to specify those I/O ports on the 556 command line of the packet driver. If the packet driver can not find 557 the expected Ethernet adapter at the specified I/O ports, it will give 558 up and not load itself.</p> 559 <p>The packet driver will probably require other command line options 560 too: 561 </p> 562 <ul> 563 <li>Which IRQ to use: most networking hardware 564 requires an IRQ to function.</li> 565 <li>Which software interrupt to use: explained below</li> 566 <li>Hardware specific options: these depend on your 567 Ethernet adapter</li> 568 </ul> 569 <p> 570 As mentioned earlier, all packet drivers talk to higher level software 571 using the packet driver interface/programming API. The packet driver 572 makes itself available to higher level software by taking control of a 573 software interrupt. After the packet driver is installed, other 574 software will use the packet driver by setting parameters and issuing 575 the software interrupt.</p> 576 <p> 577 For this system to work you need to tell the packet driver what 578 software interrupt it should claim. You also need to tell the other 579 software what software interrupt that the packet driver is listening 580 too. The software interrupt to use is usually specified on the command 581 line when the packet driver is loaded. Here are some examples:</p> 582 <p> 583 Davicom 9008 Ethernet card (an NE2000 clone) in an AMD 386-40 using 584 software interupt 0x60. The hardware interrupt is 0xA and the 585 hardware I/O port address is 0x300. 586 </p> 587 <div style="margin-left: 40px;"> 588 <table style="text-align: left; background-color: rgb(192, 192, 192);" border="1" cellpadding="3" cellspacing="0"> 589 <tbody> 590 <tr> 591 <td><code>C:\PACKET>pkt9008 0x60<br> 592 Packet driver for UM9008, version 11.4.3<br> 593 Packet driver skeleton copyright 1988-93, Crynwr Software.<br> 594 <br> 595 System: [345]86 processor, ISA bus, Two 8259s<br> 596 Packet driver software interrupt is 0x60 (96)<br> 597 Interrupt number 0xA (10)<br> 598 I/O port 0x300 (768)<br> 599 My Ethernet address is 00:80:AD:C9:14:50</code></td> 600 </tr> 601 </tbody> 602 </table> 603 </div> 604 <br> 605 <p><a href="http://www.brutman.com/Dos_Networking/xircom_pe3.html">Xircom 606 PE3 10BT Parallel-port to Ethernet Adapter</a> running on a PCjr 607 with software interrupt 0x61 and hardware interrupts disabled.</p> 608 <div style="margin-left: 40px;"> 609 <table style="text-align: left; background-color: rgb(192, 192, 192);" border="1" cellpadding="3" cellspacing="0"> 610 <tbody> 611 <tr> 612 <td><code>C:\ETHERNET\PACKET>pe3pd sint=61 int=0<br> 613 <br> 614 Xircom Pocket Ethernet Adapter III Packet Driver, V3.08 (940920)<br> 615 Packet Driver (C) Copyright 1990-1994 Xircom Inc.<br> 616 <br> 617 Configuration: SINT 0x61, LPT2:, No IRQ, Bidirectional<br> 618 <br> 619 Ethernet Address: 00:80:C7:2E:F3:3B</code></td> 620 </tr> 621 </tbody> 622 </table> 623 </div> 624 <p>At this point your machine is physically ready to talk on your 625 network. 626 A "software service" for sending and receiving raw Ethernet packets is 627 in place, courtesy of the packet driver. </p> 628 <h2><a name="Choosing_Hardware"></a>Choosing 629 Hardware</h2> 630 <p>There are lots of factors that go into choosing networking hardware. 631 Here is my set of criteria:</p> 632 <ul> 633 <li>Can I get the hardware for my machine? A 634 machine 635 with a 16 bit ISA bus or PCI bus is easy to find hardware for. 636 A machine with 8 bit PC bus slots or non-standard slots is 637 much more difficult to find networking hardware for.</li> 638 <li>Does the selected hardware have a good packet driver? 639 A good packet driver not only makes the adapter work, but it 640 affects performance. Not having a packet driver might not be a deal 641 breaker; you may be able to use an NDIS or ODI driver with a "shim" 642 that makes those look like a packet driver. But having a real 643 packet driver is preferable.</li> 644 <li>Can I connect it to my network? Newer adapters 645 use 646 twisted pair wiring (CAT5) with an RJ45 connector. Before 647 twisted pair was standardized there were non-standard adapters that 648 used 649 twisted pair, there was 'Thinnet', and there was 'Thicknet'. 650 Be prepared to dive into the world of AUI adapters, BNC 651 jacks, transceivers, hubs and switches if you choose an older adapter.</li> 652 </ul> 653 <span style="font-weight: bold;"> 654 </span> 655 <p>For 16 bit ISA bus machines you can use nearly anything. I 656 would look for a adapter from a well-known manufacturer with an RJ45 657 connector and a good packet driver. 3Com, Intel, and 658 NE2000 compatible adapters are safe bets.</p> 659 <p> 660 For 8 bit ISA bus machines your choices are more limited. The 3Com 661 3C503 based adapters are good choices. Western Digital/SMC 8003 based 662 adapters and NE1000 adapters are good as well. I have not experienced 663 one but I have read in many places that if you find a 3Com 664 3C501 based adapter 665 that you should burn it and bury it. Some 16 bit cards might 666 be able to function in an 8 bit slot, but you will have to experiment 667 with that.</p> 668 <p> 669 For machines without slots or where you want a temporary solution I 670 would use a parallel-port to Ethernet adapter. The <a href="xircom_pe3.html">Xircom 671 PE3-10BT</a> is a good example of this type of adapter. It 672 connects to the machine using the parallel port and the packet driver 673 makes it look just like a real Ethernet adapter. But the 674 overhead of the parallel port does hurt performance, so while it is a 675 good basic solution it will never beat the performance of an Ethernet 676 adapter on a card.</p> 677 <p> 678 Of course you might have a machine new enough to have PCI slots or an 679 Ethernet adapter on the motherboard. If you 680 are running DOS on such a high powered machine, I applaud you. :-)</p> 681 <h2><a name="Some_notes_on_networking_software"></a>Some notes on 682 networking software</h2> 683 <p>There is a lot of software out there for networking using a packet 684 driver and there are already a lot of resources on the Internet that 685 describe those resources. Here are some notes on the ones that I have 686 tried. 687 </p> 688 <h3>NCSA Telnet</h3> 689 <p style="margin-left: 40px;">NCSA is a great Telnet program for DOS. 690 Features include:</p> 691 <ul style="margin-left: 40px;"> 692 <li>VT100 emulation</li> 693 <li>Multiple sessions to different computers at the same time</li> 694 <li>FTP server </li> 695 </ul> 696 <p style="margin-left: 40px;">Stated requirements are DOS 2.0 and a 697 80286 or better CPU. It will 698 run with a NEC V20 and it might be possible to recompile it to get rid 699 of the 80286 specific instructions.</p> 700 <p style="margin-left: 40px;"> 701 NCSA Telnet has its own TCP/IP software built in to the application so 702 a separate TCP/IP stack such as Trumpet is not necessary. NCSA Telnet 703 can use a packet driver or it can talk directly to several different 704 Ethernet cards without the need for a packet driver. (They switched to 705 a packet driver interface when the variety of Ethernet cards 706 mushroomed.) The FTP server is very old and it does not support PASSIVE 707 mode connections. I don't think it supports the PORT FTP command 708 either, so you will have to work hard to find an FTP client that will 709 work with it. (It assumes a specific data transfer port number, which 710 is what was standard years ago. The mTCP FTP client is compatible with 711 the FTP server.) 712 </p> 713 <p style="margin-left: 40px;">One of the great things about NCSA Telnet 714 is that the source code is 715 readily available for download - with the correct build environment, 716 you can modify it!</p> 717 <p style="margin-left: 40px;"> 718 The NCSA Telnet home page is gone, but the files can still be 719 downloaded using ftp at ftp://ftp.ncsa.uiuc.edu/Telnet/DOS/ .</p> 720 <h3>Trumpet for DOS</h3> 721 <p style="margin-left: 40px;">Trumpet is a DOS TSR (Terminate and Stay 722 Resident) that adds TCP/IP 723 functions to your system. On one side it talks to a packet driver to 724 move data in and out of your Ethernet card, while on the other side it 725 provides TCP/IP functions to your application. Applications wishing to 726 use Trumpet communicate with it using a software interrupt, in much the 727 same way that Trumpet or other TCP/IP stacks talk to a packet driver.</p> 728 <p style="margin-left: 40px;"> 729 Trumpet came with some sample applications including an FTP client, IRC 730 client, and a finger client. Other applications were written to use it 731 too. Trumpet published the programming interface to their TCP/IP stack, 732 but the source code is not available. So you can use it, but you will 733 have to live with any bugs and limitations.</p> 734 <p style="margin-left: 40px;"> 735 Unfortunately the web pages for Trumpet are gone now. Search for 736 tcp201.zip to find an archive of it on the Internet.</p> 737 <h3>WATTCP</h3> 738 <p style="margin-left: 40px;">WATTCP is a TCP library that is linked 739 with specific applications. 740 There is a 16 bit real mode version for use on the older machines and a 741 32 bit protected mode version for newer machines. The 32 bit versions 742 compile under a variety of C compilers. 743 </p> 744 <p style="margin-left: 40px;">WATTCP is one of the older DOS TCP/IP 745 implementations and one of the 746 most widely used. I do not have a lot of experience with WATTCP (yet) 747 because I got sidetracked with writing my own TCP/IP library. I had a 748 fairly long email conversation with Erick Engelke about WATTCP and the 749 lessons he learned, and it was suprising how much of his work I 750 duplicated. :-)</p> 751 <p style="margin-left: 40px;"> 752 WATTCP can be found at its new home: <a href="http://www.erickengelke.com/wattcp">http://www.erickengelke.com/wattcp</a></p> 753 <h3>mTCP</h3> 754 <p style="margin-left: 40px;">mTCP is a TCP library and a set of 755 applications that I started 756 working on in late 2006. It is designed for low spec machines like the 757 original IBM PC, PCjr, PC XT, PC AT, PC Convertible, etc. All of the 758 code is 16 bit and most of the programs will run on a 265K system using 759 DOS 2.1 or better. The library includes features like DNS, IP 760 fragments, automatic retransmission of lost packets, listening sockets 761 for server applications, some ICMP support, etc.</p> 762 <p style="margin-left: 40px;">The current list of applications includes 763 a DHCP client, Telnet 764 client, IRC client, Simple Network Time Protocol (SNTP) client, FTP 765 client, FTP server, HTTP server, Ping, Netcat, HTGet (an HTTP file fetcher) and PktTool (a diagnostic tool).<br> 766 </p> 767 <p style="margin-left: 40px;">More information on mTCP can be found at <a href="http://www.brutman.com/mTCP/mTCP.html">http://www.brutman.com/mTCP/mTCP.html</a> 768 .</p> 769 <h2><a name="Additional_resources"></a>Additional resources</h2> 770 <p>This page barely scratches the surface of DOS networking. Most of my 771 experience has been with packet drivers and related software; a list of 772 additional resources is provided to help you understand packet driver 773 based solutions and other solutions that I mentioned earlier. 774 </p> 775 <ul> 776 <li>"DOS Networking HOWTO": <a href="http://www.dendarii.co.uk/FAQs/dos-net.html">http://www.dendarii.co.uk/FAQs/dos-net.html</a></li> 777 <li>"FAQ: DOS Applications for Internet Use": <a href="http://www.dendarii.co.uk/FAQs/dos-apps.html">http://www.dendarii.co.uk/FAQs/dos-apps.html</a></li> 778 <li>"MS-DOS Networking": <a href="http://bbright.tripod.com/information/dosnetwork.htm">http://bbright.tripod.com/information/dosnetwork.htm</a></li> 779 <li>"FreeDOS Networking with VirtualBox 4.x": <a href="http://lazybrowndog.net/freedos/virtualbox/">http://lazybrowndog.net/freedos/virtualbox/</a></li> 780 <li>"DOS TCP/IP: DOS TCP/IP connectivity from scratch": <a href="http://users.telenet.be/mydotcom/library/network/dostcpip.htm">http://users.telenet.be/mydotcom/library/network/dostcpip.htm</a></li> 781 <li>"Trumpet TCP Driver for DOS": <a href="http://www.pld.ttu.ee/%7Epriidu/library/net/trumpet.html">http://www.pld.ttu.ee/~priidu/library/net/trumpet.html</a></li> 782 783 <li>"The packet driver specification": <a href="http://crynwr.com/packet_driver.html">http://crynwr.com/packet_driver.html</a></li> 784 <li>"NetBIOS, NetBEUI, NBF, NBT, NBIPX, SMB, CIFS Networking": <a href="http://timothydevans.me.uk/nbf2cifs/nbf2cifs.pdf">http://timothydevans.me.uk/nbf2cifs/nbf2cifs.pdf</a><br> 785 </li> 786 </ul> 787 <hr> 788 <p style="font-style: italic;">Created August 13th 2007, last updated April 2nd, 2020<br> 789 (C)opyright Michael B. Brutman, mbbrutman at gmail.com</p> 790 </body> 791 </html>