15.3. Setting up a SLIP Client

Contributed by Satoshi Asami 8 Aug 1995.

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.

First, determine which serial port your modem is connected to. I have a symbolic link to /dev/modem from /dev/cuaa1, 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 /etc and .kermrc's all over the system!

Note: /dev/cuaa0 is COM1, cuaa1 is COM2, etc.

Make sure you have


    pseudo-device   sl      1

in your kernel's config file. It is included in the GENERIC kernel, so this will not be a problem unless you deleted it.

15.3.1. Things you have to do only once

  1. Add your home machine, the gateway and nameservers to your /etc/hosts file. Mine looks like this:

    
        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
    
    

    By the way, silvia is the name of the car that I had when I was back in Japan (it is called 2?0SX here in U.S.).

  2. Make sure you have hosts before bind in your /etc/host.conf. Otherwise, funny things may happen.

  3. Edit the file /etc/rc.conf. Note that you should edit the file /etc/sysconfig instead if you are running FreeBSD previous to version 2.2.2.

    1. Set your hostname by editing the line that says:

      
          hostname=myname.my.domain
      
      

      You should give it your full Internet hostname.

    2. Add sl0 to the list of network interfaces by changing the line that says:

      
          network_interfaces="lo0"
      
      

      to:

      
          network_interfaces="lo0 sl0"
      
      
    3. Set the startup flags of sl0 by adding a line:

      
          ifconfig_sl0="inet ${hostname} slip-gateway netmask 0xffffff00 up"
      
      
    4. Designate the default router by changing the line:

      
          defaultrouter=NO
      
      

      to:

      
          defaultrouter=slip-gateway
      
      
  4. Make a file /etc/resolv.conf which contains:

    
        domain HIP.Berkeley.EDU
    
        nameserver 128.32.136.9
    
        nameserver 128.32.136.12
    
    

    As you can see, these set up the nameserver hosts. Of course, the actual domain names and addresses depend on your environment.

  5. Set the password for root and toor (and any other accounts that does not have a password). Use passwd, do not edit the /etc/passwd or /etc/master.passwd files!

  6. Reboot your machine and make sure it comes up with the correct hostname.

15.3.2. Making a SLIP connection

  1. 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:

    
        # 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
    
    

    (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.

    Note: Leaving your password in plain text anywhere in the filesystem is generally a BAD idea. Do it at your own risk. I am just too lazy.

  2. Leave the kermit there (you can suspend it by z) and as root, type:

    
        # slattach -h -c -s 115200 /dev/modem
    
    

    If you are able to ping hosts on the other side of the router, you are connected! If it does not work, you might want to try -a instead of -c as an argument to slattach.

15.3.3. How to shutdown the connection

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 does not 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.

15.3.4. Troubleshooting

If it does not work, feel free to ask me. The things that people tripped over so far:



Banner.Novgorod.Ru