Title |
How to setup a SLIP connection |
Ref. No. |
QNX.000009315 |
Category(ies) |
Utilities, Network, Configuration |
Issue |
We use an Internet connection at work to download all sorts of useful source code. Right now, we can copy these files to our home system by dialing up work and using qcp. However, we'd rather "ftp" files directly from the Internet to my home machine. We're sure we could do this by establishing a SLIP connection between home and work. Any tips on getting started?
Here's the layout of our system:
Here are the relevant portions of our host database:
x09# Host Databasex09-- /etc/hosts x09127.1x09localhost localhost.my.domain
x09192.168.200.1x09node1 x09... x09192.168.200.202x09sliphome x09192.168.200.202x09slipwork
And here's the netstart script we invoke as the superuser on our home machine to start Socket, configure the Ethernet, SLIP, and loopback interfaces, and invoke the inetd daemon:
x09#!/bin/sh x09export SOCK=$NODE x09x09slay -f Socket;Socket -s 1 node$SOCK & x09x09/etc/ifconfig lo0 localhost up x09x09/etc/inetd &
|
Solution |
Once a connection has been established between the home and office using qtalk, you can begin to configure the SLIP connection. However, after you've established the SLIP connection and you begin to run TCP/IP utilities, only one process can have the port open (e.g./dev/serq) at a time. Since qtalk normally has the port open, you must exit qtalk without dropping the line. There are two methods for doing this.
First method
x09By default, /dev/ser1 has hupcl (hang up on last close) set on the serial port. With the first method, you set -hupcl on the port before invoking qtalk.
1x09Set -hupcl on the port: x09x09stty -hupcl </dev/ser1
2x09Dial up, connect to the remote end, then log in: x09x09qtalk -m /dev/ser1 x09x09... x09x09login: bruce
3x09Enter the following command to configure the remote side:
x09x09[//1/dev/ser2] /home/bruce >exec /etc/sliplogin slip x09x09starting slip login for slip
4x09Press <Ctrl>-<A>, then type x to exit qtalk without hanging up: x09x09Qtalk [4.81] x09x09... x09x09Command(?): x
x09If tinit is running on the local side and is configured to launch modem, modem will be launched after you enter the above command. If you launch modem this way, you should use tinit's uppercase -T option (e.g. -c modem ... -T /dev/ser1). Otherwise, modem will take over the serial port.
5x09Enter the following commands to configure your local side:
x09x09slattach /dev/ser1 38400 x09x09ifconfig sIO 192.168.200.202 192.168.200.200
x09The above slattach command will set hupcl in order to hang up the modem on last close.
6x09Ping the remote side to verify the connection, then begin your session: x09x09ping 192.168.200.200 x09x09telnet 192.168.200.200 x09x09ftp 192.168.200.200
7x09After you're done, enter the following command to force a hangup-the interface will be detached automatically: x09x09stty -DTR </dev/ser1
Second method
With the second method, you leave hupcl on the port. And instead of exiting out of qtalk after the /etc/sliplogin command, you invoke a shell and configure the local side of the connection:
1x09Dial up and log in: x09x09qtalk -m /dev/serl x09x09... x09x09login: bruce 2x09Configure the remote side: x09x09[[//1dev/ser2] /home/bruce >exec /etc/sliplogin slip x09x09starting slip login for slip
3x09Type <Ctrl>-<A> to toggle to command mode, then enter the following commands to launch a shell: x09x09Qtalk [4.81] x09x09... x09x09Command(?): ! x09x09Enter Command: sh
4x09Configure your local side: x09x09slattach /dev/ser1 38400 x09x09iconfig sIO 192.168.200.202 192.168.200.200
5x09Type <Ctrl>-<D> to exit the shell. Then press <Ctrl>-<A> to return to qtalk and type x to exit qtalk.
6x09Verify your connection, then start your session:
x09ping 192.168.200.200 x09telnet 192.168.200.200 x09ftp 192.168.200.200
7x09After you're done, force a hangup: x09x09stty -DTR </dev/ser1
Actions performed by sliplogin
x09Let's take a closer look at the exec /etc/sliplogin slip command. First, sliplogin searches the /etc/slip.hosts file, shown below, for an entry matching the login name (i.e. slip).
x09# /etc/slip.hosts x09# login local-addr remote-addr maskx09opt1x09opt2 x09# x09 slip 192.168.200.200x09192.168.200.202x09255.255.255.255.0 normal x09# x09# This mapping defines the route from the remote end back to x09# the local end. x09#
x09Then, sliplogin invokes the shell script /etc/slip.login to initialize the SLIP interface with the appropriate local and remote IP address, netmask, and so on. The interface is automatically detached when the remote end hangs up or the sliplogin process dies. If the file /etc/slip.logout exists, it's also executed on hangup.
x09Here's the standard /etc/slip.login file shipped with TCP/IP for QNX:
x09#!/bin/sh x09# x09# generic login file for a slip line. sliplogin invokes this with x09# the parameters: x09#x091x092x093x094x095x096x097-n x09# sipunit ttyspeeed loginname local-addr remote-addr mask opt-args x09# x09/etc/ifconfig sl$1 $4 $5 netmark $6 x09exit 0
Not receiving packets?
x09If ping sends out ICMP packets without errors, but you don't receive any response, double-check the addresses being passed to /etc/slip.login. You may even want to hard-code the IP addresses in the /etc/slip.login file to confirm the proper route.
When debugging...
x09When debugging TCP/IP configurations, you should always draw a diagram of your network setup, indicating the different IP addresses. Then, when you establish connections, you should use the IP addresses and follow the connections through on your diagram. Once things become stable you can start substituting host names for the IP addresses.
|
|