
This is the quick version of setting up mTCP. The detailed instructions
for the DHCP client can be found in DHCP.TXT
and a more comprehensive setup guide can be found in SETUP.TXT.
mTCP requires a packet driver be loaded, an environment variable be
set, and a
configuration file be created before it can run. These three things
allow
it to talk to your Ethernet card and find the configuration settings
that it needs. Here are the high level steps for getting
started:
- Load the packet driver for your Ethernet card
- Set the MTCPCFG environment variable to point at your mTCP
configuration file
- If using DHCP, run the DHCP client
That's it!
Here are the details ...
Loading the Packet Driver
(Note: If you are using
PPP or SLIP
the general procedure is the same. But see SETUP.TXT for some details
that apply only to PPP and SLIP.)
mTCP does almost everything except talk to your Ethernet card. There
are a lot of Ethernet cards out there and they all use different
hardware and look different at the hardware level. To make mTCP able to
use a wide variety of Ethernet cards a piece of code called a
'packet driver' gets loaded first. Each Ethernet card comes with a
packet driver designed for that specific Ethernet card and that packet
driver is responsible for making the Ethernet card look like a standard
device. mTCP talks to the packet driver in a generic
way
while the packet driver converts the requests to something meaningful
for your Ethernet card. That keeps mTCP from having to know the details
of every Ethernet card out there - it just has to know how to talk to
packet drivers.
You have to have the correct packet driver for your Ethernet card. A
lot of packet drivers can be found at http://www.crynwr.com/drivers/.
That site covers most of the classic cards like the 3Com 3C503, the
NE1000, the Western Digital/SMC 8xx3 series, etc. If you have a newer
card on the PCI bus you can try the manufacturer's web site, or look
for the CD-ROM that came with the card - the packet driver will be in
the DOS software directory. A lot of PCI cards have packet drivers, but
I imagine that as DOS becomes a distant memory that will be less likely.
The parameters on the packet drivers will vary but one that you will
always have to provide is the software interrupt number that the packet
driver is going to take control of. The software interrupt
number is the address of the 'service' that the packet driver is going
to provide to mTCP applications, and that service is the ability to
send and receive packets on the Ethernet hardware.
Note that the software interrupt number has nothing to do with the
configuration of the Ethernet hardware. The software
interrupt number is assigned by you and you are telling the packet
driver which software interrupt to use. Software interrupt
numbers are usually in the range of 0x60 (hex) to 0x66 (hex). You need
to pick one that is not in use already but since most DOS
software does not these software interrupts 0x60 is usually available.
This is in contrast to hardware interrupt numbers, which is what the
Ethernet card uses to signal to the computer that new packets have
arrived. Hardware interrupts are set on the card using jumpers or by
configuration software that comes with the card.
Here is an example showing an NE2000 clone card being loaded using the
default I/O ports and IRQ3 . It is also being told to use
software interrupt 0x60:
ne2000
0x60 3
Here is another example featuring an older Western Digital 8003 card:
smc_wd
0x60 0x03 0x280 0xD000
In this example the software interrupt to use is 0x60, the IRQ is 3,
the I/O ports start at 0x280, and the shared memory address for the RAM
on the card is going to be located at 0xD000:0000 in memory.
For a general discussion on packet drivers see the DOS Packet
Drivers page.
Creating the configuration file
Next it is time to create the configuration file. You generally have to
do this just once.
mTCP requires a configuration file to tell it things like the IP
address to use, where the nameservers are, etc. There are two ways to
create this configuration file:
- DHCP Configuration: DHCP is a network protocol that allows
a
machine to find out what its IP address, netmask, and other parameters
are automatically. If you have a router at home that hands out network
addresses then this is what you want to use.
- Building it by hand: An alternative if you don't have a
DHCP server or don't want to use it.
If you are going to use DHCP you can get by with just two lines
in the
configuration file. One line tells mTCP which software interrupt to
use
to talk to the packet driver. The other assigns a hostname to your
machine. Here is an example of a minimum
configuration file for mTCP:
PACKETINT
0x60
HOSTNAME PCjr
Just create a file with these lines, substitute in the correct
software interrupt value and hostname for your machine, and you can
move onto the
next step. (The
PACKETINT parameter here needs to be set to whatever software interrupt
you told the packet driver to use. Hostname can be whatever you like,
but don't make it too long or use punctuation.)
If you are going to use static configuration you have a little more
work. Here are the lines you need to add and fill in correctly:
PACKETINT
0x60
IPADDR 192.168.2.6
NETMASK 255.255.255.0
GATEWAY
192.168.2.1
NAMESERVER 68.115.71.53
MTU 1500
HOSTNAME PCjr
And of course, fill in the correct values for your network.
All of the mTCP programs read the configuration file each time they
start. Besides holding network parameters the configuration file can
hold configuration settings for the applications. Those additional
settings are documented by each application.
Setting the MTCPCFG environment variable
Next you need to set an environment variable to point to the
configuration file. All of the mTCP code looks for the environment
variable first - if it doesn't find it, it doesn't run. If the
environment variable is set correctly then the mTCP code will be able
to find the configuration file.
set
MTCPCFG=c:\packet\tcp.cfg
That's it! You can put this in AUTOEXEC.BAT or another batch file that
you run before you start using mTCP. Be sure to put the location of
your file in place of "c:\packet\tcp.cfg". I suggest using a full path
name starting with a drive letter (as shown above) so
that mTCP can always find the file. Another good idea is to
place the mTCP programs on your PATH so that you can find the mTCP
programs no matter what subdirectory or drive you are in.
Running the DHCP Client
If you have the packet driver loaded and the MTCPCFG environment
variable pointing at a good configuration file you are ready to run
DHCP. DHCP is really simple to run - just type dhcp and go! If your
setup is correct and it makes contact with a DHCP server on the network
it will get an IP address and other settings and write them to the
configuration file for you.
Here is a screen shot of a DHCP run from one of my systems:
Now you can run one of the mTCP applications, like Telnet, FTP or IRCjr.
Note that you only have to run DHCP.EXE once in a while. The
exact timing depends on your DHCP server, but a good rule of thumb is
once a day before you start using mTCP applications. If your
machine is acting strange and can't connect to other machines it will
not hurt you to run DHCP.EXE again - the DHCP server might have dropped
your machine due to a reset or a short lease time. (In the example
above my DHCP server handed out an address that was good for 86,400
seconds, which works out to 24 hours.)
Or, Static Configuration
If you have the packet driver loaded and the MTCPCFG environment
variable pointing at a good configuration file then you are ready to
run the mTCP applications right now.
Here is the list of network related variables that you should have set:
| Parameter Name |
|
Purpose |
|
Required
or Optional |
| PACKETINT |
|
This is the software interrupt number that the packet
driver is
listening on. This should match the software interrupt number
that you
told the packet driver to use.
|
|
Required |
| IPADDR |
|
IP
address of this machine
(eg: 192.168.2.3) |
|
Required |
| NETMASK |
|
Network mask setting for your local area network (eg:
255.255.255.0) |
|
Required |
| GATEWAY |
|
The
IP address of your router (eg:
192.168.2.1) If you don't provide this or if you set it wrong
you will not be able
to communicate with machines that are not directly connected to your
LAN. |
|
Optional |
| NAMESERVER |
|
If you don't provide this or if you set it wrong you
will not be able to convert machine names to IP addresses.
|
|
Optional |
| MTU |
|
The
MTU size for your Ethernet. The default is 576
bytes. Ethernet can use 1500 bytes.
|
|
Optional |
| HOSTNAME |
|
A fun name for your machine. Don't make it too long or
use punctuation. |
|
Optional |
It is recommended that the values marked 'optional' are provided.
Otherwise, you will lose functions like routing to other networks, DNS
lookups, etc.
For more information ...
Please see DHCP.TXT for
details on the DHCP client and SETUP.TXT
for a comprehensive guide to setting up mTCP. For
most people the information on this page is
far more than you need to get going, but if you want all of the details
and some tips SETUP.TXT is the place to go. (SETUP.TXT gets updated for
each release of mTCP.)
Created July 31st, 2008, Last updated July 29th, 2011
(C)opyright Michael B. Brutman, mbbrutman@gmail.com