Need to run multiple tasks but have only a standard dial-up connection to the host? Term may be the answer you have been looking for.
Term, originally developed by Michael O’Reilly (email@example.com), is a program that allows multiple, concurrent connections over a serial line. Term allows almost all “standard” TCP/IP applications to be used on a Unix system that is connected by a serial connection to a networked Unix system. Unlike other common serial protocols, such as SLIP and PPP, term does not require non-user administrative maintenance, and requires no modifications to the host kernel. This means that virtually any user with a login shell on a dialup system can utilize network utilities that were once limited to SLIP/PPP users.
Unlike SLIP or PPP, your machine does not have its own IP address. All incoming traffic must be addressed to your remote host, and it will be directed to your local computer by term.
Term essentially works by redirecting packets on your remote host directly to your local Unix system. This allows any incoming network packets to reach your computer by proxy, via your remote dial-up computer. The same basic idea works for outgoing packets as well: local sockets on your computer are redirected to your remote host, and sent on their way to their actual network destination.
The entire term package is a basic suite of utilities and libraries that allow you to establish these network connections. These utilities are:
- term: This is the actual daemon that is run on both the remote and local computers. This establishes the bridge that is needed to link your computer to the remote host and the rest of the network.
- tredir: This is the most commonly used utility that comes with term. It allows the user to manually redirect an outgoing or incoming port for use with non term applications, for example redirecting the SMTP (e-mail) port so that the user may send or receive e-mail.
- tmon: This utility monitors and displays the incoming and outgoing traffic over your serial line. Two bar graphs are displayed showing the levels of traffic, updated each second. This allows you to monitor just how much bandwidth you are using at any time while using term.
- trsh: This utility allows you to quickly access your remote login shell, much like rsh or rlogin would allow you to. This allows you to perform routine network tasks from your account if needed.
- tupload: Much like sz, this utility is used to transfer files to or from your remote account, depending on which “end” of the term-link it was executed from.
- txconn: When you need to display an X application remotely, or have one displayed on your local screen, txconn establishes the needed redirection to make this possible. (The same effect can be created with tredir, as will be explained later.)
- Other applications: Recently, a flurry of activity has resulted in a few more term clients such as tudpredir, a udp port redirector; tdate, which sets your computer’s time by the Network Time Protocol; and “download, which reciprocates what tupload does.
Before you can actually run term, you should run a utility called linecheck on the remote and local computers.
Linecheck is used to check the ”transparency“ of the link, by seeing which 8-bit characters are transmitted across the link. The results of linecheck are used to configure term to operate correctly and optimally.
To run linecheck:
- Using a communications program, log into your account on the remote system and run:
linecheck linecheck. log
- Suspend your comm program (^Z under kermit), otherwise it will steal characters from linecheck.
- On the local system, run:
linecheck linecheck.log > /dev/modem < /dev/modem
After linecheck has completed its operation, examine the two linecheck.log files. At the bottom of these files will be an indication of which characters you must escape in your .termrc configuration file. The messages in linecheck.log give the characters (if any) that need to be ignored on one end and escaped on the opposite end of the link. For example, if my local results indicated that I should escape 3 4 and 121, my resulting .termrc files would have something like this in them:
Local: escape 34 escape 121
and my remote .termrc:
ignore 34 ignore 121
because I have to ignore escaped characters on the other end.
Term is very flexible with many configuration options on the command line as well as in the .termrc file. Running term is much like running linecheck:
- Using a communications program, dial up your remote account and log in
- Start term from that account. A sample command line might be:
term -l $HOME/tlog -s 38400 -c off -w 10 -t 150 -r
This command line indicates:
- Set the log file to tlog in your home directory
- Set the line speed to 38400 bps
- Turn off term’s compression (presumably because your modem does better compression)
- Use a window setting of 10 (explained in the term documentation)
- Use a timeout of 150 (explained in the term documentation)
- Set this as the ”remote“ side
- Shell back to your local computer, either by suspending your terminal program, or using its built-in shell features. For Kermit, use ctrl-Z, for xcomm use ctrl-a-x. (Check your specific terminal program’s own documentation.)
- Initiate term on your local computer:
term -c off -l $HOME/tlog -s 38400 -w 10 -t 150 < /dev/modem > /dev/modem &
The only difference in this case is the redirection to the modem device and lack of the -r option.
It should be noted that all of the command-line arguments can be placed in the . termrc file so you need only type term by itself to initiate it:
.termrc: compress off speed 38400 window 10 timeout 150
Note that you will still need to put the redirection on the command line.
Using the Standard Term Clients
The standard term clients trsh, tredir, tmon, ”upload, and txconn are relatively easy to use. The most commonly used utility is trsh.
trsh is used to access your remote account as if you were using rlogin to access it. trsh can also act like rsh and execute commands on your remote host:
% trsh Remote: term 2.0.4 tty /dev/ttyp4. exec /usr/local/bin/tcsh foober : /home/ j oeuser% % trsh -s uptime 1:15am up 20 days, 17:30, 3 users, load average: 1.00, 1.00, 1.00
The most utilitarian of the term clients, this command allows you to manually redirect TCP/IP ports for use with term. For example, to allow incoming telnet sessions to your home computer, you need to redirect a port on the remote host to your own telnet port, which is port 23. The common command format of tredir is:
tredir [thiscomputer: ]port [thatcomputer: ]port
By default, the first port is the port on the machine you are running the command on, the second port is the port value on the other computer you are redirecting to.
In this example, I want to redirect port 4000 to my own port 23:
remotehost% tredir 4000 23 Redirecting 4000 to 23 remotehost% telnet localhost 4000 Trying . . . Connected to localhost. Escape character is '^] ' Linux 1.1.35 (linuxbox) (ttyp3) linuxbox login:
Another example of use of tredir is to configure your system to allow reading news via your network’s NNTP news server. This requires a tredir on the local side of term, instead of the remote:
linuxbox% tredir 119 news. server.com: 119 Redirecting 119 to news.server.com:ll9 linuxhox% export NNTPSERVER=localhost linuxbox96 trn[normal trn session follows]
Notice that in this example the NNTPSERVER variable is set to localhost. This is because the local 119 port has been redirected to the real network NNTP server. So any connections to the localhost NNTP port is redirected to the real one on the remote computer. A direct connection to the actual NNTP server (setting NNTPSERVER to news.server. com) would not be possible on a term link, unlike SLIP/PPP which would allow this. tredir makes possible the use of many applications that use standard TCP sockets, such as sendmail, IRC, MUD’s, MUCK’s, and many other similar multi-user games.
This is the term equivalent of sz or other file upload/download protocols. It allows the transfer of files from the local machine to the remote, or vice-versa, depending on which end the command is initiated. Commonly, the command line would look like:
linuxtox% tupload foot tar. gz
Which would send a copy of the file foo.tar.gz to the remote host. Some useful flags are illustrated below:
linuxbox% tupload -vv -p -16 foo.tar.gz Changing priority to -16 sending foo.tar.gz 30651 of 259727 (11%), current CPS 3083. ETA: 76.8 TT: 84.2
The -vv flag means give verbose messages on the status of the upload, while -p means change the term priority of the upload. This prioritizing allows you to nice a term process so it doesn’t hog bandwidth from the other term applications you may be running. This is useful for large background transfers.
txconn is designed to ease the redirection of X applications from one host to another. If a user on computer2 wants to display an X application on your screen, you use txconn. Like using tredir, any incoming connections must use your remost host’s name or IP address to connect to you.
Because X is outwardly different than normal TCP/IP clients, it needs special handling for redirection. By itself, txconn uses no command line arguments:
remotehost% txconn Xconn bound to screen 9 :9
This means that your home X display can be accessed from the network as remotehost:9, meaning root window 9 on the remotehost. If a user on computer2 wants to send his xclock to your local display, he would type:
computer2% setenv DISPLAY remotehost:9 computer2% xclock &
After a few moments, the xclock he executed will appear on your display.
If you want to display an X application running on your computer to computer2’s display, you must use tredir. This is a bit confusing.
linuxbox% tredir 6004 computer2:6000 Redirecting 6004 to computer2:6000 linuxhox% export DISPLAY=localhost:4 linuxbox% xclock &
This may look a bit odd, but what you are doing is redirecting your display :4 (unused by you) to computer2’s default display of :0. Ports 6000-6100 represent displays :0 to :100. By redirecting your own display :4 to his :0, any X application on your local machine which uses display :4 will appear on computer2’s screen. It’s a bit convoluted, but it works effectively.
Other Term Clients
Because of the nature of term, applications that work with standard TCP/IP will not work without the use of tredir, and even then, they may not always work. For example, it would be impossible to use tredir for an application like NCSA Mosaic because it makes so many different connections to different hosts and services. Other applications, though they use a single network connection, don’t work because they use a secondary data port, such as ftp or IRC’s DCC protocol. Applications such as this require modification of the actual source code to utilize the term socket. Most popular applications such as Mosaic, lynx, ftp, ncftp and irc have already been modified for use with the term protocol.
If you compile these applications yourself, they must be linked with the term library, libtermnet.a (This library has replaced the old client.a library.) This library contains the needed instructions and symbols for using the term socket.
New developments in term have made it extremely easy for users to modify existing TCP/IP applications for use with term, without the massive source code modifications that were once required. By using drop-in replacements for common socket/networking functions such as connect(), gethostbyname(), and send(),you need only modify the Makenle of an application to make it term-compliant. This drop-in replacement is the libtermnet.a library, and a header file which translates standard networking calls into term-compliant calls. One interesting note is that a termnet-linked binary also works with normal TCP/IP, so if you ever change to SLIP or PPP in the future, your term-compliant binaries will still work!
Only two elements are needed in the Makefile to make a term-compliant binary. In the location where the INCLUDES are defined, you add:
adapting the path for your term source path, of course.
And in the LIBS or LDFLAGS section, you add:
If you have libtermnet.a or the libtermnet.so.2.0.* shared library installed in a common library path, -L/directory/path isn’t needed.
Hopefully, after adding these definitions, you end up with,` fully term-compliant binary. There are still a few shortfalls, of course. Many applications use non-standard socket calls, and termnet cannot fully control things like that. Also, the newly integrated (as I write) udp support in term is still very rough.
Applications such as Chimera, lynx, xarchie, rsh/rlogin and fsp are a few examples of successful tennnett~ng, and more are sure to follow.
With the implementation of termnet, the days of manual source-level hacking on most applications is over, and more and more applications that were once too hard to hand-patch term support into will be available to term users.
The Future of Term
After term116, the term development was passed on to Bill Riemers (firstname.lastname@example.org). Major additions to term have been introduced, such as udp support, which is getting better and better, and shared libtermnet, which allows easy upgrading of term versions without recompiling term-compliant binaries every single time. The udp support has enabled such applications as ytalk, xarchie and fsp to Work through term.
There are still a lot of things to complete and improve with term, but it’s a very successful and very useful tool for people who don’t have the resources to run full-blown SLIP or PPP. It is very good, and can only get better.