SLIP/PPP Emulator mini-HOWTO Irish   Glen Reesor - Converted document from HTML to DocBook v4.1 (SGML) 2001-02-21 Revision History Revision 3.1 21 February 2001 Revised by: GCR Revision 3.0 7 August 1997 Revised by: Irish This document will describe how to get your Linux box to connect to a generic site via a SLIP/PPP emulator, such as SLiRP or TIA. I take no responsibility for your use of this information, but corrections are welcome. I will not attempt to describe all that can be done over this connection once established, but I will refer you to other documents or sites that will contain the relevant information. That done, let's do it! ------------------------------------------------------------------------------- Table of Contents 1. Introduction 1.1. Copyright_Information 1.2. Disclaimer 1.3. New_Versions 1.4. Feedback 2. How_Does_an_Emulator_Work? 2.1. What_is_TIA? 2.2. What_is_SLiRP? 2.3. What_about_Term? 2.4. What_about_real_SLIP/PPP? 3. Prerequisites 4. Preparing_your_Linux_Machine 4.1. Compiling_your_Kernel 4.2. Edit_some_files_in_/etc 4.3. DIP 4.4. PPP 5. Now_What? 5.1. Mail 5.2. News 5.3. Mosaic/Netscape 6. Miscellaneous 6.1. References 1. Introduction I am Irish, , available for comment on Linux almost everyday, when I'm not petting my cat or hugging my kid. This HOWTO is available in the following places: * http://www.linuxdoc.org * ftp://ftp.eskimo.com/u/i/irish * ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/mini/SLIP-PPP-Emulator ------------------------------------------------------------------------------- 1.1. Copyright Information This document is copyrighted (c) 2001 Irish and is distributed under the terms of the Linux Documentation Project (LDP) license, stated below. Unless otherwise stated, Linux HOWTO documents are copyrighted by their respective authors. Linux HOWTO documents may be reproduced and distributed in whole or in part, in any medium physical or electronic, as long as this copyright notice is retained on all copies. Commercial redistribution is allowed and encouraged; however, the author would like to be notified of any such distributions. All translations, derivative works, or aggregate works incorporating any Linux HOWTO documents must be covered under this copyright notice. That is, you may not produce a derivative work from a HOWTO and impose additional restrictions on its distribution. Exceptions to these rules may be granted under certain conditions; please contact the Linux HOWTO coordinator at the address given below. In short, we wish to promote dissemination of this information through as many channels as possible. However, we do wish to retain copyright on the HOWTO documents, and would like to be notified of any plans to redistribute the HOWTOs. If you have any questions, please contact ------------------------------------------------------------------------------- 1.2. Disclaimer No liability for the contents of this documents can be accepted. Use the concepts, examples and other content at your own risk. As this is a new edition of this document, there may be errors and inaccuracies, that may of course be damaging to your system. Proceed with caution, and although this is highly unlikely, the author(s) do not take any responsibility for that. All copyrights are held by their by their respective owners, unless specifically noted otherwise. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark. Naming of particular products or brands should not be seen as endorsements. You are strongly recommended to take a backup of your system before major installation and backups at regular intervals. ------------------------------------------------------------------------------- 1.3. New Versions The latest version number of this document can be found at: * http://www.linuxdoc.org * ftp://ftp.eskimo.com/u/i/irish * ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/mini/SLIP-PPP-Emulator ------------------------------------------------------------------------------- 1.4. Feedback Feedback is most certainly welcome for this document. Without your submissions and input, this document wouldn't exist. Please send your additions, comments and criticisms to the following email address : . ------------------------------------------------------------------------------- 2. How Does an Emulator Work? It is important to understand how a SLIP/PPP emulator works in general, to be aware of its limitations. First, you do not need to install the emulator on your machine. It runs on your remote host only. What you need on your machine is the TCP/IP and SLIP or PPP protocols installed in your kernel (more on that in a bit), and some clients. Here's what happens: you send network requests from your machine to your remote host over the SLIP/PPP link. The emulator grabs them and sends them out to the Net at large. Then, incoming data is sent back from the Net to your account on the remote host, where the emulator grabs it and sends it back over the SLIP/ PPP link to your machine. So, to the Net it appears as if you are working out of your account on the remote host, but to you it looks like you are really connected right to the Net. As you can see, this can confuse stuff that is incoming from the Net. For example, talk doesn't work via an emulator, because the incoming talk request tries to start the remote hosts talk daemon, not yours. The other big difference between an emulator and real SLIP/PPP is you are NOT assigned your own IP address; remember, you are only converting a dialup account to a SLIP/PPP connection. ------------------------------------------------------------------------------- 2.1. What is TIA? The_Intenet_Adaptor was written by the fine folks at marketplace.com. They have quit working on it now, and consider it a 'mature' product. The last version is 2.05; if you are going to use TIA, please get this version. Note At last report, marketplace.com have gone out of business. ------------------------------------------------------------------------------- 2.2. What is SLiRP? This is a freeware application, covered under the GNU Public License. It is out of beta, and is real stable. It sports a few more features than TIA, and is (reportedly) easier on host resources. Available at fine Linux FTP sites everywhere. ------------------------------------------------------------------------------- 2.3. What about Term? If you don't have root access to your machine for one reason or another, and you can't persuade someone who does to install SLIP and dip, then you won't have much choice except to use Term. If you want to know more about Term, please read the HOWTO on Sunsite. ------------------------------------------------------------------------------- 2.4. What about real SLIP/PPP? Hey, a lot of places are offering real SLIP/PPP at reasonable prices for non- dedicated dialup nowadays. If you can afford it, or feel the need, go for it. The Real Thing is always better than emulation. However, one of the things an emulator provides is security; it acts as an impregnable firewall, and with it you are pretty much as bulletproof as your provider is. You'll pay for it though, emulation is slower, and does not fully support every protocol. Still and all, emulation is good enough for most people, and is a fine way to connect to the Net. ------------------------------------------------------------------------------- 3. Prerequisites Enough already! How do I set it up? Alright hotrod, we're getting there, but first there's some info you need to get, and a couple of explanations. First, you need to get the IP address of your provider, if you don't have it already. You can do this by typing 'who' at a shell prompt there, or reading their /etc/hosts, or even just asking them. While your getting that, get the IP address of the POP/SMTP host and the NNTP server (if you don't know what those are, trust me and ask for them anyway, you'll need 'em). Next, let me explain quickly about hostnames and domain names. The hostname is the first part of a machines name, the domain is the rest of it. Like this: hostname.domain.name (a four parter would be hostname.do.main.name). Together, they make a Fully Qualified Domain Name (FQDN). The name of your Linux machine is stored in /etc/HOSTNAME, and yes, you can change it. In fact, please do (if you're using Slackware, it'll be "darkstar.frop.org" by default). Just edit the /etc/HOSTNAME file to be whatever you want - remember, if you are using an emulator, you are essentially invisible to the Net at large, so you can be creative. However, if you plan to get a real SLIP/PPP connection down the road sometime, you'll probably want to conform to being a sub-host of your provider. For example, if your provider is "info.superhiway.com", the domain is "superhiway.com" and the hostname is "info". So you could either be "offramp.info.superhiway.com" or just "offramp.superhiway.com". Either would work, and in either case your hostname is "offramp". ------------------------------------------------------------------------------- 4. Preparing your Linux Machine In a nutshell, here's what's required. I'll explain the first three in detail. * Compile your kernel to include SLIP and TCP/IP * Edit some files in /etc * Install and configure dip * Install pppd (optional, for PPP only) You will also need to get an emulator binary appropriate for your remote host and install it. SLiRP is available at Sunsite and other fine Linux FTP sites. All of the relevant info for TIA is available at TIAs_home_site. That's it! Let's get started. ------------------------------------------------------------------------------- 4.1. Compiling your Kernel If you have never done this, you should. And you should read the FAQ first, but don't worry, it's easy. If you want, you can e-mail me and I'll help. I'll assume that you have here, for the sake of brevity. When you 'make config', look for "Network Devices". Say 'y', of course, then say 'y' to SLIP, CSLIP, (or PPP) and TCP/IP and 'n' to everything else, unless you have ethercards or need some other protocol for something else. If you don't do this, it won't work!Finish compiling and installing the new kernel, then, ------------------------------------------------------------------------------- 4.2. Edit some files in /etc These files will set up your routes to your remote host. /etc is the directory for system configurations. Replace everything in double quotes with the appropriate values, naturally (but don't include the quotes - they are there for reference). There are three files you need to edit, they are: * /etc/hosts #The next line is required to be EXACTLY as below. 127.0.0.1 localhost #Note at the end of the next two entries the hostname is repeated. #This abbreviation is an alias, and is required for the first entry. #If you're on a LAN, you'll need to substitute your IP address for #the first one below. 192.0.2.1 "yourhostname.domain.name yourhostname" "XXX.XXX.XX.XX" "remotehostname.domain.name remotehostname" * /etc/host.conf order hosts, bind multi on * /etc/resolv.conf domain "yourdomain.name" #The next line usually uses the same remote IP address that's in /etc/hosts nameserver "XXX.XXX.XX.XX" * To use an NNTPserver, put this line in your /etc/profile export NNTPSERVER="remote.hosts.nntpservername" ------------------------------------------------------------------------------- 4.3. DIP DIP (Dialup Internet Protocol) is what you will use to dial up the remote host, start the emulator, and convert the line to SLIP/PPP. It comes in the "N" set of Slackware, along with a bunch of clients and utilities, some of which you may want to install also =). It is also available at Sunsite in an individual tar file Once you have it installed, you will need to have a dip script, Here's a sample, just plug in the appropriate stuff where the double quotes are (but don't include the quotes, they are there for reference). main: get $local "yourhostname.domain.name" get $remote "remotehostname.domain.name" #Your port here port cua"?" #Use 115200 for 28.8 modems speed 57400 reset #don't use spaces in your AT command string! init AT "string of commands" wait OK 5 # This will redial. If it doesn't work, play with the wait time (listen # to your modem). If it still doesn't work, mail me. # See also; the note at the bottom of the script re: error codes. dial: dial "phonenumber" print Dialing... if $errlvl != 0 goto error #You may need to change this wait time to suit your modem wait BUSY 20 if $errlvl == 0 goto dial login: print Connected and Logging in... #This wait and send gets me past my hosts Annex. Change for your site! wait ==> 60 send 4\n wait ogin: 60 if $errlvl != 0 goto login_error1 send "LOGIN"\n wait assword: 60 if $errlvl != 0 goto login_error2 send "PASSWORD"\n loggedin: wait "SYSTEM PROMPT" 60 if $errlvl != 0 goto shell_error print Logged in! send "emulator startup command"\n wait "emulator startup response" 60 if $errlvl != 0 goto emu_error #The recommended mtu setting is 1500, but this is faster interactively. #Ftp may be slower, so adjust to taste. get $mtu 296 default done: print CONNECTED to $remote with address $rmtip mode CSLIP goto exit error: print Dialing Error login_error1: print No Login login_error2: print No Password prompt shell_error: print No shell prompt emu_error: There was a problem starting the emulator exit: #This will error out when the -v flag is used, but work when run normally #(ends dip at a local prompt). \r ------------------------------------------------------------------------------- 4.3.1. DIP Notes Newer versions of dip don't return modem status codes (BUSY, NO CONNECT, etc.), they use numbers instead. Here's a table: * 0 = OK * 1 = CONNECT * 2 = ERROR * 3 = BUSY * 4 = NO CARRIER This would make your dial section look like this: dial: dial "phonenumber" print Dialing... if $errlvl != 0 goto error wait 1 20 if $errlvl != 1 goto dial Thanks to Lee Olds for that bit. \n = newline, \r = carriage return. You may require one or the other (or both) in the appropriate places. If the ones provided don't work, experiment. A word about the form of the wait and sends. If it isn't clear by the example, here's what's happening: wait ogin: 60 The script will wait for the remote to send 'ogin:' for 60 seconds. When it gets it, the script advances. If it doesn't get it, it will advance after the timeout of 60 seconds. if $errlvl != 0 goto login_error (This whole line is optional.) If the script is advancing because it got what it was waiting for, this gets skipped. if the script is advancing because it timed out, it will go to where you tell it to ('login_error1' in this case. send "LOGIN"\n DIP will send 'LOGIN' and a newline You can put in sleep statements if you need to, like this: "sleep 10" This will make the script pause for 10 seconds. After editing this file, rename it, say, remote.dip and put it in /root. Then, as root, run 'dip remote'. Use the -v flag the first time to debug it ('dip - v remote'), this will show you all the steps dip takes. Dip will only run as root, but there is a way to make it run from a user account. For now, if you need this info, ask. I may include it in this file later if enough people want it. If dip errors out right away, try removing the comments from the script. ------------------------------------------------------------------------------- 4.4. PPP The above gets you rolling with CSLIP, which is really fine most of the time. It truly is easy to get working, since the protocol is supported at the kernel level - just make sure it's in there and it works. However, some of you will want PPP, for what reasons, only you can say. I'm not going to tell you how to set it up here, there's a whole other HOWTO written just for that. What I will do is tell you what the gotchas are when using PPP with an emulator. First, the latest version of DIP says you can use it to start PPP, and you can, BUT it only starts the PPP daemon - no flags, nothing. So if you want to use DIP to start PPP, be sure to put all of your startup info in the /etc/ppp/ options file, or it won't work. Speaking of the options file, one of the things that MUST be in there no matter how you start pppd is this: '192.0.2.1:XXX.XXX.XX.XX'. What this is is 'localIPaddress:remoteIPaddress'. You need it there because normally pppd can fill in the blank itself, but fails when connecting to an emulator. Be sure to get the latest and greatest pppd package. It seems there were a few versions recently that had a bit of trouble. Lastly, unless you have a good reason to use PPP, or just want to learn how it works, you really don't need it. I have tried them both, and didn't notice any performance difference with the standard set of clients. Of course, Your Mileage May Vary. :) ------------------------------------------------------------------------------- 5. Now What? Hey, if all went well, you are now connected to the Net! Try a 'telnet remotehostname' (remember that abbreviation in your hosts file?). You should get the remotes telnet login prompt. Go on, try it! You can now telnet/FTP/etc. anywhere on the Net from your local machine. How? Your machine is using the remote as a nameserver to resolve addresses (resolv.conf). Experiment, find out what works and what doesn't. You will not be able to use services that are not provided already on your remote host! For example, if your server doesn't allow telnets, chances are you can't do it either. Why? Because the emulator is only re-directing what is already available. ------------------------------------------------------------------------------- 5.1. Mail The obvious text based solution is Pine, you can get it from The_University_of Washington. My pick for 'Best Mail Reader, X Based' has to go to XFmail. This has now gotten out of beta, and rocks. Easy to install; requires no local mail system be installed (but will work with local spools) because it has POP built in - no more popclient/fetchpop! Easy to use; totally customizable from the GUI. Also supports MIME. Get it from The_XFmail_Homesite. ------------------------------------------------------------------------------- 5.2. News The text based News Reader SLRN is fairly simple to install and use. It is a true NNTP newsreader, which means no local news transport is required to make it work (you don't have install Cnews or INN). It does require that you have access to an NNTPserver, naturally, but most ISPs have this. It is text based, but has color and mouse support, and runs fine in an rxvt window. The X based News Reader KNews is almost perfect. As with SLRN above, no local transport is required, but an NNTP server is. It's at least worth a look. ------------------------------------------------------------------------------- 5.3. Mosaic/Netscape Obviously, you will need to have X running for this to work, but it's a simple matter of FTPing the binary, unpacking it, and installing it. ------------------------------------------------------------------------------- 6. Miscellaneous If I've left anything out, or you still have questions, I read my mail daily. This information gets updated fairly regularly, so keep checking back every so often (I'll change the version numbers). Naturally, the more you contribute, the more info will be included here, so don't hesitate to tell me about whatever you have to offer. If you would like some help, or are having trouble with your setup, I'll help but you must send me the following info: 1. A copy of your three /etc files. 2. A copy of your script output, run with the -v flag (please remove your password from this!) Even if you don't have anything to contribute, but used this info sucsessfully, please mail me. I want to know how useful this really is. ------------------------------------------------------------------------------- 6.1. References Sunsite is the FTP site sunsite.unc.edu, a veritable plethora of everything Linux, including almost every FAQ, HOWTO, and README written. Marketplace.com is the home of TIA, the only place it is available. Note Marketplace.com appears to be out of business. I am Irish, , available for comment on Linux almost everyday, when I'm not petting my cat or hugging my kid. This HOWTO is available in the following places: * http://www.linuxdoc.org * ftp://ftp.eskimo.com/u/i/irish * ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/mini/SLIP-PPP-Emulator