SLIP devices are named `sl0', `sl1' etc. The first device configured is assigned `0', and the rest of the devices are incremented sequentially as they are configured.
Kernel Compile Options:
Network device support ---> [*] Network device support <*> SLIP (serial line) support [ ] CSLIP compressed headers [ ] Keepalive and linefill [ ] Six bit SLIP encapsulation
SLIP (Serial Line Internet Protocol) allows you to use tcp/ip over a serial line (could be a phone line with a dialup modem, or a leased line of some sort). To use SLIP, you would of course need access to an SLIP-server in your area. Many universities and businesses provide SLIP access all over the world.
SLIP uses the serial ports on your machine to carry IP datagrams. To do this, SLIP must take control of the serial device. SLIP device names are named sl0, sl1 etc. How do these correspond to your serial devices? The networking code uses what is called an ioctl (i/o control) call to change the serial devices into SLIP devices. There are two programs supplied that can perform this function: they are called dip and slattach
dip (Dialup IP) is a smart program that is able to perform the following tasks: set the speed of the serial device, command your modem to dial the remote end of the link, automatically log you into the remote server, search for messages sent to you by the server, and extract information from them (such as your IP address). It will then perform the ioctl necessary to switch your serial port into SLIP mode. dip has a powerful scripting ability. It's this ability that you can exploit to automate your logon procedure.
You can find it at: metalab.unc.edu.
Refer to the following for installation guidelines:
user% tar xvzf dip337o-uri.tgz user% cd dip-3.3.7o user% vi Makefile root# make install
The Makefile assumes the existence of a group called uucp. However, you might like to change this to either dip or SLIP (depending on your configuration).
slattach (as contrasted with dip) is a very simple program that does not have the sophistication of dip. It does not have the scripting ability of dip. It will only configure your serial device as a SLIP device. It assumes you have all the information you need, and it figures that you have the serial line established before you invoke it. slattach is ideal to use where you have a permanent connection to your server (such as a physical cable or a leased line).
You would use dip when your link (to the machine that is your SLIP server) is either a dialup modem or some other temporary link. You would use slattach when you have a leased line, perhaps a cable, between your machine and the server: it is assumed that there is no special action needed to get this link working. See section `Permanen ist Slip connection' for more information.
Configuring SLIP is much like configuring an Ethernet interface (read section `Configuring an ethernet device' above). There are a few key differences.
First of all, SLIP links are unlike ethernet networks in that there are only two hosts on the network (one at each end of the link). Ethernet is available for use as soon are you are cabled. However, SLIP may require you to initialize your network connection in some special way (depending upon the type of link that you have).
If you are using dip, then this would not normally be done at boot time. It could be done at some later time, when you're ready to use the link. It is possible to automate this procedure. If you are using slattach then you will probably want to add a section to your rc.inet1 file. This will soon be addressed in our document..
There are two major types of SLIP servers: Dynamic IP address servers and static IP address servers. Almost every SLIP server will prompt you to login using a username and password: dip can handle logging you in automatically.
A static SLIP server is one in which you have been supplied an IP address that is exclusively yours. Each time you connect to the server, you will configure your SLIP port with that address. The static SLIP server will answer your modem call, possibly prompt you for a username and password, and then route any datagrams destined for your address to you via that connection. If you have a static server, then you may want to put entries for your hostname and IP address (since you know what it will be) into your /etc/hosts. You should also configure some other files such as: rc.inet2, host.conf, resolv.conf, /etc/HOSTNAME and rc.local. Remember that when configuring rc.inet1, you don't need to add any special commands for your SLIP connection (since it is dip that does all of the hard work for you in configuring your interface). You will need to give dip the appropriate information so it can configure the interface for you (after it commands the modem to establish the call and it has logged you into your SLIP server).
If this is how your SLIP server works, then you can move on to the section `Using Dip' to learn how to configure dip it appropriately.
A dynamic SLIP server is one which allocates you an IP address randomly (from a pool of addresses) each time you logon. This means that there is no guarantee that you will have any particular address. Address may well be used by someone else after you have logged off. The network administrator who configured the SLIP server will have assigned a pool of address for the SLIP server to use. When the server receives a new incoming call, the following steps occur: initially, it finds the first unused address; second, it guides the caller through the login process; finally, it then prints a welcome message that contains the IP address it has allocated. It will ultimately use that particular IP address for the duration of the call.
Configuring for this type of server is similar to configuring for a static server. You must add an extra step, however, where you obtain the IP address the server has allocated to you. Then you can configure your SLIP device with that address.
Again, dip does the hard work for you. New versions are smart enough to not only log you in, but they are also able to automatically read the IP address printed in the welcome message. They can then store this address so that you can have your SLIP device configured.
If this is how your SLIP server works, then you can move to section `Using Dip' to learn how to configure dip appropriately.
As explained earlier, dip is a powerful program that can simplify and automate these process: dialing into the SLIP server, logging in the user, starting the connection, and configuring the SLIP devices with the appropriate ifconfig and route commands.
To use dip, you'll need to write a `dip script'. This script is basically a list of commands that dip understands. These commands tell dip how to perform each of the actions that you require. See sample.dip that comes supplied with dip to get an idea of how it works. dip is quite a powerful program: it comes with many options. Instead of going into all of them here, you should look at the man page, README, and sample files that will have come with your version of dip.
You may notice that the sample.dip script assumes that you're using a static SLIP server (so you'll know what your IP address is beforehand). For dynamic SLIP servers, the newer versions of dip include a command you can use to automatically read and configure your SLIP device (with the IP address that the dynamic server allocates for you). The following sample is a modified version of the sample.dip that came supplied with dip337j-uri.tgz. It is probably a good starting point for you. You might like to save it as /etc/dipscript, then you can edit it to suit your configuration:
# # sample.dip Dialup IP connection support program. # # This file (should show) shows how to use the DIP # This file should work for Annex type dynamic servers, if you # use a static address server then use the sample.dip file that # comes as part of the dip337-uri.tgz package. # # # Version: @(#)sample.dip 1.40 07/20/93 # # Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> # main: # Next, set up the other side's name and address. # My dialin machine is called 'xs4all.hacktic.nl' (== 126.96.36.199) get $remote xs4all.hacktic.nl # Set netmask on sl0 to 255.255.255.0 netmask 255.255.255.0 # Set the desired serial port and speed. port cua02 speed 38400 # Reset the modem and terminal line. # This seems to cause trouble for some people! reset # Note! "Standard" pre-defined "errlevel" values: # 0 - OK # 1 - CONNECT # 2 - ERROR # # You can change those grep'ping for "addchat()" in *.c... # Prepare for dialing. send ATQ0V1E1X4\r wait OK 2 if $errlvl != 0 goto modem_trouble dial 555-1234567 if $errlvl != 1 goto modem_trouble # We are connected. Login to the system. login: sleep 2 wait ogin: 20 if $errlvl != 0 goto login_trouble send MYLOGIN\n wait ord: 20 if $errlvl != 0 goto password_error send MYPASSWD\n loggedin: # We are now logged in. wait SOMEPROMPT 30 if $errlvl != 0 goto prompt_error # Command the server into SLIP mode send SLIP\n wait SLIP 30 if $errlvl != 0 goto prompt_error # Get and Set your IP address from the server. # Here we assume that after commanding the SLIP server into SLIP # mode that it prints your IP address get $locip remote 30 if $errlvl != 0 goto prompt_error # Set up the SLIP operating parameters. get $mtu 296 # Ensure "route add -net default xs4all.hacktic.nl" will be done default # Say hello and fire up! done: print CONNECTED $locip ---> $rmtip mode CSLIP goto exit prompt_error: print TIME-OUT waiting for sliplogin to fire up... goto error login_trouble: print Trouble waiting for the Login: prompt... goto error password:error: print Trouble waiting for the Password: prompt... goto error modem_trouble: print Trouble occurred with the modem... error: print CONNECT FAILED to $remote quit exit: exit
The above example assumes you are calling a dynamic SLIP server. If you are calling a static SLIP server, then the sample.dip file that comes with dip337j-uri.tgz should work for you.
When dip is given the get $local command, it searches the incoming text from the remote end for a string that looks like an IP address (ie strings numbers separated by `.' characters). This modification was put in place specifically for dynamic SLIP servers so that the process of reading the IP address granted by the server could be automated.
The example above will automatically create a default route via your SLIP link. If this is not what you want, you might have an ethernet connection that should be your default route. Remove the default command from the script. After this script has finished running (if you do an ifconfig command), you will see that you have a device sl0. This is your SLIP device. You can modify its configuration manually after the dip command has finished by using both the ifconfig and the route commands.
Please note that dip allows you to select a number of different protocols to use with the mode command. The most common example is cSLIP: it is used for SLIP with compression. Please note that both ends of the link must agree. You should ensure that whatever you select agrees with your server settings.
The above example is fairly robust, and it should cope with most errors. Please refer to the dip man page for more information. Naturally, you could code the script to do such things as redial the server if it doesn't get a connection within a prescribed period of time. You can even try a series of servers (if you have access to more than one).
If you have a cable between two machines (or are fortunate enough to have a leased line), or some other permanent serial connection between your machine and second machine, then you don't need to go to all the trouble of using dip to set up your serial link. slattach is a very simple utility that will allow you just enough functionality to configure your connection.
Since your connection will be a permanent one, you will want to add some commands to your rc.inet1 file. To get a permanent connection, make sure that you configure the serial device to the correct speed. Then switch the serial device into SLIP mode. slattach allows you to do this with one command. Add the following to your rc.inet1 file:
# # Attach a leased line static SLIP connection # # configure /dev/cua0 for 19.2kbps and cslip /sbin/slattach -p cslip -s 19200 /dev/cua0 & /sbin/ifconfig sl0 IPA.IPA.IPA.IPA pointopoint IPR.IPR.IPR.IPR up # # End static SLIP.
represents your IP address.
represents the IP address of the remote end.
slattach allocates the first unallocated SLIP device to the serial device specified. slattach starts with sl0. The first slattach command attaches SLIP device sl0 to the serial device specified; sl1 the next time, etc.
slattach allows you to configure a number of different protocols with the -p argument. You will use either SLIP or cSLIP: the choice will depend on whether or not you want to use compression. Note: both ends must agree on compression or no compression.
If you have a machine that is perhaps network connected, and you'd like other people be able to dial in and obtain network services, then you will need to configure your machine as a server. If you want to use SLIP as the serial line protocol, then you have three options as to how to configure your Linux machine (as a SLIP server). My preference would be to use the first presented (sliplogin) because it seems the easiest to configure and understand. I will present a summary of each so that you can make your own decision.
sliplogin is a program that you can use in place of the normal login shell for SLIP users. It converts the terminal line into a SLIP line. It also allows you to configure your Linux machine as either a static address server (users get the same address everytime they call in), or a dynamic address server (where users may get a different address allocated to them each time they call).
The caller will login as per the standard login process by entering their username and password. However, instead of being presented with a shell after their login, sliplogin is executed. Sliplogin searches its configuration file (/etc/slip.hosts) for an entry with a login name that matches that of the caller. If it locates a match, it then configures the line as an 8bit clean line. It uses an ioctl call to convert the line discipline to SLIP. When this process is complete, the last stage of configuration takes place. Now sliplogin invokes a shell script which configures the SLIP interface with the relevant ip address and netmask. It will also set appropriate routing in place. This script is usually called /etc/slip.login. In a similar manner to getty (where you have certain callers that require special initialization) you can create configuration scripts called /etc/slip.login.loginname. These scripts will be run instead of the defaults.
There are either three or four files that you need to configure to get sliplogin working for you. I will detail where to obtain the software and how to configure in detail. The files are:
/etc/passwd, for the dialin user accounts.
/etc/slip.hosts, to contain the information unique to each dial-in user.
/etc/slip.login, which manages the configuration of the routing that needs to be performed for the user.
/etc/slip.tty, which is required only if you are configuring your server for dynamic address allocation. It contains a table of addresses to allocate.
/etc/slip.logout, which contains commands to clean up after the user has hung up or logged out.
You may already have the sliplogin package installed as part of your distribution. If you do not have the package, then you can get sliplogin from: metalab.unc.edu. The tar file contains both source, precompiled binaries and a man page.
To ensure that only authorized users will be able to run thesliplogin program, you should add an entry to your /etc/group file similar to the following:
.. slip::13:radio,fred ..
When you install the sliplogin package, the Makefile will change the group ownership of the sliplogin program to slip. This will mean that only users who belong to that group will be able to execute it. The example above will allow only users radio and fred to execute sliplogin.
To install the binaries into your /sbin directory, and to place the man page into section 8, perform the following:
# cd /usr/src # gzip -dc .../sliplogin-2.1.1.tar.gz | tar xvf - # cd sliplogin-2.1.1 # <..edit the Makefile if you don't use shadow passwords..> # make install
If you want to recompile the binaries before installation, add a make clean before the make install. If you want to install the binaries somewhere else, you will need to edit the Makefile install rule.
You would usually create some special logins for Slip callers in your /etc/passwd file. A convention commonly followed is to use the hostname of the calling host with a capital `S' prefixing it. If the calling host is called radio then you could create a /etc/passwd entry that looked like:
Sradio:FvKurok73:1427:1:radio SLIP login:/tmp:/sbin/sliplogin
It doesn't really matter what the account is called: just make it meaningful to you!
Note: the caller doesn't need any special home directory. They will not be presented with a shell from this machine, so /tmp is a good choice. Also note that sliplogin is used in place of the normal login shell.
The /etc/slip.hosts file is the file that sliplogin searches (it looks for entries matching the login name) to obtain configuration details for this particular caller. It is this file where you specify the ip address and netmask that will be assigned to the caller (configured for their use). Sample entries for two hosts: one a static configuration for host radio, and another is a dynamic configuration for user host albert.They both might look like:
# Sradio 188.8.131.52 184.108.40.206 255.255.255.0 normal -1 Salbert 220.127.116.11 DYNAMIC 255.255.255.0 compressed 60 #
The /etc/slip.hosts file entries are:
The login name of the caller.
The ip address of the server machine (ie: this machine).
This is the ip address that is assigned to the caller. If this field is coded DYNAMIC, then an ip address will be allocated. This is based on the information contained in your /etc/slip.tty file (to be discussed later). Note: you must be using at least version 1.3 of sliplogin for this to work.
The netmask assigned to the calling machine in dotted decimal notation eg 255.255.255.0 for a Class C network mask.
This is the slip mode setting which allows you to enable/disable compression and slip other features. Allowable values here are either "normal" or "compressed".
A timeout parameter which specifies how long the line can remain idle (no datagrams received) before the line is automatically disconnected. A negative value disables this feature.
Note: You can use either hostnames or IP addresses (in dotted decimal notation) for fields 2 and 3. If you use hostnames, then those hosts must be resolvable. In other words, your machine must be able to locate an IP address for those hostnames. If the machine can't locate an IP address, the script will fail when it is called. You can test this by trying to telnet to the hostname. If you get the `Trying nnn.nnn.nnn...' message, then your machine has been able to find an ip address for that name. If you get the message `Unknown host', then it was unsuccessful. In this case, you can either use ip addresses in dotted decimal notation, or fix up your name resolver configuration (See section Name Resolution).
The most common slip modes are:
to enable normal uncompressed SLIP.
to enable van Jacobsen header compression (cSLIP)
Naturally these are mutually exclusive. You can use one or the other. For more information on the other options available, refer to the man pages.
After sliplogin has searched the /etc/slip.hosts, and it has found a matching entry, it will then attempt to execute the /etc/slip.login file. It will then configure the SLIP interface with its ip address and netmask.
The sample /etc/slip.login file supplied with the sliplogin package looks like this:
#!/bin/sh - # # @(#)slip.login 5.1 (Berkeley) 7/1/90 # # generic login file for a SLIP line. sliplogin invokes this with # the parameters: # $1 $2 $3 $4, $5, $6 ... # SLIPunit ttyspeed pid the arguments from the slip.host entry # /sbin/ifconfig $1 $5 pointopoint $6 mtu 1500 -trailers up /sbin/route add $6 arp -s $6 <hw_addr> pub exit 0 #
You will note that this script simply uses the ifconfig and route commands to configure the SLIP device (with its IP address, remote IP address, and netmask). The script then creates a route for the remote address via the SLIP device. This procedure is the same as you would invoke if you were using the slattach command.
Note also the use of Proxy ARP. It ensures that other hosts on the same ethernet as the server machine will know how to reach the dial-in host. The <hw_addr> field should be the hardware address of the ethernet card in the machine. If your server machine isn't on an ethernet network, then you can eliminate this line.
You want to ensure that the serial device is restored to its normal state when the call drops out (so that future callers will be able to login correctly). This is achieved with the use of the /etc/slip.logout file. It is quite simple in format, and it is called with the same argument as the /etc/slip.login file.
#!/bin/sh - # # slip.logout # /sbin/ifconfig $1 down arp -d $6 exit 0 #
All it does is `down' the interface. This will delete the manual route previously created. It also uses the arp command to delete any proxy arp put in place. You don't need the arp command in the script if your server machine does not have an ethernet port.
If you are using dynamic ip address allocation, you should have any hosts configured with the DYNAMIC keyword in the /etc/slip.hosts file. You must then configure the /etc/slip.tty file to list what addresses are assigned to what port. You only need this file if you wish your server to dynamically allocate addresses to users.
The file is a table that lists both the tty devices that will support dial-in SLIP connections,and the ip address that should be assigned to users who call in on that port.
Its format is as follows:
# slip.tty tty -> IP address mappings for dynamic SLIP # format: /dev/tty?? xxx.xxx.xxx.xxx # /dev/ttyS0 192.168.0.100 /dev/ttyS1 192.168.0.101 #
What this table says is that callers that dial in on port /dev/ttyS0 (who have their remote address field in the /etc/slip.hosts file set to DYNAMIC) will be assigned an address of 192.168.0.100.
In this way you need only allocate one address per port for all the users who do not require dedicated address. This helps you keep the number of addresses you need down to a minimum.
Let me start by saying that some of the information below came from the dip man pages (where how to run Linux as a SLIP server is briefly documented). Please also beware that the following has been based on the dip337o-uri.tgz package, and it probably will not apply to other versions of dip.
dip has an input mode of operation. In this mode, it automatically locates an entry for the user who invoked it, and it then configures the serial line as a SLIP link (according to information it finds in the /etc/diphosts file). This input mode of operation is activated by invoking dip as diplogin. By creating special accounts where diplogin is used as the login shell, you are using dip as a SLIP server.
The first thing you will need to do is to make a symbolic link as follows:
# ln -sf /usr/sbin/dip /usr/sbin/diplogin
You then need to add entries to both your /etc/passwd and your /etc/diphosts files. The entries you need to make are formatted as follows:
To configure Linux as a SLIP server with dip, you need to create some special SLIP accounts for users. You will use dip (in input mode) as the login shell. A suggested convention is to have all SLIP accounts begin with a capital `S', eg `Sfredm'.
A sample /etc/passwd entry for a SLIP user looks like the following:
Sfredm:ij/SMxiTlGVCo:1004:10:Fred:/tmp:/usr/sbin/diplogin ^^ ^^ ^^ ^^ ^^ ^^ ^^ | | | | | | \__ diplogin as login shell | | | | | \_______ Home directory | | | | \____________ User Full Name | | | \_________________ User Group ID | | \_____________________ User ID | \_______________________________ Encrypted User Password \__________________________________________ Slip User Login Name
After the user logs in, the login program (if it finds and verifies the user) will execute the diplogin command dip. diplogin knows that it should automatically assume that it is being used a login shell. When it is started as diplogin it uses the getuid() function call to get the userid from whoever has invoked it. It then searches the /etc/diphosts file for the first entry that matches either the userid or the name of the tty device from where the call has originated. It then configures itself appropriately. By deciding between giving the user an entry in the diphosts file, or providing her or him the default configuration, you can build your server in such a way that you can have a mix of static and dynamically assigned addressed users.
You do not need to worry about manually adding such entries because dip will automatically add a `Proxy-ARP' entry if invoked in input mode.
/etc/diphosts is used by dip to lookup preset configurations for remote hosts. These remote hosts might be users dialing into your linux machine, or they might be for machines that you dial into with your linux machine.
The general format for /etc/diphosts is as follows:
.. Suwalt::18.104.22.168:22.214.171.124:255.255.255.0:SLIP uwalt:CSLIP,1006 ttyS1::126.96.36.199:188.8.131.52:255.255.255.0:Dynamic ttyS1:CSLIP,296 ..
The fields are:
Login name: as returned by getpwuid(getuid()) or tty name.
Unused: compat. with passwd
Remote Address: IP address of the calling host, either numeric or by name
Local Address: IP address of this machine, again numeric or by name
Netmask: in dotted decimal notation
Comment field: place whatever you want here.
Protocol: Slip, CSlip etc.
MTU: decimal number
An example /etc/net/diphosts entry for a remote SLIP user might be:
which specifies a SLIP link with remote address of 184.108.40.206 and MTU of 296, or:
which specifies a cSLIP-capable link with remote address 220.127.116.11 and MTU of 1006.
All users who you wish to be allowed a statically allocated dial-up IP access should have an entry in the /etc/diphosts. If you want users who call a particular port to have their details dynamically allocated, then you must have an entry for the tty device (and do not configure a user based entry). You should remember to configure at least one entry for each tty device that is used. This ensures that a suitable configuration is available for them regardless of which modem they call in on.
When a user logs in, they will receive a normal login and password prompt. They should then enter their SLIP-login userid and password. If these verify properly, then the user will see no special messages. The user should then change into SLIP mode at their end. The user should then be able to connect and be configured with the relevant parameters from the diphosts file.
Matt Dillon <email@example.com> has written a package that does not only dial-in but also dial-out SLIP. Matt's package is a combination of small programs and scripts that manage your connections for you. You will need to have tcsh installed as at least one of the scripts requires it. Matt supplies a binary copy of the expect utility as it too is needed by one of the scripts. You will most likely need some experience with expect to get this package working to your liking, but don't let that deter your efforts!
Matt has written a good set of installation instructions in the README file, so I won't bother to repeat them.
You can get the dSLIP package from its home site at:
Read the README file and create the /etc/passwd and /etc/group entries before doing a make install.