CONFIGURING
SLiRP

The below configuration notes are from the SLIRP distribution docs. For more information, also read the SLiRP home page.


From: wgg@netcom.com (Bill Greathouse)

*****
First, these commands can be either entered in the command-line (telnet
10.0.2.0 by default) OR in the ~/.slirprc file.  The behave the same,
except when a default IP address is needed, the ~/.slirprc version will
default to 10.0.2.15, the command-line version will default to the IP
address you telneted to 10.0.2.0 from.

redir X [ADDRESS]
    redirect an port for use with X
    Command:
        redir X
	
    options:
        ADDRESS  our home ip address, or the address where the x server is
	         (if you have a LAN at home to connect more than one machine
                 to the net) (default 10.0.2.15 when in ~/.slirprc, the
                 source IP address when in command-line)
    
    Example:
        redir X 10.0.2.15
      
    Note:
        this will print the command needed to enter into each shell from
        where you launch your X apps
    
redir[once|time] [PROTO] PORT [to] [ADDRESS:]LPORT
    redirect host port to local port using a selected protocol.
    Command:
        redir       establish a permanent redirection.
        redironce   allow redirected TCP port to be used only once.
        redirtime   allow redirected UDP port to time out if inactive
	            for 4 minutes.
    Options:
	PROTO	tcp udp (if none specified, use tcp)
        PORT    port to use on host system
        LPORT   port to redirect host port to on local system
	ADDRESS address of your home machine (default, 10.0.2.15)
    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.

baudrate N
    controls the allocation of time to communications across 
    your serial link.  Higher values generally use more of
    the available bandwidth to your modem.  This is _only_
    an internal control value and does _not_ change the physical
    settings for the host port or modem.
    Options:
        NONE
    Example:
        baudrate 14400
                inform slirp that the effective throughput
                for the connection is 144000 baud.
    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.

[special | control | host] address ADDRESS
    set ip address aliases and others for slirp.
    Command:
        special address     set the network ip alias for slirp
        control address     only allow access to slirp control 
                            address from ADDRESS.
	host address	    tell slirp the IP address of the host it's
	                    running on.  use this only if slirp can't
			    properly find the host's IP address
    Options:
        NONE
    Example:
        special address 10.0.3.0
                Set slirp IP alias base to 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

add [pty]exec PROGRAM:[ADDRESS/]PORT
    Set program to execute on host  when local machine attempts
    to connect to ADDRESS at port PORT.
    Command:
        add ptyexec    establish telnet connection to program
                       using telnetd helper application under a
		       pseudo-terminal
        add exec       establish binary connection to program
	               in the style of inetd.
    Options:
        PROGRAM	program to exec
	ADDRESS optional address
	PORT	port
    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)
        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)

idle N
    Set idle timeout to N minutes.  when the link has been idle for N
    minutes, slirp will send a byte of data over the link.

******
The following can only appear in the config file ~/.slirprc, as changing
them on-the-fly will either lockup or crash slirp, or simply wouldn't do
anything.

[no]compress
    force startup mode for slirp to SLIP or CSLIP.  This 
    overrides the default automatic mode determination.
    Command:
        nocompress    start in SLIP mode
        compress      start in CSLIP mode
    Options:
        NONE
    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.

mtu N
    controls the size of the IP packets sent across the serial
    IP link.  Valid values are <= 1500.
    Options:
        NONE
    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.


shell PROGRAM
    set program to execute on EXEC IP default telnet port (23).
    It is the same as
        add ptyexec PROGRAM:23
    Options:
        NONE
    Note:
        by default slirp connects /bin/sh to the exec IP telnet
        port.

*****
And finally, these commands are only available with the command-line, sine
they don't make sense at load-time.


help
    show a brief (and incomplete) list of available commands
    
    
remove [pty]exec PROGRAM:[ADDRESS/]PORT
    reverse the effect of "add [pty]exec".  see "add [pty]exec" for the
    options etc.
    Note:
        you must enter the options exactly as you entered it in add [pty]exec.
    XXX incomplete
    
echo [on|off]
    turn echo on or off, depending on how your client behaves.  "echo" by
    itself will show whether echo is currently on or off.

kill N
    kill the session which has a Socket no. of N.  to find the Socket no. of a particular
    session, use the "stats tcpsock" or "stats udpsock" commands.  see
    "stats" below.
    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 slip-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.

close N
    close the session which has a Socket no. of N.  same as "kill N", but
    closes it session gracefully.  see "kill N"
    

stats [ip | tcpsock | tcp | udpsock | udp | mbuf]
    show statistics on the given argument
    Options:
        ip	show ip statistics
	tcpsock show statistics on the currently active sockets.  use this
                to find out which sessions to close/kill as it will also
		show the FD of the session
	tcp     show tcp statistics (packets sent/received/etc)
	udpsock same as tcpsock but for udp sessions
	udp     same as tcp but for udp
	mbuf    show how many mbufs were allocated, are in use, etc.
	        if the modem is idle, and there are more than 1 mbufs on
		the used list, it suggests an mbuf leak

[pty]exec PROGRAM
    this will execute PROGRAM, and the current command-line session will
    cease to exist, taken over by the PROGRAM. ie: when the program exits,
    you will not get the command-line back, the session will (should) close.


: On a slightly related note, is there a way to set up slirp to open
: a shell when you telnet to 10.0.2.3 (or some other variant) like
: tia would?

Yes, either edit the source and change the defaults (CTL_*), or use the
optional ADDRESS in the add exec and add ptyexec commands.  ie:

add ptyexec /path/to/your/shell:10.0.2.3/23


As an aside, and once again here are the default slirp IP's.
    10.0.2.0    command control telnet IP
    10.0.2.1    exec IP
    10.0.2.2    host alias
    10.0.2.15   default local system IP.

See Also:

Go to Delaware Tech Home Page

Last page update: 28 October 1995
Source Document: None
Official URL for this page: http://www.stanton.dtcc.edu/stanton/cs/slirp/conf.html
Page Maintained by: Ken Weaverling