-->
Previous | Table of Contents | Next |
For SLIP connections, two Linux programs are involved: dip and slattach. Both programs can be used to initiate the SLIP connection. You cannot dial into a SLIP line with a standard communications program because of the special system calls that SLIP uses.
dip and slattach have different purposes. The slattach program, which simply connects to the serial device, is used when there is a permanent connection to the SLIP server (no modem or setup handshaking is required). The dip program handles the initiation of the connection, the login, and connection handshaking. If you use a modem to connect to a SLIP server, you should use dip. The dip program can also be used to configure your own system as a SLIP server, allowing others to call in to it.
SLIP is a fairly simple network protocol because only two devices are involved: yours and the servers. When the connection is established, SLIP sends an IP address that will be used for that connection. Some systems use the same IP address (static), while others have a different IP address each time a connection is made (dynamic). The configuration is slightly different for each type.
The easiest way to dedicate a serial port for SLIP is the slattach program. This command is supported by most Linux versions. The slattach command takes the device name of the serial port as an argument. For example, to dedicate the second serial port (/dev/cua1 or /dev/tty2A, depending on the operating system) to SLIP, issue the following command or a similar command with the proper device name instead of /dev/cua1 (which is the Linux convention for modem serial ports):
slattach /dev/cua1 &
The slattach command is sent into background mode by the ampersand. Failure to send to background means the terminal or the console the command is issued from is not usable until the process is terminated. You can embed the slattach command in a startup file such as the rc files or a session shell startup file if you want.
Once the slattach command has executed successfully, the serial port is set to the first SLIP device (usually /dev/sl0). If you are using more than one serial port for SLIP lines, you need to issue the command for each line. By default, most Linux systems set the SLIP port to use CSLIP (compressed SLIP). If you want to override this action, use the -p option and this device name:
slattach -p slip /dev/cua1 &
Its important to make sure that both ends of the connection use the same form of SLIP. There is slip6 (a 6-bit version of SLIP) and adaptive SLIP (which adjusts to whatever is at the other end of the connection). For example, you cannot set your device for CSLIP and communicate with another machine running 6-bit SLIP.
After the serial port is set for SLIP usage, configure the network interface using the same procedure as normal network connections. For Linux, the commands used are ifconfig and route. For example, if your machine is called merlin and you are calling the remote machine arthur, issue the following commands:
ifconfig sl0 merlin-slip pointopoint arthur route add arthur
The ifconfig command above configures the interface merlin-slip (the local address of the SLIP interface) to be a point-to-point connection to arthur. The route command adds the remote machine called arthur to the routing tables.
If you want to use the SLIP port for access to the Internet, it must have an IP address and an entry in the /etc/hosts file. That gives the SLIP system a valid entry on the Internet.
After the ifconfig and route commands execute, you can test and use your SLIP network. If you decide to remove the SLIP interface in the future, you must first remove the routing entry, use ifconfig to take down the SLIP interface, and then kill the slattach process. The first two steps are done with these commands:
route del arthur ifconfig sl0 down
The termination of the slattach process must be done by finding the process ID (PID) of slattach (with the ps command), and then issuing a kill command. (See Chapter 34, Processes, for more information on killing a process if you are unsure of the method.)
If you have a dedicated connection to the SLIP server and you want to use slattach, the rc.inet1 file is modified to have the following lines in it:
IPADDR=123.12.3.1 # Your machines IP address REMADDR=142.12.3.12 # The SLIP server IP address slattach -p cslip -s 19200 /dev/ttyS0 # set baud and port as needed /etc/ifconfig sl0 $IPADDR pointopoint $REMADDR up /etc/route add default gw $REMADDR
These lines, or very similar lines, appear in most rc.inet1 or rc.inet files, usually commented out. Amend the information to show the proper IP addresses, ports, and baud rates. The cslip argument for slattach tells the program to use slip with header compression. If this causes problems, change it to slip.
If the SLIP server you are connecting to allocates IP addresses dynamically, you cant put an IP address in the configuration files because it changes each time. Most SLIP servers display a message with the IP address when you connect, and dip can capture these numbers and use them to alter the system parameters appropriately.
Previous | Table of Contents | Next |