<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE>Linux Networking-HOWTO (Previously the Net-3 Howto): Using common PC hardware</TITLE> <LINK HREF="NET3-4-HOWTO-8.html" REL=next> <LINK HREF="NET3-4-HOWTO-6.html" REL=previous> <LINK HREF="NET3-4-HOWTO.html#toc7" REL=contents> </HEAD> <BODY> <A HREF="NET3-4-HOWTO-8.html">Next</A> <A HREF="NET3-4-HOWTO-6.html">Previous</A> <A HREF="NET3-4-HOWTO.html#toc7">Contents</A> <HR> <H2><A NAME="s7">7. Using common PC hardware</A></H2> <P> <H2><A NAME="ss7.1">7.1 ISDN</A> </H2> <P>The Integrated Services Digital Network (ISDN) is a series of standards that specify a general purpose switched digital data network. An ISDN `call' creates a synchronous point to point data service to the destination. ISDN is generally delivered on a high speed link that is broken down into a number of discrete channels. There are two different types of channels, the `B Channels' which will actually carry the user data and a single channel called the `D channel' which is used to send control information to the ISDN exchange to establish calls and other functions. In Australia for example, ISDN may be delivered on a 2Mbps link that is broken into 30 discrete 64kbps B channels with one 64kbps D channel. Any number of channels may be used at a time and in any combination. You could for example establish 30 separate calls to 30 different destinations at 64kbps each, or you could establish 15 calls to 15 different destinations at 128kbps each (two channels used per call), or just a small number of calls and leave the rest idle. A channel may be used for either incoming or outgoing calls. The original intention of ISDN was to allow Telecommunications companies to provide a single data service which could deliver either telephone (via digitised voice) or data services to your home or business without requiring you to make any special configuration changes. <P>There are a few different ways to connect your computer to an ISDN service. One way is to use a device called a `Terminal Adaptor' which plugs into the Network Terminating Unit that you telecommunications carrier will have installed when you got your ISDN service and presents a number of serial interfaces. One of those interfaces is used to enter commands to establish calls and configuration and the others are actually connected to the network devices that will use the data circuits when they are established. Linux will work in this sort of configuration without modification, you just treat the port on the Terminal Adaptor like you would treat any other serial device. Another way, which is the way the kernel ISDN support is designed for allows you to install an ISDN card into your Linux machine and then has your Linux software handle the protocols and make the calls itself. <P><B>Kernel Compile Options</B>: <BLOCKQUOTE><CODE> <PRE> ISDN subsystem ---> <*> ISDN support [ ] Support synchronous PPP [ ] Support audio via ISDN < > ICN 2B and 4B support < > PCBIT-D support < > Teles/NICCY1016PC/Creatix support </PRE> </CODE></BLOCKQUOTE> <P>The Linux implementation of ISDN supports a number of different types of internal ISDN cards. These are those listed in the kernel configuration options: <UL> <LI>ICN 2B and 4B</LI> <LI>Octal PCBIT-D</LI> <LI>Teles ISDN-cards and compatibles</LI> </UL> <P>Some of these cards require software to be downloaded to them to make them operational. There is a separate utility to do this with. <P>Full details on how to configure the Linux ISDN support is available from the <CODE>/usr/src/linux/Documentation/isdn/</CODE> directory and an FAQ dedicated to <EM>isdn4linux</EM> is available at <A HREF="http://www.lrz-muenchen.de/~ui161ab/www/isdn/">www.lrz-muenchen.de</A>. (You can click on the english flag to get an english version). <P><B>A note about PPP</B>. The PPP suite of protocols will operate over either asynchronous or synchronous serial lines. The commonly distributed PPP daemon for Linux `<EM>pppd</EM>' supports only asynchronous mode. If you wish to run the PPP protocols over your ISDN service you need a specially modified version. Details of where to find it are available in the documentation referred to above. <H2><A NAME="ss7.2">7.2 PLIP for Linux-2.0</A> </H2> <P>PLIP device names are `<CODE>plip0</CODE>', `<CODE>plip1</CODE> and <CODE>plip2</CODE>. <P><B>Kernel Compile Options</B>: <BLOCKQUOTE><CODE> <PRE> Network device support ---> <*> PLIP (parallel port) support </PRE> </CODE></BLOCKQUOTE> <P><EM>plip</EM> (Parallel Line IP), is like SLIP, in that it is used for providing a <EM>point to point</EM> network connection between two machines, except that it is designed to use the parallel printer ports on your machine instead of the serial ports (a cabling diagram in included in the cabling diagram section later in this document). Because it is possible to transfer more than one bit at a time with a parallel port, it is possible to attain higher speeds with the <EM>plip</EM> interface than with a standard serial device. In addition, even the simplest of parallel ports, printer ports, can be used in lieu of you having to purchase comparatively expensive 16550AFN UART's for your serial ports. PLIP uses a lot of CPU compared to a serial link and is most certainly not a good option if you can obtain some cheap ethernet cards, but it will work when nothing else is available and will work quite well. You should expect a data transfer rate of about 20 kilobytes per second when a link is running well. <P>The PLIP device drivers competes with the parallel device driver for the parallel port hardware. If you wish to use both drivers then you should compile them both as modules to ensure that you are able to select which port you want to use for PLIP and which ports you want for the printer driver. Refer to the ``Mudules mini-HOWTO'' for more information on kernel module configuration. <P>Please note that some laptops use chipsets that will not work with PLIP because they do not allow some combinations of signals that PLIP relies on, that printers don't use. <P>The Linux <EM>plip</EM> interface is compatible with the <EM>Crynwyr Packet Driver PLIP</EM> and this will mean that you can connect your Linux machine to a DOS machine running any other sort of tcp/ip software via <EM>plip</EM>. <P>In the 2.0.* series kernel the plip devices are mapped to i/o port and IRQ as follows: <BLOCKQUOTE><CODE> <PRE> device i/o IRQ ------ ----- --- plip0 0x3bc 5 plip1 0x378 7 plip2 0x278 2 </PRE> </CODE></BLOCKQUOTE> <P>If your parallel ports don't match any of the above combinations then you can change the IRQ of a port using the <EM>ifconfig</EM> command using the `<CODE>irq</CODE>' parameter (be sure to enable IRQ's on your printer ports in your ROM BIOS if it supports this option). As an alternative, you can specify ``<CODE>io=</CODE>'' annd ``<CODE>irq=</CODE>'' options on the <EM>insmod</EM> command line, if you use modules. For example: <BLOCKQUOTE><CODE> <PRE> root# insmod plip.o io=0x288 irq=5 </PRE> </CODE></BLOCKQUOTE> <P>PLIP operation is controlled by two timeouts, whose default values are probably ok in most cases. You will probably need to increase them if you have an especially slow computer, in which case the timers to increase are actually on the <B>other</B> computer. A program called <EM>plipconfig</EM> exists that allows you to change these timer settings without recompiling your kernel. It is supplied with many Linux distributions. <P>To configure a <EM>plip</EM> interface, you will need to invoke the following commands (or <B>add</B> them to your initialization scripts): <BLOCKQUOTE><CODE> <PRE> root# /sbin/ifconfig plip1 localplip pointopoint remoteplip root# /sbin/route add remoteplip plip1 </PRE> </CODE></BLOCKQUOTE> <P>Here, the port being used is the one at I/O address 0x378; <EM>localplip</EM> amd <EM>remoteplip</EM> are the names or IP addresses used over the PLIP cable. I personally keep them in my <CODE>/etc/hosts</CODE> database: <BLOCKQUOTE><CODE> <PRE> # plip entries 192.168.3.1 localplip 192.168.3.2 remoteplip </PRE> </CODE></BLOCKQUOTE> <P>The <EM>pointopoint</EM> parameter has the same meaning as for SLIP, in that it specifies the address of the machine at the other end of the link. <P>In almost all respects you can treat a <EM>plip</EM> interface as though it were a <EM>SLIP</EM> interface, except that neither <EM>dip</EM> nor <EM>slattach</EM> need be, nor can be, used. <P>Further information on PLIP may be obtained from the ``PLIP mini-HOWTO''. <H2><A NAME="ss7.3">7.3 PLIP for Linux-2.2</A> </H2> <P>During development of the 2.1 kernel versions, support for the parallel port was changed to a better setup. <P><B>Kernel Compile Options</B>: <BLOCKQUOTE><CODE> <PRE> General setup ---> [*] Parallel port support Network device support ---> <*> PLIP (parallel port) support </PRE> </CODE></BLOCKQUOTE> <P>The new code for PLIP behaves like the old one (use the same <EM>ifconfig</EM> and <EM>route</EM> commands as in the previous section, but initialization of the device is different due to the advanced parallel port support. <P>The ``first'' PLIP device is always called ``plip0'', where first is the first device detected by the system, similarly to what happens for Ethernet devices. The actual parallel port being used is one of the available ports, as shown in <CODE>/proc/parport</CODE>. For example, if you have only one parallel port, you'll only have a directory called <CODE>/proc/parport/0</CODE>. <P>If your kernel didn't detect the IRQ number used by your port, ``<CODE>insmod plip</CODE>'' will fail; in this case just write the right number to <CODE>/proc/parport/0/irq</CODE> and reinvoke <EM>insmod</EM>. <P>Complete information about parallel port management is available in the file <CODE>Documentation/parport.txt</CODE>, part of your kernel sources. <H2><A NAME="ss7.4">7.4 PPP</A> </H2> <P>PPP devices names are `<CODE>ppp0</CODE>', `<CODE>ppp1</CODE>, etc. Devices are numbered sequentially with the first device configured receiving `<CODE>0</CODE>'. <P><B>Kernel Compile Options</B>: <BLOCKQUOTE><CODE> <PRE> Networking options ---> <*> PPP (point-to-point) support </PRE> </CODE></BLOCKQUOTE> <P>PPP configuration is covered in detail in the <A HREF="PPP-HOWTO.html">PPP-HOWTO</A>. <H3>Maintaining a permanent connection to the net with <EM>pppd</EM>.</H3> <P>If you are fortunate enough to have a semi permanent connection to the net and would like to have your machine automatically redial your PPP connection if it is lost then here is a simple trick to do so. <P>Configure PPP such that it can be started by the <CODE>root</CODE> user by issuing the command: <BLOCKQUOTE><CODE> <PRE> # pppd </PRE> </CODE></BLOCKQUOTE> <B>Be sure</B> that you have the `<CODE>-detach</CODE>' option configured in your <CODE>/etc/ppp/options</CODE> file. Then, insert the following line into your <CODE>/etc/inittab</CODE> file, down with the <EM>getty</EM> definitions: <BLOCKQUOTE><CODE> <PRE> pd:23:respawn:/usr/sbin/pppd </PRE> </CODE></BLOCKQUOTE> This will cause the <EM>init</EM> program to spawn and monitor the <EM>pppd</EM> program and automatically restart it if it dies. <H2><A NAME="ss7.5">7.5 SLIP client</A> </H2> <P>SLIP devices are named `<CODE>sl0</CODE>', `<CODE>sl1</CODE>' etc. with the first device configured being assigned `<CODE>0</CODE>' and the rest incrementing sequentially as they are configured. <P><B>Kernel Compile Options</B>: <BLOCKQUOTE><CODE> <PRE> Network device support ---> [*] Network device support <*> SLIP (serial line) support [ ] CSLIP compressed headers [ ] Keepalive and linefill [ ] Six bit SLIP encapsulation </PRE> </CODE></BLOCKQUOTE> <P>SLIP (Serial Line Internet Protocol) allows you to use tcp/ip over a serial line, be that a phone line with a dialup modem, or a leased line of some sort. Of course to use SLIP you need access to a <EM>SLIP-server</EM> in your area. Many universities and businesses provide SLIP access all over the world. <P>Slip uses the serial ports on your machine to carry IP datagrams. To do this it must take control of the serial device. Slip device names are named <EM>sl0</EM>, <EM>sl1</EM> etc. How do these correspond to your serial devices ? The networking code uses what is called an <EM>ioctl</EM> (i/o control) call to change the serial devices into SLIP devices. There are two programs supplied that can do this, they are called <EM>dip</EM> and <EM>slattach</EM> <H3>dip</H3> <P><EM>dip</EM> (Dialup IP) is a smart program that is able to 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 for them such as your IP address and perform the <EM>ioctl</EM> necessary to switch your serial port into SLIP mode. <EM>dip</EM> has a powerful scripting ability and it is this that you can exploit to automate your logon procedure. <P>You can find it at: <A HREF="ftp://metalab.unc.edu/pub/Linux/system/Network/serial/dip/dip337o-uri.tgz">metalab.unc.edu</A>. <P>To install it, try the following: <BLOCKQUOTE><CODE> <PRE> user% tar xvzf dip337o-uri.tgz user% cd dip-3.3.7o user% vi Makefile root# make install </PRE> </CODE></BLOCKQUOTE> <P>The <CODE>Makefile</CODE> assumes the existence of a group called <EM>uucp</EM>, but you might like to change this to either <EM>dip</EM> or <EM>SLIP</EM> depending on your configuration. <H3>slattach</H3> <P><EM>slattach</EM> as contrasted with <EM>dip</EM> is a very simple program, that is very easy to use, but does not have the sophistication of <EM>dip</EM>. It does not have the scripting ability, all it does is configure your serial device as a SLIP device. It assumes you have all the information you need and the serial line is established before you invoke it. <EM>slattach</EM> is ideal to use where you have a permanent connection to your server, such as a physical cable, or a leased line. <H3>When do I use which ?</H3> <P>You would use <EM>dip</EM> when your link to the machine that is your SLIP server is a dialup modem, or some other temporary link. You would use <EM>slattach</EM> when you have a leased line, perhaps a cable, between your machine and the server and there is no special action needed to get the link working. See section `Permanent Slip connection' for more information. <P>Configuring SLIP is much like configuring an Ethernet interface (read section `Configuring an ethernet device' above). However there are a few key differences. <P>First of all, SLIP links are unlike ethernet networks in that there is only ever two hosts on the network, one at each end of the link. Unlike an ethernet that is available for use as soon are you are cabled, with SLIP, depending on the type of link you have, you may have to initialize your network connection in some special way. <P>If you are using <EM>dip</EM> then this would not normally be done at boot time, but at some time later, when you were ready to use the link. It is possible to automate this procedure. If you are using <EM>slattach</EM> then you will probably want to add a section to your <EM>rc.inet1</EM> file. This will be described soon. <P>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 when dialing in. <EM>dip</EM> can handle logging you in automatically. <H3>Static SLIP server with a dialup line and DIP.</H3> <P>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 <CODE>/etc/hosts</CODE>. You should also configure some other files such as: <CODE>rc.inet2</CODE>, <CODE>host.conf</CODE>, <CODE>resolv.conf</CODE>, <CODE>/etc/HOSTNAME</CODE> and <CODE>rc.local</CODE>. Remember that when configuring <CODE>rc.inet1</CODE>, you don't need to add any special commands for your SLIP connection since it is <EM>dip</EM> that does all of the hard work for you in configuring your interface. You will need to give <EM>dip</EM> the appropriate information and it will configure the interface for you after commanding the modem to establish the call and logging you into your SLIP server. <P>If this is how your SLIP server works then you can move to section `Using Dip' to learn how to configure <EM>dip</EM> appropriately. <H3>Dynamic SLIP server with a dialup line and DIP.</H3> <P>A <EM>dynamic</EM> 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 each time, and that 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, it finds the first unused address, guides the caller through the login process and then prints a welcome message that contains the IP address it has allocated and will proceed to use that IP address for the duration of that call. <P>Configuring for this type of server is similar to configuring for a static server, except that you must add a step where you obtain the IP address that the server has allocated for you and configure your SLIP device with that. <P>Again, <EM>dip</EM> does the hard work and new versions are smart enough to not only log you in, but to also be able to automatically read the IP address printed in the welcome message and store it so that you can have it configure your SLIP device with it. <P>If this is how your SLIP server works then you can move to section `Using Dip' to learn how to configure <EM>dip</EM> appropriately. <H3>Using DIP.</H3> <P>As explained earlier, <EM>dip</EM> is a powerful program that can simplify and automate the process of dialing into the SLIP server, logging you in, starting the connection and configuring your SLIP devices with the appropriate <EM>ifconfig</EM> and <EM>route</EM> commands. <P>Essentially to use <EM>dip</EM> you'll write a `dip script', which is basically a list of commands that <EM>dip</EM> understands that tell <EM>dip</EM> how to perform each of the actions you want it to perform. See <CODE>sample.dip</CODE> that comes supplied with <EM>dip</EM> to get an idea of how it works. <EM>dip</EM> is quite a powerful program, with many options. Instead of going into all of them here you should look at the <EM>man</EM> page, README and sample files that will have come with your version of <EM>dip</EM>. <P>You may notice that the <CODE>sample.dip</CODE> script assumes that you're using a static SLIP server, so you know what your IP address is beforehand. For dynamic SLIP servers, the newer versions of <EM>dip</EM> 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 <CODE>sample.dip</CODE> that came supplied with <EM>dip337j-uri.tgz</EM> and is probably a good starting point for you. You might like to save it as <CODE>/etc/dipscript</CODE> and edit it to suit your configuration: <BLOCKQUOTE><CODE> <PRE> # # 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' (== 193.78.33.42) 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 </PRE> </CODE></BLOCKQUOTE> <P>The above example assumes you are calling a <EM>dynamic</EM> SLIP server, if you are calling a <EM>static</EM> SLIP server, then the <CODE>sample.dip</CODE> file that comes with <EM>dip337j-uri.tgz</EM> should work for you. <P>When <EM>dip</EM> is given the <EM>get $local</EM> 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 <EM>dynamic</EM> SLIP servers, so that the process of reading the IP address granted by the server could be automated. <P>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, then remove the <EM>default</EM> command from the script. After this script has finished running, if you do an <EM>ifconfig</EM> command, you will see that you have a device <EM>sl0</EM>. This is your SLIP device. Should you need to, you can modify its configuration manually, after the <EM>dip</EM> command has finished, using the <EM>ifconfig</EM> and <EM>route</EM> commands. Please note that <EM>dip</EM> allows you to select a number of different protocols to use with the <CODE>mode</CODE> command, the most common example is <EM>cSLIP</EM> for SLIP with compression. Please note that both ends of the link must agree, so you should ensure that whatever you select agrees with what your server is set to. The above example is fairly robust and should cope with most errors. Please refer to the <EM>dip</EM> man page for more information. Naturally you could, for example, code the script to do such things as redial the server if it doesn't get a connection within a prescribed period of time, or even try a series of servers if you have access to more than one. <H3>Permanent SLIP connection using a leased line and slattach.</H3> <P>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 another, then you don't need to go to all the trouble of using <EM>dip</EM> to set up your serial link. <EM>slattach</EM> is a very simple to use 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 <CODE>rc.inet1</CODE> file. In essence all you need to do for a permanent connection is ensure that you configure the serial device to the correct speed and switch the serial device into SLIP mode. <EM>slattach</EM> allows you to do this with one command. <B>Add</B> the following to your <CODE>rc.inet1</CODE> file: <BLOCKQUOTE><CODE> <PRE> # # 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. </PRE> </CODE></BLOCKQUOTE> Where: <DL> <P> <DT><B>IPA.IPA.IPA.IPA</B><DD><P>represents your IP address. <P> <DT><B>IPR.IPR.IPR.IPR</B><DD><P>represents the IP address of the remote end. </DL> <P><EM>slattach</EM> allocates the first unallocated SLIP device to the serial device specified. <EM>slattach</EM> starts with <EM>sl0</EM>. Therefore the first <EM>slattach</EM> command attaches SLIP device <EM>sl0</EM> to the serial device specified and <EM>sl1</EM> the next time, etc. <P><EM>slattach</EM> allows you to configure a number of different protocols with the <CODE>-p</CODE> argument. In your case you will use either <EM>SLIP</EM> or <EM>cSLIP</EM> depending on whether you want to use compression or not. Note: both ends must agree on whether you want compression or not. <H2><A NAME="ss7.6">7.6 SLIP server.</A> </H2> <P>If you have a machine that is perhaps network connected, that you'd like other people be able to dial into and provide 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 currently 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, <EM>sliplogin</EM>, as it seems the easiest to configure and understand, but I will present a summary of each, so you can make your own decision. <H3>Slip Server using <EM>sliplogin</EM>.</H3> <P><EM>sliplogin</EM> is a program that you can use in place of the normal login shell for SLIP users that converts the terminal line into a SLIP line. It allows you to configure your Linux machine as either a <EM>static address server</EM>, users get the same address everytime they call in, or a <EM>dynamic address server</EM>, where users get an address allocated for them which will not necessarily be the same as the last time they called. <P>The caller will login as per the standard login process, entering their username and password, but instead of being presented with a shell after their login, <EM>sliplogin</EM> is executed which searches its configuration file (<CODE>/etc/slip.hosts</CODE>) for an entry with a login name that matches that of the caller. If it locates one, it configures the line as an 8bit clean line, and uses an <EM>ioctl</EM> call to convert the line discipline to SLIP. When this process is complete, the last stage of configuration takes place, where <EM>sliplogin</EM> invokes a shell script which configures the SLIP interface with the relevant ip address, netmask and sets appropriate routing in place. This script is usually called <CODE>/etc/slip.login</CODE>, but in a similar manner to <EM>getty</EM>, if you have certain callers that require special initialization, then you can create configuration scripts called <CODE>/etc/slip.login.loginname</CODE> that will be run instead of the default specifically for them. <P>There are either three or four files that you need to configure to get <EM>sliplogin</EM> working for you. I will detail how and where to get the software and how each is configured in detail. The files are: <UL> <LI><CODE>/etc/passwd</CODE>, for the dialin user accounts.</LI> <LI><CODE>/etc/slip.hosts</CODE>, to contain the information unique to each dial-in user.</LI> <LI><CODE>/etc/slip.login</CODE>, which manages the configuration of the routing that needs to be performed for the user.</LI> <LI><CODE>/etc/slip.tty</CODE>, which is required only if you are configuring your server for <EM>dynamic address allocation</EM> and contains a table of addresses to allocate</LI> <LI><CODE>/etc/slip.logout</CODE>, which contains commands to clean up after the user has hung up or logged out.</LI> </UL> <H3>Where to get <EM>sliplogin</EM></H3> <P>You may already have the <EM>sliplogin</EM> package installed as part of your distribution, if not then <EM>sliplogin</EM> can be obtained from: <A HREF="ftp://metalab.unc.edu/pub/linux/system/Network/serial/sliplogin-2.1.1.tar.gz">metalab.unc.edu</A>. The tar file contains both source, precompiled binaries and a <EM>man</EM> page. <P>To ensure that only authorized users will be able to run <EM>sliplogin</EM> program, you should add an entry to your <CODE>/etc/group</CODE> file similar to the following: <BLOCKQUOTE><CODE> <PRE> .. slip::13:radio,fred .. </PRE> </CODE></BLOCKQUOTE> <P>When you install the <EM>sliplogin</EM> package, the <CODE>Makefile</CODE> will change the group ownership of the <EM>sliplogin</EM> program to <CODE>slip</CODE>, and this will mean that only users who belong to that group will be able to execute it. The example above will allow only users <CODE>radio</CODE> and <CODE>fred</CODE> to execute <EM>sliplogin</EM>. <P>To install the binaries into your <CODE>/sbin</CODE> directory and the <EM>man</EM> page into section 8, do the following: <BLOCKQUOTE><CODE> <PRE> # 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 </PRE> </CODE></BLOCKQUOTE> <P>If you want to recompile the binaries before installation, add a <CODE>make clean</CODE> before the <CODE>make install</CODE>. If you want to install the binaries somewhere else, you will need to edit the <CODE>Makefile</CODE> <EM>install</EM> rule. <P>Please read the <CODE>README</CODE> files that come with the package for more information. <H3>Configuring <CODE>/etc/passwd</CODE> for Slip hosts.</H3> <P>Normally you would create some special logins for Slip callers in your <CODE>/etc/passwd</CODE> file. A convention commonly followed is to use the <EM>hostname</EM> of the calling host with a capital `S' prefixing it. So, for example, if the calling host is called <CODE>radio</CODE> then you could create a <CODE>/etc/passwd</CODE> entry that looked like: <BLOCKQUOTE><CODE> <PRE> Sradio:FvKurok73:1427:1:radio SLIP login:/tmp:/sbin/sliplogin </PRE> </CODE></BLOCKQUOTE> It doesn't really matter what the account is called, so long as it is meaningful to you. <P>Note: the caller doesn't need any special home directory, as they will not be presented with a shell from this machine, so <CODE>/tmp</CODE> is a good choice. Also note that <EM>sliplogin</EM> is used in place of the normal login shell. <H3>Configuring <CODE>/etc/slip.hosts</CODE></H3> <P>The <CODE>/etc/slip.hosts</CODE> file is the file that <EM>sliplogin</EM> searches for entries matching the login name to obtain configuration details for this caller. It is this file where you specify the ip address and netmask that will be assigned to the caller and configured for their use. Sample entries for two hosts, one a static configuration for host <CODE>radio</CODE> and another, a dynamic configuration for user host <CODE>albert</CODE> might look like: <BLOCKQUOTE><CODE> <PRE> # Sradio 44.136.8.99 44.136.8.100 255.255.255.0 normal -1 Salbert 44.136.8.99 DYNAMIC 255.255.255.0 compressed 60 # </PRE> </CODE></BLOCKQUOTE> The <CODE>/etc/slip.hosts</CODE> file entries are: <OL> <LI>the login name of the caller.</LI> <LI>ip address of the server machine, ie this machine.</LI> <LI>ip address that the caller will be assigned. If this field is coded <CODE>DYNAMIC</CODE> then an ip address will be allocated based on the information contained in your <CODE>/etc/slip.tty</CODE> file discussed later. <B>Note:</B> you must be using at least version 1.3 of sliplogin for this to work.</LI> <LI>the netmask assigned to the calling machine in dotted decimal notation eg 255.255.255.0 for a Class C network mask.</LI> <LI>the slip mode setting which allows you to enable/disable compression and slip other features. Allowable values here are "<CODE>normal</CODE>" or "<CODE>compressed</CODE>".</LI> <LI>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.</LI> <LI>optional arguments.</LI> </OL> <P>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, that is, your machine must be able to locate an ip address for those hostnames, otherwise the script will fail when it is called. You can test this by trying trying to telnet to the hostname, if you get the `<EM>Trying nnn.nnn.nnn...</EM>' message then your machine has been able to find an ip address for that name. If you get the message `<EM>Unknown host</EM>', then it has not. If not, either use ip addresses in dotted decimal notation, or fix up your name resolver configuration (See section <CODE>Name Resolution</CODE>). <P>The most common slip modes are: <DL> <P> <DT><B>normal</B><DD><P>to enable normal uncompressed SLIP. <P> <DT><B>compressed</B><DD><P>to enable van Jacobsen header compression (cSLIP) </DL> Naturally these are mutually exclusive, you can use one or the other. For more information on the other options available, refer to the <EM>man</EM> pages. <H3>Configuring the <CODE>/etc/slip.login</CODE> file.</H3> <P>After <EM>sliplogin</EM> has searched the <CODE>/etc/slip.hosts</CODE> and found a matching entry, it will attempt to execute the <CODE>/etc/slip.login</CODE> file to actually configure the SLIP interface with its ip address and netmask. The sample <CODE>/etc/slip.login</CODE> file supplied with the <EM>sliplogin</EM> package looks like this: <BLOCKQUOTE><CODE> <PRE> #!/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 # </PRE> </CODE></BLOCKQUOTE> You will note that this script simply uses the <EM>ifconfig</EM> and <EM>route</EM> commands to configure the SLIP device with its ipaddress, remote ip address and netmask and creates a route for the remote address via the SLIP device. Just the same as you would if you were using the <EM>slattach</EM> command. <P>Note also the use of <EM>Proxy ARP</EM> to ensure that other hosts on the same ethernet as the server machine will know how to reach the dial-in host. The <CODE><hw_addr></CODE> 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 leave this line out completely. <H3>Configuring the <CODE>/etc/slip.logout</CODE> file.</H3> <P>When the call drops out, you want to ensure that the serial device is restored to its normal state so that future callers will be able to login correctly. This is achieved with the use of the <CODE>/etc/slip.logout</CODE> file. It is quite simple in format and is called with the same argument as the <CODE>/etc/slip.login</CODE> file. <BLOCKQUOTE><CODE> <PRE> #!/bin/sh - # # slip.logout # /sbin/ifconfig $1 down arp -d $6 exit 0 # </PRE> </CODE></BLOCKQUOTE> All it does is `down' the interface which will delete the manual route previously created. It also uses the <EM>arp</EM> command to delete any proxy arp put in place, again, you don't need the <EM>arp</EM> command in the script if your server machine does not have an ethernet port. <H3>Configuring the <CODE>/etc/slip.tty</CODE> file.</H3> <P>If you are using dynamic ip address allocation (have any hosts configured with the <CODE>DYNAMIC</CODE> keyword in the <CODE>/etc/slip.hosts</CODE> file, then you must configure the <CODE>/etc/slip.tty</CODE> 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. <P>The file is a table that lists the <EM>tty</EM> 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: <BLOCKQUOTE><CODE> <PRE> # 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 # </PRE> </CODE></BLOCKQUOTE> <P>What this table says is that callers that dial in on port <CODE>/dev/ttyS0</CODE> who have their remote address field in the <CODE>/etc/slip.hosts</CODE> file set to <CODE>DYNAMIC</CODE> will be assigned an address of <CODE>192.168.0.100</CODE>. <P>In this way you need only allocate one address per port for all users who do not require an dedicated address for themselves. This helps you keep the number of addresses you need down to a minimum to avoid wastage. <H3>Slip Server using <EM>dip</EM>.</H3> <P>Let me start by saying that some of the information below came from the <EM>dip</EM> 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 <EM>dip337o-uri.tgz</EM> package and probably will not apply to other versions of <EM>dip</EM>. <EM>dip</EM> has an input mode of operation, where it automatically locates an entry for the user who invoked it and configures the serial line as a SLIP link according to information it finds in the <CODE>/etc/diphosts</CODE> file. This input mode of operation is activated by invoking <EM>dip</EM> as <EM>diplogin</EM>. This therefore is how you use <EM>dip</EM> as a SLIP server, by creating special accounts where <EM>diplogin</EM> is used as the login shell. The first thing you will need to do is to make a symbolic link as follows: <BLOCKQUOTE><CODE> <PRE> # ln -sf /usr/sbin/dip /usr/sbin/diplogin </PRE> </CODE></BLOCKQUOTE> You then need to add entries to both your <CODE>/etc/passwd</CODE> and your <CODE>/etc/diphosts</CODE> files. The entries you need to make are formatted as follows: To configure Linux as a SLIP server with <EM>dip</EM>, you need to create some special SLIP accounts for users, where <EM>dip</EM> (in input mode) is used as the login shell. A suggested convention is that of having all SLIP accounts begin with a capital `S', eg `Sfredm'. A sample <CODE>/etc/passwd</CODE> entry for a SLIP user looks like: <BLOCKQUOTE><CODE> <PRE> 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 </PRE> </CODE></BLOCKQUOTE> <P>After the user logs in, the <EM>login</EM> program, if it finds and verifies the user ok, will execute the <EM>diplogin</EM> command. <EM>dip</EM>, when invoked as <EM>diplogin</EM> knows that it should automatically assume that it is being used a login shell. When it is started as <EM>diplogin</EM> the first thing it does is use the <EM>getuid()</EM> function call to get the userid of whoever has invoked it. It then searches the <CODE>/etc/diphosts</CODE> file for the first entry that matches either the userid or the name of the <EM>tty</EM> device that the call has come in on and configures itself appropriately. By judicious decision as to whether to give a user an entry in the <CODE>diphosts</CODE> file, or whether to let the user be given the default configuration you can build your server in such a way that you can have a mix of static and dynamically assigned address users. <EM>dip</EM> will automatically add a `Proxy-ARP' entry if invoked in input mode, so you do not need to worry about manually adding such entries. <H3>Configuring <CODE>/etc/diphosts</CODE></H3> <P><CODE>/etc/diphosts</CODE> is used by <EM>dip</EM> 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 <CODE>/etc/diphosts</CODE> is as follows: <BLOCKQUOTE><CODE> <PRE> .. Suwalt::145.71.34.1:145.71.34.2:255.255.255.0:SLIP uwalt:CSLIP,1006 ttyS1::145.71.34.3:145.71.34.2:255.255.255.0:Dynamic ttyS1:CSLIP,296 .. </PRE> </CODE></BLOCKQUOTE> The fields are: <OL> <LI><CODE>login name</CODE>: as returned by getpwuid(getuid()) or tty name.</LI> <LI><CODE>unused</CODE>: compat. with passwd</LI> <LI><CODE>Remote Address</CODE>: IP address of the calling host, either numeric or by name</LI> <LI><CODE>Local Address</CODE>: IP address of this machine, again numeric or by name</LI> <LI><CODE>Netmask</CODE>: in dotted decimal notation</LI> <LI><CODE>Comment field</CODE>: put whatever you want here.</LI> <LI><CODE>protocol</CODE>: Slip, CSlip etc.</LI> <LI><CODE>MTU</CODE>: decimal number</LI> </OL> An example <CODE>/etc/net/diphosts</CODE> entry for a remote SLIP user might be: <BLOCKQUOTE><CODE> <PRE> Sfredm::145.71.34.1:145.71.34.2:255.255.255.0:SLIP uwalt:SLIP,296 </PRE> </CODE></BLOCKQUOTE> which specifies a SLIP link with remote address of 145.71.34.1 and MTU of 296, or: <BLOCKQUOTE><CODE> <PRE> Sfredm::145.71.34.1:145.71.34.2:255.255.255.0:SLIP uwalt:CSLIP,1006 </PRE> </CODE></BLOCKQUOTE> which specifies a cSLIP-capable link with remote address 145.71.34.1 and MTU of 1006. <P>Therefore, all users who you wish to be allowed a statically allocated dial-up IP access should have an entry in the <CODE>/etc/diphosts</CODE>. If you want users who call a particular port to have their details dynamically allocated then you must have an entry for the <CODE>tty</CODE> device and do not configure a user based entry. You should remember to configure at least one entry for each <CODE>tty</CODE> device that your dialup users use to ensure that a suitable configuration is available for them regardless of which modem they call in on. <P>When a user logs in they will receive a normal login and password prompt at which they should enter their SLIP-login userid and password. If these verify ok then the user will see no special messages and they should just change into SLIP mode at their end. The user should then be able to connect ok and be configured with the relevant parameters from the <CODE>diphosts</CODE> file. <H3>SLIP server using the <EM>dSLIP</EM> package.</H3> <P>Matt Dillon <CODE><dillon@apollo.west.oic.com></CODE> 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 <EM>tcsh</EM> installed as at least one of the scripts requires it. Matt supplies a binary copy of the <EM>expect</EM> utility as it too is needed by one of the scripts. You will most likely need some experience with <EM>expect</EM> to get this package working to your liking, but don't let that put you off. <P>Matt has written a good set of installation instructions in the README file, so I won't bother repeating them. <P>You can get the <EM>dSLIP</EM> package from its home site at: <B>apollo.west.oic.com</B> <BLOCKQUOTE><CODE> <PRE> /pub/linux/dillon_src/dSLIP203.tgz </PRE> </CODE></BLOCKQUOTE> or from: <B>metalab.unc.edu</B> <BLOCKQUOTE><CODE> <PRE> /pub/Linux/system/Network/serial/dSLIP203.tgz </PRE> </CODE></BLOCKQUOTE> Read the <CODE>README</CODE> file and create the <CODE>/etc/passwd</CODE> and <CODE>/etc/group</CODE> entries <B>before</B> doing a <CODE>make install</CODE>. <HR> <A HREF="NET3-4-HOWTO-8.html">Next</A> <A HREF="NET3-4-HOWTO-6.html">Previous</A> <A HREF="NET3-4-HOWTO.html#toc7">Contents</A> </BODY> </HTML>