<!-- $Id: slipc.sgml,v 1.4 1995/10/07 04:31:59 jfieber Exp $ -->
<!-- The FreeBSD Documentation Project -->

<sect><heading>Setting up a SLIP client<label id="slipc"></heading>

<p><em>Contributed by &a.asami;<newline>8 Aug 1995.</em>

The following is one way to set up a FreeBSD machine for SLIP on a
static host network.  For dynamic hostname assignments (i.e., your
address changes each time you dial up), you probably need to do
something much fancier.

<!--
This is just "what I did, and it worked for me".  I'm sharing this
just for your reference, I'm no expert in SLIP nor networking so your
mileage may vary.
-->

First, determine which serial port your modem is connected to.  I have
a symbolic link <tt>/dev/modem -&gt; cuaa1</tt>, and only use the modem name in my
configuration files.  It can become quite cumbersome when you need to
fix a bunch of files in <tt>/etc</tt> and <tt>.kermrc</tt>'s all over the system!  (Note
that <tt>/dev/cuaa0</tt> is COM1, <tt>cuaa1</tt> is COM2, etc.)

Make sure you have
<verb>
pseudo-device   sl      1
</verb>
in your kernel's config file.  It is included in the GENERIC kernel,
so this won't be a problem unless you deleted it.

<sect1><heading>Things you have to do only once</heading>

<p><enum>
<item>Add your home machine, the gateway and nameservers to your
    <tt>/etc/hosts</tt> file.  Mine looks like this:
<verb>
127.0.0.1               localhost loghost
136.152.64.181          silvia.HIP.Berkeley.EDU silvia.HIP silvia

136.152.64.1            inr-3.Berkeley.EDU inr-3 slip-gateway
128.32.136.9            ns1.Berkeley.edu ns1
128.32.136.12           ns2.Berkeley.edu ns2
</verb>
    By the way, silvia is the name of the car that I had when I was
    back in Japan (it's called 2?0SX here in U.S.).

<item>Make sure you have "hosts" before "bind" in your <tt>/etc/host.conf</tt>.
    Otherwise, funny things may happen.

<item>Edit the file <tt>/etc/sysconfig</tt>.
<enum>
<item>Set your hostname by editing the line that says:
<verb>
hostname=myname.my.domain
</verb>
    You should give it your full Internet hostname.

<item>Add sl0 to the list of network interfaces by changing the line
that says:
<verb>
network_interfaces="lo0"
</verb>
to:
<verb>
network_interfaces="lo0 sl0"
</verb>

<item>Set the startup flags of sl0 by adding a line:
<verb>
ifconfig_sl0="inet ${hostname} slip-gateway netmask 0xffffff00 up"            
</verb>

<item>Designate the default router by changing the line:
<verb>
defaultrouter=NO
</verb>
to:
<verb>
defaultrouter=slip-gateway
</verb>
</enum>

<item>Make a file <tt>/etc/resolv.conf</tt> which contains:
<verb>
domain HIP.Berkeley.EDU
nameserver 128.32.136.9
nameserver 128.32.136.12
</verb>
    As you can see, these set up the nameserver hosts.  Of course, the
    actual domain names and addresses depend on your environment.

<item>Set the password for root and toor (and any other accounts that
    doesn't have a password).  Use passwd, don't edit the <tt>/etc/passwd</tt>
    or <tt>/etc/master.passwd</tt> files!

<item>Reboot your machine and make sure it comes up with the correct
    hostname.
</enum>

<sect1><heading>Making a SLIP connection</heading>

<p><enum>
<item>Dial up, type "slip" at the prompt, enter your machine name and
    password.  The things you need to enter depends on your
    environment.  I use kermit, with a script like this:
<verb>
# kermit setup
set modem hayes
set line /dev/modem
set speed 115200
set parity none
set flow rts/cts
set terminal bytesize 8
set file type binary
# The next macro will dial up and login
define slip dial 643-9600, input 10 =>, if failure stop, -
output slip\x0d, input 10 Username:, if failure stop, -
output silvia\x0d, input 10 Password:, if failure stop, -
output ***\x0d, echo \x0aCONNECTED\x0a
</verb>
    (of course, you have to change the hostname and password to fit
    yours).  Then you can just type "slip" from the kermit prompt to
    get connected.

    <bf>Note</bf>: leaving your password in plain text anywhere in the
    filesystem is generally a BAD idea.  Do it at your own risk.  I'm
    just too lazy.

<item>Leave the kermit there (you can suspend it by "z") and as root,
    type
<verb>
slattach -h -c -s 115200 /dev/modem
</verb>
    if you are able to "ping" hosts on the other side of the router,
    you are connected! If it doesn't work, you might want to try "-a"
    instead of "-c" as an argument to slattach.
</enum>

<sect1><heading>How to shutdown the connection</heading>

    <p>Type "kill -INT `cat /var/run/slattach.modem.pid`" (as root) to
    kill slattach.  Then go back to kermit ("fg" if you suspended it)
    and exit from it ("q").

    The slattach man page says you have to use "ifconfig sl0 down" to
    mark the interface down, but this doesn't seem to make any
    difference for me.  ("ifconfig sl0" reports the same thing.)

    Some times, your modem might refuse to drop the carrier (mine
    often does).  In that case, simply start kermit and quit it again.
    It usually goes out on the second try.

<sect1><heading>Troubleshooting</heading>

<p>If it doesn't work, feel free to ask me.  The things that people
tripped over so far:
<itemize>
<item>Not using "-c" or "-a" in slattach (I have no idea why this can be
  fatal, but adding this flag solved the problem for at least one
  person)

<item>Using "s10" instead of "sl0" (might be hard to see the difference on
  some fonts.

<item>Try "ifconfig sl0" to see your interface status.  I get:
<verb>
silvia# ifconfig sl0
sl0: flags=10<POINTOPOINT>
        inet 136.152.64.181 --> 136.152.64.1 netmask ffffff00
</verb>

<item>Also, <tt>netstat -r</tt> will give the routing table, in case you get
the "no route to host" messages from ping.  Mine looks like:
<verb>
silvia# netstat -r
Routing tables
Destination      Gateway            Flags     Refs     Use  IfaceMTU    Rtt   
Netmasks:
(root node)
(root node)

Route Tree for Protocol Family inet:
(root node) =>
default          inr-3.Berkeley.EDU UG          8   224515  sl0 -      -     
localhost.Berkel localhost.Berkeley UH          5    42127  lo0 -       0.438
inr-3.Berkeley.E silvia.HIP.Berkele UH          1        0  sl0 -      -     
silvia.HIP.Berke localhost.Berkeley UGH        34 47641234  lo0 -       0.438
(root node)
</verb>
(this is after transferring a bunch of files, your numbers should be
smaller).
</itemize>
