4 Setting Things Up

Contents of this section

4.1 What has to be available

Before you start building and using TERM you have to make sure that you have built TCP/IP support into the kernel. Furthermore, make sure that the TCP/IP loopback interface is activated. When this is the case you can go on with the rest of this section.

4.2 Explanation of concepts

In newer TERM version two new concepts have entered TERM. These two concepts will be explained in the next two subsections.

Sharing

Starting with version 1.16 the concept of sharing the TERM connection with other users has entered TERM. This means that when you enable shared features, other people can use the same TERM connection you are using, i.e. when you are working on your remote machine via your TERM connection (say, from your local machine you used trsh to get in) another person on your local machine can use the same TERM connection at the same time to ftp a file to his login on your local machine from an ftp site somewhere in the world.

When you disable shared features (i.e. you execute TERM in private mode) you and only you (we do not count root :-) can use the TERM connection.

Of course, you only need to install shared TERM at the end at which you want to allow people to use the same TERM connection you are using. So, if other people have a login on your local machine and they want to use it from somewhere on your remote network you enable shared features on the remote end of your TERM connection. In this way all these people can login on your machine at the same time sharing the same TERM connection with each other and with you. (NOTE: the first example needed shared features to be enabled at the local end of the TERM connection).

NOTE for installation as root: When you install TERM as root you have to create a 'term' group first (before compilation) with no member by adding the following line in '/etc/group':

  term::16:root

or any other unused GID than 16 when 16 is already in use.

After compilation and installation make TERM and its clients SGID 'term':

  chgrp term <term_client>
  chmod g+s <term_client>

Also any other program that you make TERM-aware must be made SGID 'term'.

Full TERM networking

Starting with TERM version 2.0.0 the statement full TERM networking is used. When your only connection with the outside world is a TERM connection, you have a full TERM network and you should build TERM with full TERM networking. In this case in the shared directory a file called termnet is placed. This tells TERM that your only connection to the outside world is via TERM.

When you also have some other type of network connection beside your TERM connection TERM-aware programs first try to fulfil their job using this network connection. When this fails TERM is invoked and it is tried to fulfil the job via the TERM connection. To make this more clear now an example is given in which TERM-aware telnet is used. This telnet should work both with and without TERM.

  telnet localhost

does not use TERM to connect, but

  telnet zeus.cs.kun.nl

will use TERM only if you do not have some other type of network connection.

Full TERM networking also means to lie about the host name, and say it is the remote host instead. Furthermore, it causes bind(0) to always act on the remote host. In essence it makes many programs unusable when they are not going through TERM, while TERM is running. Unfortunately, most UDP programs and daemons will not work with TERM without these nasty tricks.

4.3 Build TERM

When you are lucky, this should just involve a make. Most probably however, you need to do more. Due to new features in newer versions of TERM it is now a bit more complicated to create your TERM binary. A couple of ways can be followed to obtain your binary.

To cover all these ways TERM can be built this section will be split into three parts:

  1. Build TERM, versions 2.0.0 and higher
  2. Build TERM, versions 1.16 up to 1.19
  3. Build TERM up to version 1.15

Build TERM, versions 2.0.0 and higher

First, make sure you have read the section about 'full TERM networking' above.

For TERM versions 2.0.0 and higher there are many ways to build the TERM binary and the clients. All of these can be done both by root and by ordinary user:

  1. Build TERM in private mode without full TERM networking
  2. Build TERM in private mode with full TERM networking
  3. Build TERM in shared mode without full TERM networking
  4. Build TERM in shared mode with full TERM networking

In these versions of TERM a new way for compilation has entered TERM using the script configure. When configure is run it checks on what operating system you are trying to install TERM, whether the source directory is available or not, and if any runtime options are set. According to the things found configure then creates a Makefile using Makefile.in which is provided in the TERM package.

Two of the more important options to configure are --root and --user which state whether TERM will be installed by root or an ordinary user. Other options can be used to install TERM the way you want (non-standard paths for example).

  1. Build TERM in private mode without full TERM networking. To build TERM in this way you need to execute the following commands (both for root and ordinary user):
      ./configure --root  OR --user
      make install installman
    
    This builds the binaries and installs these binaries and the manual pages.
  2. Build TERM in private mode with full TERM networking. To build TERM in this way you need to execute the following commands (both for root and ordinary user):
      ./configure --root  OR --user
      make installnet installman
    
    This builds the binaries and installs these binaries and the manual pages.
  3. Build TERM in shared mode without full TERM networking. To build TERM in this way you need to execute the following commands (both for root and ordinary user):
      ./configure --root  OR --user
      make share installman
    
    This builds the binaries and installs these binaries and the manual pages.
  4. Build TERM in shared mode with full TERM networking. To build TERM in this way you need to execute the following commands (both for root and ordinary user):
      ./configure --root  OR --user
      make share installnet installman
    
    This builds the binaries and installs these binaries and the manual pages.

Build TERM, versions 1.16 up to 1.19

To build these versions of TERM you can now choose one of the following ways:

  1. As an ordinary user, build TERM in private mode
  2. As an ordinary user, build TERM in shared mode
  3. As root, build TERM in private mode
  4. As root, build TERM in shared mode

Below, it will be explained how to enable/disable shared features during the compilation of TERM.

  1. You are an ordinary user (no root access) and you do NOT want to SHARE the TERM connection with other users. As a user who does not want to share the TERM connection with other users you should do the following to build TERM:
      make DO=install OS-type
      make installman
    
    After this TERM, its clients and the manual pages are built and installed. Furthermore, you need to create a directory '$HOME/.term'. This is the directory in which TERM will look for its 'termrc' file.
  2. You are an ordinary user (no root access) and you want to SHARE the TERM connection with other users. As a user who wants to share the TERM connection you should do the following:
      make DO=installshare USERSHARE=$HOME/term OS-type
      make installman
    
    After this TERM, its clients and the manual pages are built and installed. Furthermore, you will have a directory '$HOME/term' (default) with permissions 'drwxrwxr-x'. In this directory you will find at least the socket used by TERM for its connection ('tmp/private/socket=').
  3. You are root and you do NOT want to SHARE the TERM connection with other users. As root who does not want the TERM connection to be shareable you should do the following to build TERM:
      make DO=install OS-type
      make installman
    
    After this TERM, its clients and the manual pages are built and installed. Furthermore, you now have a directory called '/usr/local/lib/term' (default) with permissions 'drwxr-xr-x'. In this directory you will at least find the socket used by TERM for its connection ('tmp/private/socket=').
  4. You are root and want to SHARE the TERM connection. First, make sure you have read the section about 'sharing' above. As root who wants to share the TERM connection you should do the following:
      make DO=installshare OS-type
      make installman
    
    After this TERM, its clients and the manual pages are built and installed. Furthermore, you now have a directory called '/usr/local/lib/term' (default) owned by group TERM and with permissions 'drwxrwxr-x'. In this directory you will at least find the socket used by TERM for its connection ('tmp/private/socket=').

Build TERM up to version 1.15

For these versions of TERM building should invoke no more than the commands

  make DO=install OS-type
  make installman

You will find TERM, its clients and the manual pages nicely built and installed and ready for use after this.

Furthermore, you need to create a directory '$HOME/term'. This directory TERM will use to look for its termrc file.

The only thing you may want to do is change some of the paths in the Makefile or change some of the compiler flags.

4.4 client.a, libtermnet.a, libtermnet.sa, libtermnet.so

With TERM a library with functions for TERM clients is provided.

Up to version 1.16 this library was called client.a. During compilation of TERM this library was built and then used during the compilation of the TERM clients. It was not installed in another directory.

Starting with version 1.16 the name of the library is changed to libtermnet.a. Up to version 1.19 this library is created in the TERM directory and then used during compilation of the TERM clients. It is not installed in another directory.

Starting with version 2.0.0, beside libtermnet.a also libtermnet.so and libtermnet.sa (shared library and exported initialized library data) are created during compilation of the TERM package. During the installation of all the parts of the package also these three library files are installed in the directory '/usr/local/lib' (default). Then a link is made from libtermnet.so.2 to libtermnet.so.2.x.x. Finally, ldconfig is run to create the necessary links and cache (for use by the run-time linker, ld.so) to the most recent shared libraries found in the directories specified on the command line, in the file '/etc/ld.so.conf', and in the trusted directories ('/usr/lib' and '/lib'). If the installation is done correctly the three library files can now be used by TERM clients which are built with dynamic instead of static libraries. Also, these libraries can now be used to port your own software to make it TERM aware (see belo! w).

4.5 Setting environment variables

TERM knows a couple of environment variables which can be set by users. The first three of those that I will explain are

By setting these variables you can control the way TERM is run.

For TERM versions up to 1.15 only the variable TERMDIR is important (these versions do not know the shared mode). For these versions TERMDIR should be set as follows:

  setenv TERMDIR $HOME     (csh or tcsh)
  export TERMDIR=$HOME     (bash)

Starting with version 1.16 TERM also knows the variables TERMSHARE and TERMMODE. With these variables TERM can be told to run in private mode or in shared mode. I will explain how to set the variables for private mode and shared mode.

TERMMODE knows the following three values;

  1. Running TERM in private mode can be done setting the variables TERMDIR and TERMMODE in the following way: For csh or tcsh
      setenv TERMDIR $HOME
      setenv TERMMODE 0
    
    For bash
      export TERMDIR=$HOME
      export TERMMODE=0
    
  2. When you want to use TERM in shared mode there are two ways of setting the variables:
    1. When TERM is installed as a SUID program only TERMMODE has to be set.
        setenv TERMMODE 2    (csh or tcsh)
        export TERMMODE=2    (bash)
      
    2. When TERM is installed as a SGID program the variables have to be set in the following way: For csh or tcsh
        setenv TERMMODE 1
        setenv TERMDIR /usr/local/lib/term
        setenv TERMSHARE $TERMDIR
      
      For bash
        export TERMMODE=1
        export TERMDIR=/usr/local/lib/term
        export TERMSHARE=$TERMDIR
      
      Setting the variables in this way makes it possible to start old clients (clients linked to an older version of client.a) in shared mode.

Starting with version 2.0.0 TERM also knows the variable TERMSERVER. You need to set this variable when you have multiple modems and you have more than one connection at a time. To specify which connection to use, you must start TERM with a server name:

  nohup term -v /dev/modem1 Connection1 &
  nohup term -v /dev/modem2 Connection2 &

Users should then set the variable TERMSERVER to the connection name they want to use:

  setenv TERMSERVER Connection1   (csh or tcsh)
  export TERMSERVER=Connection2   (bash)

4.6 Test TERM

Do a make test (or make termtest for newer versions of TERM) to build TERM's test daemon. (term)test works by running two copies of TERM on your system, a 'local' and a 'remote'' copy. Both of these will read your 'termrc'; so you can adjust their behaviour. Now execute (term)test. You should now be able to do a trsh and a tupload (try

  tupload ./term /usr/tmp

- you should get a copy of the TERM binary in '/usr/tmp'). The local TERM's output should show up in 'local.log', the remote's one in 'remote.log'. You can start TERM up with a -d255 flag to enable debugging output to be written to these files, or enable debugging in your 'termrc' file.

NOTE: Run test as ./test so as to avoid your system's test.

4.7 TERM and communication programs

Before you can use TERM you must have established a connection via the modem using a communication program like kermit or seyon. In the documentation of your communication program you can find what you need to do to establish the conection with the remote machine.

when you have established the connection with the remote machine and you want to run TERM you need to suspend or quit your communication program without closing the connection with the remote machine. This needs to be done as otherwise the communication program will steal characters from linecheck or TERM.

Below for some communication programs I will explain how you can make sure that the connection will stay alive and the communication programs will not steal characters from linechech or TERM.

Kermit

Starting TERM when you use kermit is easy. At the local kermit prompt you type suspend. Now you see back your Linux prompt. From this prompt you can establish your TERM conection.

Seyon

An easy way to start linecheck or TERM when you are using seyon is to put linecheck and TERM in the Transfer Menu (controlled by the file '$HOME/.seyon/protocols').

In the file '$HOME/.seyon/protocols' add:

  "Line check" "$cd /tmp; linecheck"
  "Term" "$term -c off -w 10 -t 150 -s 38400 -l $HOME/tlog"

Then, when you want to execute linecheck or TERM on the local machine, you can select the Transfer Menu, either the "Line check" or the "Term" item, and Go.

Of course, you can also use the shell command button, and type 'linecheck' or 'term' in the pop-up dialog box. This also does automatic redirection of input and output.

4.8 Make a Transparent Link

Presumably, you can establish a modem connection between your local and remote hosts. Typically, you are dialling into some kind of terminal server and connecting to your remote host from there. You are also using some kind of terminal software, such as kermit or seyon to talk to your modem (the examples in this document will use kermit, since that is what its author uses). If you are having trouble with your modem, or your terminal software, take a look at the Serial-HOWTO; that should help you out.

Having established your link, you want to make it as transparent as possible. Check the commands on the terminal server (help or ? will usually get you started). Go for the 8 bit options whenever possible. This may mean changing the way you log in to a system, e.g. if the server uses rlogin, you may have to use it and give it the -8 flag to make it transparent. Especially watch out for xon/xoff flow control. You do not want that. Try to enable rts/cts (hardware) flow control. You may need to check your modem documentation to learn how to configure it to do 8-bit rts/cts communications.

4.9 Run linecheck

WARNING: In some of the documents the command line options for linecheck are mentioned in an incorrect order. I have checked this and found the order of options mentioned below to be the correct ones.

NOTE: Starting with TERM version 2.3.0 linecheck no longer needs to have the name of a log-file on its command line. It will write its output to the file 'linecheck.log' in the directory you start linecheck in.

Linecheck is a program that is supplied with TERM. It checks the transparency of a link, providing configuration information that TERM needs to run correctly. linecheck will send each of the 256 possible eight bit characters over the link and verify that each was transmitted successfully. TERM needs to be configured to deal with characters that cannot be transmitted over the link, and linecheck determines what characters these are. You use linecheck after you have established as transparent a modem link as possible. To run linecheck, do the following

  1. On the remote system run
      linecheck linecheck.log
    
  2. Escape back to your local system and suspend your communication program (see above)
  3. On the local system run
      linecheck linecheck.log > /dev/modem < /dev/modem
    

When linecheck is done, you will find a set of numbers at the bottom of the 'linecheck.log' files. These should be escaped in the termrc at the other end of the link. For example, in my system my local 'linecheck.log' said nothing and my remote 'linecheck.log' said to escape 29 and 157. Therefore, my local 'termrc' escapes these characters and my remote 'termrc' escapes nothing. If I escape a character at one end, I have to also ignore it at the other; so, in this example, I shall have to ignore 29 and 157 in my remote system.

If linecheck hangs, try using

  linecheck linecheck.log 17 19

on the remote system and

  linecheck linecheck.log 17 19 > /dev/modem < /dev/modem 

on the local system. This will escape your xon/xoff (flow control) characters, which will hang your line if you have got software flow control. If this solves the hanging problems, you will want to escape /ignore 17/19 in both 'termrc's'. If your terminal server has other characters that will shut it down, try running linecheck with those characters escaped, as above. You can spot these characters if linecheck hangs. If this is the case, kill it, then look in the log-files. The last characters transmitted are likely to be the culprits. Try it again with these characters escaped.

In summary, my local termrc has the lines

  escape 29
  escape 157

and my remote termrc has the lines

 
  ignore 29
  ignore 157

since my remote 'linecheck.log' said to escape 29 and 157.

4.10 Try Running TERM

Log into the remote system, making the link as transparent as possible (if you have not already done so). Fire up TERM at the remote end. I use the following:

  exec term -r -l $HOME/tlog -s 38400 -c off -w 10 -t 150.

Let us run down each option one by one (note that I could just as easily have put these options in my termrc. I did it this way because it saves editing a file while getting TERM set up).

exec means to destroy your current shell, running the given program in its place. I exec things because I do not intend to use my login shell again; so it is just wasting memory. If you are debugging the link and can reliably kill the remote TERM, you might not want to do an exec.

The -r option is needed at exactly one end. TERM will then see this end as the remote end of the connection (Note that TERM's remote end can thus be your local machine). If you do not use this option at one end TERM clients will spontaneously crash.

-l $HOME/tlog. This logs errors to the file tlog in my home directory. Very useful for debugging. No reason not to do this.

-s 38400 : I have got a 14400 baud modem, with compression. For optimal compression ratios, I want to be able to push bits down the pipe as fast as possible. For a slower modem, you should use something lower. Note that if you have a slower machine with 16450 uart on your serial port, high baud rates can cause data loss by overloading the chip on your serial port. TERM will recover from this, but if you see a lot of error messages in your log file, (or get overrun warnings from linux kernel versions 0.99pl15 and up) you again might want to lower this number.

-c off : This turns data compression off. I have got a compressing modem, and I do not want to compress things twice.

-w 10 -t 150 : Again, these are options to optimize my fast modem link. I have set my window to 10 and my timeout to 150. This is according to the recommendation in the term_setup man page.

Escape back to your local machine and suspend your communication program (see above). You do not want it running while TERM is running, because it will fight with TERM over the serial port. If you can convince your modem to not hang up when you exit your communication program (when it toggles DTR), you could just exit the program at this point.

Now run TERM locally. I use:

  term -c off -l $HOME/tlog -s 38400 -w 10 -t 150 < /dev/modem > /dev/modem &  

I need to tell TERM where the modem is; so I point both standard input and output at '/dev/modem' (that is what the < and > do). I also run it in the background; so I can use this screen for something else if I want to.

TERM should work now :-). Try a trsh, and see what happens. If you hang, or your link seems slow, take a look at your 'tlog' at each end. Are you getting timeouts or error messages? If so, then you have configured something incorrectly. Try again (after you have finished reading this :-). Note that the connection will not seem blazingly fast, especially if you are using compression - it will be a little jumpy. The real speed comes in during file transfer and the like.

4.11 Terminate your TERM connection

Most certainly, after you have done a lot of work using TERM, you want to finish your work and bring your TERM connection down. For this to be realized there are four ways:

  1. Kill the TERM programs at both sides of the connection. This is the least recommended way of terminating your connection.
  2. A better way is to execute the following command locally:
      echo '00000' > /dev/modem
    
    This will nicely terminate your TERM connection. It will work for all version of TERM. Make sure that the sequence of zeros contains at least five zeros.
  3. In the termrc of TERM versions 2.0.0 and higher you can now enter a statement called terminate '<some string>'. This sets a string that will cause TERM to exit ('00000' by default). It must be at least five characters long, to avoid accidently terminations.
  4. Starting with version 1.14 there is the program tshutdown (actually for version 1.14 it is available as a patch, for newer versions it is in the package). Executing tshutdown nicely terminates your TERM connection.

4.12 Removing TERM from your partition

Ok, you asked for this. As some of you want to get rid of TERM I here present you the steps to be done in removing TERM. In the process of removing TERM you have to fulfil the following steps:

After this exercise you can be quite sure that you have removed everything related to TERM.

4.13 Optimizing your connection

Once you have got TERM running, you might want to try to get things optimized. A good way to measure the speed of your link is to run tmon in one window while up/downloading a file in another. Try both (big) text files and compressed files; the plain text should go a factor of two-ish faster than the compressed files. The parameters you want to fiddle with are baud rate (-s), compression (-c), windows (-w), timeout (-t) and retrain (-A).

Watch out with the retrain parameter. With TERM version 1.19 I got a performance decrease of 80% to 90% compared to running TERM without the retrain parameter. It is not clear if this is a bug in TERM version 1.19 and if this problem exists only with TERM version 1.19.

Baudrate: the maximum number of bits per second TERM will try to send over the serial link. TERM will avoid sending characters at a higher data rate than this. The default is to use the speed of your computer's serial port, but be warned that this may be too high if your modem runs at a lower rate over the phone line. The baud rate option is intended for systems that buffer output to the modem. During setup and tuning it is better to use a small baud rate rather than one which is too large. For high speed links (> 38400), making it unlimited is probably advantageous. This is achieved by using the value 'off'. TERM will then rely solely on your kernel to do flow control.

Compression: you want this on if you do not have a compressing modem. If you do have such a modem, turn compression off, otherwise you will be compressing things twice, which typically increases the amount of data transmitted. Compressing modems are those that use the MNP-5 or V42.bis protocols. Check your modem documentation and the message when your modem connects.

Windows: this is the number of chunks of data, or packets, that TERM will let go over the line before it gets an acknowledgment (or ack) from the remote TERM. For fast modems, increasing this can be a win; for slower links this can overwhelm the remote end.

Timeout: the time TERM will wait for an ack. If you have increased windows, and you are getting timeouts in your log-file, try increasing this.

For 14400/V42.bis, I use -c off -w 10 -t 150. I get around 1700 cps on compressed files and 3500 cps on ASCII files using tupload.

4.14 Troubleshooting

In this section some thoughts are given about what to check when you have problems executing TERM or one of its clients.

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter

Return to Welcome Home Page or Continue to Browse