SLIRP(1) | General Commands Manual | SLIRP(1) |
slirp - TCP/IP emulator
slirp [options|commands]
slirp help
slirp "help cmd"
Slirp is a TCP/IP emulator which turns an ordinary shell account into a (C)SLIP/PPP account. This allows shell users to use all the funky Internet applications like Netscape, Mosaic, CUSeeMe, etc.
Slirp is copyright (c) 1995 Danny Gasparovski. All rights reserved. See the section COPYRIGHT for details.
This manpage is organized as follows. First, basic usage is described very briefly. This is followed by details of configuration files, commands, and command-line options. Several sections discussing technical issues (special addresses, port redirection, baudrate setting) are next, followed by answers to frequently-asked questions and common problems. Contact information, acknowledgements and the copyright notice are at the end.
Please read this manpage thoroughly before reporting problems!
To run Slirp, simply type:
slirp
(or whatever the full path to Slirp is). That's it. Now you activate your SLIP/PPP software, and start your applications.
All you have to remember is this: Once you run Slirp, your shell account now looks exactly like a SLIP/PPP account (with some limitations of course). Any documentation that you have telling you how to connect to a SLIP/PPP account is completely valid for Slirp as well.
To quit Slirp you simply kill your SLIP/PPP software and type five 0's (zeroes), with a 1 second gap between each zero. Slirp will then exit and you will be back at your shell prompt.
You can also "disconnect" Slirp by typing five 1's (one's), with a 1 second gap between each. This will disconnect Slirp from your shell's terminal and put Slirp in the background. Later, you can type
slirp -l 0
to "reconnect" Slirp again.
Quick note for PDA users: If you set SLIRP_TTY to the tty connected to your PDA (Palm, POSE emulator, etc.), Slirp will use that tty for communication. You can use PPP without full masquerading, although you will be subject to the standard Slirp constraints. You may need to experiment to find the correct baud rate. Start with 19200 for Palms. If Slirp was not compiled with DO_CFSETSPEED, you'll need to set the speed on the tty manually. Use an appropriate variant of "stty 19200 < /dev/pilot" after starting slirp.
Slirp can be configured in 3 different ways: the command line, the configuration files, and "on-the-fly" configuration by telnet-ing to 10.0.2.0 and entering the commands there (see "SPECIAL ADDRESSES," below).
The configuration file is located in your home directory (~) and is called ".slirprc", hence the path to your configuration file is "~/.slirprc".
Options which can appear in a configuration file can also be given on the command line. E.g., If your .slirprc file looks like the following:
redir 5022 21
redir X
you can achieve the same thing by running Slirp as:
slirp "redir 5022 21" "redir X"
(Notice the quotes, they ARE significant). The reverse is also true. E.g., if you run slirp as:
slirp -P -b 14400
you can create your .slirprc file too look like the following:
-P
-b 14400
(Notice that only ONE command per line is allowed in configuration files). The 2 types of options can also be mixed. For example:
In .slirprc:
-P
-b 14400
redir 5022 21
Command line:
slirp -P -b 14400 "redir 5022 21"
Note that on the command line, any command/option that does not begin with a '-' or '+', and has spaces in it, MUST be enclosed in quotes. E.g., The following are all legal:
slirp -P "redir udp 5022 25" -vj -b 14400
slirp "ppp" "baudrate 14400"
slirp ppp "baudrate 14400"
(Notice that even though "ppp" does not begin with a '-' or '+', it does not need to be enclosed in quotes because it has no spaces in it)
The following are NOT legal:
slirp baudrate 14400
slirp "-b 14400"
(Because "-b" starts with a '-' you must NOT enclose it in quotes.) Easy, eh?
Note: Whenever Slirp expects an IP address as an argument (E.g., in the command "redir") and the IP address argument is not given, then the default used is different depending on where the command appeared; if it was in ~/.slirprc then the default is 10.0.2.15; if it was in a telnet 10.0.2.0, then the IP address used is the IP address from where the telnet 10.0.2.0 connection was made. For example, if you have a LAN at home and telnet to 10.0.2.0 from one of the hosts and issue a "redir" command, Slirp will use the IP address of the host from where you made the telnet 10.0.2.0 connection. Also, if you use an IP address on your PC other than 10.0.2.15, you should include it as an argument whenever Slirp expects it, for example with the redir command:
redir 5555 your.ip.address:5555
A few notes on configuration:
Slirp includes an "online-help" facility. To get a list of commands accepted by Slirp give it the command "help". I.e, you can either run Slirp from your shell prompt as:
slirp "help"
or once Slirp is running, telnet to 10.0.2.0 and type:
help
To get a brief description of each command simply type "help COMMAND". E.g.:
slirp "help baudrate"
from the command line, or
help baudrate
in telnet to 10.0.2.0.
In the following descriptions, items within square brackets are optional. "Usable" refers to where it can be used, ie: "command-line/config-file", "telnet", or "anywhere" (which means it can appear in either command-line/config-file or be given via telnet). "Command-line" gives the command-line equivalent, where applicable.
Example: redir X 10.0.2.15:0.0
Note: This will print the command needed to enter into each shell from where you launch your X apps.
See also: show X.
Usable: telnet
Example: show X
Note: This is useful if you forget the command to give to your shell for X redirection.
See also: redir X, log start.
Example: redir tcp 5021 to 21
Allow users to ftp to your local machine using your host's port 21. (ftp
your.hosts.name 5021).
Note: if this command is in your .slirprc file and no address is specified, it will assume that your local IP address is 10.0.2.15. If you enter the command from the slirp control telnet IP it will use the IP address you are accessing with.
Example: baudrate 14400
Note: higher numbers generally allow better transfer rates for ftp sessions, but interactive sessions could become less responsive. the optimum value is *JUST* when ftp sessions reach maximum throughput, but this can be hard to find (especially on compressing modems) so you should choose the maximum throughput you would expect from your modem.
Example: special address 10.0.3.0
Note: The ADDRESS for special must end in 0 (zero) and other addresses are classed from this. The default special address is 10.0.2.0 giving the following defined IP's:
10.0.2.0 slirp control telnet IP
10.0.2.1 slirp exec IP
10.0.2.2 slirp host alias
10.0.2.x add [pty]exec optional address
Example: add ptyexec csh:55
A telnet connection to the slirp exec IP (default 10.0.2.1) will start and
connect you directly to the csh program on the host. (telnet 10.0.2.1
55).
Example: add exec nntpd:10.0.2.3:119
A program that attempts to open port 119 at address 10.0.2.3 will be connected
to the nntpd program.
Note: The use of the ptyexec form requires the slirp.telnetd helper application be available on your path. Also note that ADDRESS must be of the form SPECIAL_ADDRESS.xx (10.0.2.xx by default).
Example: nocompress
Start in SLIP mode.
Example: compress
Start in CSLIP mode.
Note: The default method of operation generally performs well. You should only have to use this command if you find that your host and local system are failing synchronize the connection type.
Example: mtu 1500 Set the mtu to its largest allowable size.
Note: Larger values generally improve the performance of graphics web browsers and ftp transfers across the serial link, at the expense of interactive performance. The default value of 552 seems to be a reasonable compromise for connections at 14400 baud.
This is the same as
add ptyexec PROGRAM:23
Note: By default slirp connects /bin/sh to the exec IP telnet port.
Note: you must enter the options exactly as you entered it in add [pty]exec.
**This description is incomplete.**
Note: It is recommended you use "close N" instead, as this merely wipes out the session, whereas "close N" closes it properly, as a good little tcpip-emulator should :)
"kill -1" shouldn't be used, it will kill the first session it finds with -1, which usually is the command-line connection.
Example: add emu ftp 8021
If you wish to ftp to somewhere on port 8021.
Example: add emu ftp 8021:0
If your home ftp server is on port 8021. NOTE: this does NOT mean if you
redirect port 8021 for your ftp daemon, it refers the the port AT HOME at
which ftpd is listening to.
Example: add emu none:lowdelay 8000
If you telnet somewhere on port 8000, and you wish those packets to go on the
fastq (ie: so they have a higher priority than, say, ftp packets). This
tells slirp that any packets destined for port 8000 will not have any
emulation, but it will be set IPTOS_LOWDELAY.
All addresses of the form 10.0.2.xxx are special to Slirp (this can be changed with the "special addr" command). The following is a description of what each of the addresses mean:
Port redirection is an important concept in TCP/IP emulators because it allows other people to connect to your PC, as well as allowing some programs to work which normally would not work.
First you need to realize that under Slirp, nobody on the Internet can address your PC directly, since you do NOT have an IP address that anybody else can see. The ONLY way they can contact you is through the remote host (where Slirp is running).
What has this got to do with Port redirection? Lots. For other people on the Internet to be able to connect to your PC, Slirp needs to listen for connections on a specific port on the remote host, then "redirect" this connection and have it connect back to your PC.
For example, say you are running an FTP server on your PC and you want others to be able to connect to it, get files, upload files, etc. What you need to do is pick a port number, any port number above 1024 (for security reasons), and tell Slirp that any connections on that port are really connections to your FTP server. You do this with the "redir" command.
For this example, say you choose 5555 as the port to redirect (this can be ANY number, provided nobody else is using it). You simply give Slirp the command:
redir 5555 21
The second argument, 21, is the port that is used by FTP. You could have also used the command:
redir 5555 ftp
and Slirp will figure out that "ftp" means 21. This command is basically telling Slirp "any connections to this host (where Slirp is running) on port 5555 are really connections to the home PC on port 21 (the port used by the FTP server)".
Now you simply tell others to connect to the Remote Host (where Slirp is running), which IS visible on the Internet, on port 5555 and they will be connected to your FTP server.
This same technique is used when a program uses a specific port for communication, for example Kali, an IPX emulator over TCP/IP allowing users to run IPX games over the Internet. Kali uses UDP port 2213 for communication so for others to be able to send a packet to your PC on UDP port 2213 you need to do the following:
redir udp 2213 2213
All packets now destined for the Remote Host on UDP port 2213 will be sent to your PC on port 2213.
Here is a list of programs which need a port redirection to work. YOUR_PC_ADDRESS refers to the IP address you assigned to your PC. If it is not supplied, 10.0.2.15 is assumed.
Please let me know of other programs which require redirection like the above. See "GETTING HELP" for details on how to contact me.
Slirp's "baudrate" option has caused some confusion. This section will explain exactly what it's for and how to use it.
When sending data over the modem to your PC, Slirp needs to know how much data it can send over without "saturating" the link. If Slirp was to send as much data as it could, the Operating System would buffer a LOT of it - 20k is not uncommon. This could severely "lag" any telnet connections if you happen to be FTP-ing a file at the same time. This is because when you type a character, you will not see that character on the screen until the the other end sends you the "echo", so if there is 20k worth of data buffered you will need to wait until 20k of data is received before you see that character on your screen.
To counter this, Slirp uses the "baudrate" option to limit the amount of data it sends over the link to prevent the Operating System from buffering too much of it. So if you give Slirp a "baudrate" of 14400, Slirp will send data at a rate of 14400 Baud modem (with no compression).
In general, the baud rate at which the connection was made should be the "baudrate" you give to Slirp. So, for example, if you connected at 14400 Baud, you should give Slirp the option "baudrate 14400". However, since most modems today do compression (v.42bis), it is very difficult for Slirp know how much data to send to keep the link "full", yet prevent too much buffering by the Operating system.
Therefore you should choose a "baudrate" appropriate to your needs: if you use telnet a lot while downloading compressed files, you should set your "baudrate" to the same as the CONNECT speed of your modem. Downloading compressed files should not suffer, and telnet sessions will be far more responsive. However, sending text over the modem will not be as fast, because your modem will compress the data and send it faster than Slirp expects. Giving a "baudrate" the same as the CONNECT speed will effectively turn off modem compression.
If you do not use telnet very much, you should set your "baudrate" to the maximum theoretical speed your modem can do. For example, if you connect at 14400 and use v.42bis compression, which can compress up to 4x, you should set your "baudrate" to 14400*4 = 57600. This will ensure any compressible data will get compressed, and a maximum throughput will be attained, at the expense of telnet sessions which will be almost unusable if you happen to be downloading files at the same time.
Note however that you can change the "baudrate" setting at any time. Simply telnet to 10.0.2.0 and enter "baudrate XXX" and Slirp will change the rate at which data is sent. This can be useful for example if you're downloading a lot of compressed files, but in the middle of the download you want to read mail. Simply change the "baudrate" to the CONNECT speed, and when you're finished, change it back to the maximum theoretical speed.
Also, keep in mind that the "baudrate" is also used for other calculations. For example, if there are many connections, Slirp will try to be fair and send one packet per connection in a round-robin fashion. This makes all connections "smooth" instead of sending a bunch of packets for one connection, then a bunch of packets for another connection, etc. But if the "baudrate" is too high, the is exactly what will happen. Packet priority selection also uses the "baudrate"; I.e., if there are packets queued ready for sending from both an FTP connection and a telnet connection, the telnet packets will be sent first. But again, this will only work if the "baudrate" reflects the amount of data Slirp can send, and generally won't work if you set it to the maximum theoretical connection speed.
So here are my tips:
I personally have by baudrate set at 14400, the speed at which my modem connects, even though the modems do v.42bis compression. Compressed file downloads are just as fast, and telnet sessions during FTP downloads are surprisingly responsive. Try it yourself, there's a world of difference.
Any programs that bind()'s a port, then tell the other end of the connection where they should connect() to this bound port.
For example, when you "get" a file during an FTP session, the FTP client bind()'s a socket, has a look at which port the socket is bound to, then tells the FTP server the address and port of this socket (with the PORT command). The FTP server then connect()'s to this address/socket pair.
Now, since your machine isn't really on the Internet, this connect() request will not arrive to your host, so it will not work.
Slirp emulates this by bind()ing it's own port on the server that *is* on the Internet, and tells the FTP server about *that* address/socket pair. When the server connect()'s to it, Slirp will then connect back to your machine.
At present, the following programs are emulated:
rlogin ftp ksh irc (for /dcc) RealAudio talk/ytalk/ntalk CUSeeMe
slirp "asyncmap ffffffff" "escape ff"
(quotes included!) This will tell Slirp to escape the most common "nasty characters.
X Redir: In sh/bash/zsh/etc. type: DISPLAY=IP.ADDRESS:X.Y; export DISPLAY
X Redir: In csh/tcsh/etc. type: setenv DISPLAY IP.ADDRESS:X.Y
Now, when you telnet to the host you wish to run the X programs from, you should do as Slirp suggest above; type either of the two commands, depending on which shell you are using. You could also run the X program as "xprog -display IP.ADDRESS:X.Y" as printed above.
keepalive
to your ~/.slirprc file. This will make Slirp probe each TCP connection every minute or so. You can change this interval by giving keepalive the number of seconds:
keepalive SECONDS
Note that no probes will be sent if there are no TCP connections. So you need at least one active TCP connection for this to work.
There are several sources of help. First, read the previous sections "Troubleshooting" and "Answers to Frequently Asked Questions (FAQs)".
If that fails, try the Slirp Home Page at:
http://blitzen.canberra.edu.au/slirp
There are lots of neat links there to other pages which have specific configuration information.
There is also a Newsgroup dedicated to SLIP-emulators called alt.dcom.slip-emulators. You will find lots of discussion about Slirp and other "SLIP-emulators". The FAQ (Frequently Asked Questions) for alt.dcom.slip-emulators is included in the "docs" directory, I would suggest reading this as well.
If all else fails, send me e-mail to danjo@blitzen.canberra.edu.au with the following information:
*PLEASE* include all the above information. If you do not, I may simply press "d". I can't guarantee a response, but I will try my best.
A big "THANK YOU!" goes to the following people for their help in creating Slirp.
Juha Pirkola, Gregory M. Christy, The Regents of the University of California, Carnegie Mellon University, The Australian National University, and RSA Data Security, Inc. whose source code is used throughout Slirp. Slirp would not be without them.
Thanks to all the contributors who helped with bugs, suggestions, code, etc. Read the file ChangeLog to see exactly who helped with what.
A special thanks goes to Chris Metcalf and Juha Pirkola for their contributions (see ChangeLog). They put in extra effort and Slirp wouldn't be the same without their help. Thanks guys!
Thanks to all the people who sent very kind and encouraging e-mail, it's sincerely appreciated.
Thanks to all the admins and Head Honcho's at UCNet, the University of Canberra Computer Club ("blitzen") who gave me some real-estate on their machine (blitzen.canberra.edu.au) to work with (thanks to Tony Delroy for giving me the account originally). Hey! Why don't you check out their home page at http://blitzen.canberra.edu.au/?
Thanks to Brazil for coffee (and Sepultura! :)
Thanks to the laws of physics, the building blocks of the universe.
Slirp was written by Danny Gasparovski.
Copyright (c) 1995 Danny Gasparovski. All Rights Reserved.
Slirp is free software; "free" as in you don't have to pay for it, and you are free to do whatever you want with it. I do not accept any donations, monetary or otherwise, for Slirp. Instead, I would ask you to pass this potential donation to your favorite charity. In fact, I encourage *everyone* who finds Slirp useful to make a small donation to their favorite charity (for example, GreenPeace). This is not a requirement, but a suggestion from someone who highly values the service they provide.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DANNY GASPAROVSKI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This basically means you can do anything you want with the software, except 1) call it your own, and 2) claim warranty on it. There is no warranty for this software. None. Nada. If you lose a million dollars while using Slirp, that's your loss not mine. So, ***USE AT YOUR OWN RISK!***.
If these conditions cannot be met due to legal restrictions (E.g. where it is against the law to give out Software without warranty), you must cease using the software and delete all copies you have.
Slirp uses code that is copyrighted by the following people/organizations:
Juha Pirkola.
Gregory M. Christy.
The Regents of the University of California.
Carnegie Mellon University.
The Australian National University.
RSA Data Security, Inc.
Please read the top of each source file for the details on the various copyrights.
Slirp was written by Danny Gasparovski.
Manpage by George Ferguson, ferguson@cs.rochester.edu, based on Slirp 1.0b documentation.
8 Jan 2006 | Version 1.0.17 |