The Joy (and Agony) of SLIP
There are two primary ways that you can connect to another machine using SLIP. If it is a link over a leased line, or a null-modem cable, you should use slattach. If you are connecting over a modem (or allowing other computers to connect to yours over a modem) you should use dip.
To configure a SLIP connection with slattach, you need to execute the commands:
/sbin/slattach -p prot -s baud dev & /sbin/ifconfig sl0 iplocal pointtopoint ipremote up /sbin/route add default dev sl0 &
where prot is the protocol to use (normally slip or cslip), baud is the baud rate to connect at, dev is the device to use, iplocal is your local IP address, and ipremote is the remote IP address. For example, if your IP address is 188.8.131.52, and you want to connect to a machine with IP address 184.108.40.206 using slip at 19200 baud on /dev/ttyS1 (COM2), you would give the commands:
/sbin/slattach -p slip -s 19200 /dev/ttyS1 & /sbin/ifconfig sl0 220.127.116.11 pointtopoint\ 18.104.22.168 up /sbin/route add default dev sl0 &
These commands can either be added to a startup file, if you always want the SLIP connection to be initialized, or you can create a simple shell script to execute them for you. You'll have to run this shell script as root for slattach to work. If, instead of a shell script, you create a C or perl program owned by root, you can make it setuid (always run as root) by typing chmod u+s file (where file is the name of the program). Take note of the “&” following the /sbin/slattach line. Older versions of the NET-2 HOWTO omitted the ampersand, which caused Linux to lock up when booted if the commands were added to the startup files.
The dip program is a little more complicated to use. To use it to connect to another machine, you must create a script file telling dip how to call the machine, log onto it, and start slip (if slip isn't started automatically). The NET-2 HOWTO and the dip(8) man page both give sample dip scripts (dip(8) means that the man page for dip is in chapter 8 of the man pages, so you can read the man pages with the command man 8 dip). Dip can also be used to allow other people to connect to your machine using SLIP. To do this, you must create a special userid that has dip as its shell. Instructions for doing this are in the dip(8) man page.
Troubleshooting: Some common problems and how to fix them
Linux locking up at boot time
As I mentioned before, if you start slattach in your system startup files, you must add an ampersand (“&”) after the slattach line to run slattach in the background. Otherwise your system will lock up when you reboot.
Packets disappear without a trace
There can be many causes of this. The first thing to check is that your serial link is correct. If you are using a null-modem cable, make sure that it's plugged in at each end. If you are connecting over a modem, make sure that the modem is working correctly. If you are using a null-modem cable, and you have easy access to both ends of the link, try starting a terminal program on one end, and see if anything shows up if you ping the machine running the terminal program. If garbage appears in the terminal program, then you know that your serial link is working.
There seems to be a problem with CSLIP in some versions of Linux. If you are using CSLIP and packets seem to be disappearing, try using SLIP instead.
Unknown host errors occur
The first thing to do is to try using an IP address instead of a hostname. If you were trying to type ping acme when you got the Unknown host error, find the IP address of the machine acme, and ping it instead. For example, if acme has an IP address of 22.214.171.124, type
instead. If using the IP address works, you have a problem with translating hostnames into IP addresses. Make sure your /etc/hosts file has a correct entry for your hostname, or if you are using a nameserver, make sure that your system isn't having trouble contacting the nameserver. As a temporary fix, adding an entry for the hostname into your /etc/hosts should solve the problem.
If the IP address doesn't work either, you may need to use the route command to tell your system how to find the remote system. The NET-2 HOWTO and the route(8) man page show you how to use the route command.
“Network is Unreachable” Errors
If you see messages like:
ping: sendto: Network is unreachable
when you are trying to use ping, the most likely cause is incorrect routing. Using the /sbin/route command by itself shows you the current routing table. If the routing table is configured correctly, you should see something like:
Destination Gateway Genmask Flags Metric Ref Use Iface 127.0.0.0 * 255.0.0.0 U 0 0 0 lo default * * U 0 0 3 sl0
If the last line isn't present, and you are using slattach, make sure that the /sbin/route line described above has been used. If the last line is present, or if you are using dip, see the NET-2 HOWTO, and the dip(8) and route(8) man pages.
What alternatives are there to SLIP?
There are other programs that provide functionality similar to SLIP. Here is a brief overview of some of the most popular.
If you want to connect two local machines, the best way is to use ethernet, which gives far higher throughput than a serial link. Unfortunately, ethernet cards can be fairly expensive. If you can't afford a pair of ethernet cards, or if you want to connect to another machine using a modem, there are other options. SLIP isn't the only protocol that provides TCP/IP (or TCP/IP-like) connectivity over a serial line. PPP (Point-to-Point Protocol) is a newer protocol that serves a purpose similar to SLIP. PPP was designed specifically to be an Internet standard, and is documented in a number of Internet RFCs (Requests for Comments). This design process makes PPP more standardized than SLIP. Additionally, PPP was designed to address known weaknesses of SLIP in areas of security and robustness. Unfortunately, since PPP is a lot newer and more difficult to implement than SLIP, it isn't available on as many systems as SLIP is.
Another common program is term. Term does not provide a full TCP/IP connection, but it does allow some similar functionality. It will let you run multiple terminal sessions over a single serial line (like SLIP does), but it won't let you run TCP/IP programs (like ftp, Mosaic, or telnet) on your Linux box without recompiling them to include term support. It will let you display remote X11 programs on your local machine, so you could, for instance, run Mosaic remotely and display it on your Linux box. You can also use term to connect ports on the local machine to ports on the remote machine, which allows you to read news and mail on your Linux box. The biggest advantage that term has over SLIP is that it can be set up on both ends without requiring root privileges. Unlike SLIP, you don't have to change any system configuration files to use term.
PLIP (Parallel Line Internet Protocol) is a SLIP-like protocol that runs over a parallel line. PLIP is only intended to connect two machines locally, but it gives higher transfer rates than a comparable SLIP connection at the cost of using more CPU time than SLIP. To use PLIP you need a special parallel cable, like those used in a number of DOS PC-to-PC file transfer packages.
If you only want to connect two local machines, you might want to consider just running a terminal program over a serial link. The configuration is certainly simpler than setting up SLIP (you need to start a getty process on the appropriate serial port), and if you run a program like screen (which allows multiple sessions in a manner similar to virtual consoles), you might get all the functionality that you need. Certain operations (like transferring files) are more efficient when just using a terminal program, since there isn't the overhead imposed by SLIP. The disadvantage is that you can't run X11, or any other TCP/IP programs through a terminal program.
The Serial and NET-2 HOWTOs have a lot of useful information about networking and serial links with Linux in general. The NET-2 HOWTO has an entire section devoted to SLIP. The HOWTO files can be found in /usr/doc/faq/howto on most Linux systems, or on the ftp site sunsite.unc.edu in the directory /pub/Linux/docs/HOWTO.
The Usenet newsgroups comp.os.linux.help and comp.os.linux.admin both discuss SLIP quite regularly. Reading these newsgroups will often answer simple questions about SLIP (and many other things). It's a good idea to read the appropriate HOWTOs and FAQs (Frequently Asked Question lists) before asking any questions, since some people become quite irate when you ask questions that are answered somewhere else.
There are a number of books that address administrating TCP/IP connections. The best I have come across is TCP/IP Network Administration, by Craig Hunt, published by O'Reilly & Associates, ISBN 0-937175-82-X.
SLIP isn't the newest TCP/IP protocol around, but it is commonly available and is usually quite stable. It's a good choice for many serial TCP/IP links.
Warren Baird runs Linux on a 386 DX-33, and has been hacking various flavours of Unix for five years. He is on the verge of getting a B.Math joint-honours degree in Computer Science and Com-binatorics & Optimization at the University of Waterloo, Ontario, Canada. He can be reached at email@example.com , or firstname.lastname@example.org .
Warren Baird (email@example.com) or (firstname.lastname@example.org) runs Linux on a 386 DX-33, and has been hacking various flavours of Unix for five years. He is on the verge of getting a B.Math joint-honours degree in Computer Science and Com-binatorics & Optimization at the University of Waterloo, Ontario, Canada.
|Be Kind, Buffer!||Apr 26, 2017|
|Preparing Data for Machine Learning||Apr 25, 2017|
|openHAB||Apr 24, 2017|
|Omesh Tickoo and Ravi Iyer's Making Sense of Sensors (Apress)||Apr 21, 2017|
|Low Power Wireless: 6LoWPAN, IEEE802.15.4 and the Raspberry Pi||Apr 20, 2017|
|CodeLathe's Tonido Personal Cloud||Apr 19, 2017|
- Preparing Data for Machine Learning
- Teradici's Cloud Access Platform: "Plug & Play" Cloud for the Enterprise
- The Weather Outside Is Frightful (Or Is It?)
- Simple Server Hardening
- Low Power Wireless: 6LoWPAN, IEEE802.15.4 and the Raspberry Pi
- Understanding Firewalld in Multi-Zone Configurations
- From vs. to + for Microsoft and Linux
- Server Technology's HDOT Alt-Phase Switched POPS PDU
- Gordon H. Williams' Making Things Smart (Maker Media, Inc.)