Next: Using dip Up: Serial Line IP Previous: General Requirements

# SLIP Operation

Dial-up IP-servers frequently offer SLIP service through special user accounts. After logging into such an account, you are not dropped into the common shell; instead a program or shell script is executed that enables the server's SLIP driver for the serial line and configures the appropriate network interface. Then you have to do the same at your end of the link.

On some operating systems, the SLIP driver is a user-space program; under , it is part of the kernel, which makes it a lot faster. This requires, however, that the serial line be converted to SLIP mode explicitly. This is done by means of a special tty line discipline, SLIPDISC. While the tty is in normal line discipline (DISC0), it will exchange data only with user processes, using the normal read(2) and write(2) calls, and the SLIP driver is unable to write to or read from the tty. In SLIPDISC, the roles are reversed: now any user-space processes are blocked from writing to or reading from the tty, while all data coming in on the serial port will be passed directly to the SLIP driver.

The SLIP driver itself understands a number of variations on the SLIP protocol. Apart from ordinary SLIP, it also understands CSLIP, which performs the so-called Van Jacobson header compression on outgoing IP-packets. This improves throughput for interactive sessions noticeably. Additionally, there are six-bit versions for each of these protocols.

A simple way to convert a serial line to SLIP mode is by using the slattach tool. Assume you have your modem on /dev/cua3, and have logged into the SLIP server successfully. You will then execute:

    	# slattach /dev/cua3 &

This will switch the line discipline of cua3 to SLIPDISC, and attach it to one of the SLIP network interfaces. If this is your first active SLIP link, the line will be attached to sl0; the second would be attached to sl1, and so on. The current kernels support up to eight simultaneous SLIP links.

The default encapsulation chosen by slattach is CSLIP. You may choose any other mode using the -p switch. To use normal SLIP (no compression), you would use

    	# slattach -p slip /dev/cua3 &

Other modes are cslip, slip6, cslip6 (for the six-bit version of SLIP), and adaptive for adaptive SLIP. The latter leaves it to the kernel to find out which type of SLIP encapsulation the remote end uses.

Note that you must use the same encapsulation as your peer does. For example, if cowslip uses CSLIP, you have to do so, too. The symptoms of a mismatch will be that a ping to the remote host will not receive any packets back. If the other host pings you, you may also see messages like ``Can't build ICMP header'' on your console. One way to avoid these difficulties is to use adaptive SLIP.

In fact, slattach does not only allow you to enable SLIP, but other protocols that use the serial line as well, like PPP or KISS (another protocol used by ham radio people). For details, please refer to the slattach(8) manual page.

After turning over the line to the SLIP driver, you have to configure the network interface. Again, we do this using the standard ifconfig and route commands. Assume that from vlager, we have dialed up a server named cowslip. You would then execute

               # ifconfig sl0 vlager pointopoint cowslip
               # route add cowslip
               # route add default gw cowslip

The first command configures the interface as a point-to-point link to cowslip, while the second and third add the route to cowslip and the default route using cowslip as a gateway.

When taking down the SLIP link, you first have to remove all routes through cowslip using route with the del option, take the interface down, and send slattach the hangup signal. Afterwards you have to hang up the modem using your terminal program again:

               # route del default
               # route del cowslip
               # ifconfig sl0 down
               # kill -HUP 516

Next: Using dip Up: Serial Line IP Previous: General Requirements