|
The Slip Link: JNOS and Linux
Setting up the slip line can be a bit tricky at
first, but it is not difficult to do. Before you start up JNOS,
you need to have a
slip interface sl0
in place on the Linux side, ready for JNOS to "grab."
|
||||||||||||
|
NOTE : Compare the parameters below with those found in the autoexec.nos file. They all must be in agreement and match up! JNOS Autoexec Slip Parameters Of particular importance are the window, 576; speed, 38400; and ptype! You may choose different parameters, but they must match between JNOS and Linux config commands. |
Setting up the Linux Side
Login as root, and enter the following commands...
# Open the Linux side first... ( ***BEFORE*** starting JNOS )
# Open the master side of the pseudo-terminal on device sl0
/usr/sbin/slattach /dev/ptype 38400 &
This assumes that you have SLIP built into the kernel or loaded as a module, slip.o; see below if not...
# Now Config the device sl0... a dedicated p-to-p line on the network
# 44.56.26.11 is my JNOS IP address, .14 is my Linux host, or "bridging," machine
/sbin/ifconfig sl0 broadcast 255.255.255.255 pointopoint 44.56.26.11 mtu 576 44.56.26.14
Here is the result in my config table:
Notice that ifconfig changed the Mask value ...
----- sl0 Link encap:Serial Line IP inet addr:44.56.26.14 P-t-P:44.56.26.11 Mask:255.0.0.0 UP BROADCAST POINTOPOINT RUNNING MTU:576 Metric:1 RX packets:690 errors:0 dropped:0 overruns:0 TX packets:701 errors:0 dropped:0 overruns:0
# Add some basic service routes... where localnet would be 44.56.26.0
# as defined in your networks file...
/sbin/route add -host 44.56.26.11 sl0
/sbin/route add -net localnet netmask 255.255.255.0 gw 44.56.26.11 dev sl0
/sbin/route add default gw 44.56.26.11 dev sl0Here is a very "bare bones" version of my routing table on the host machine, 44.56.26.14. In your table, there would probably be many more routes. For simplicity, this only displays the sl0 entries that were configured using the above statements...
Host Machine 44.56.26.14 Routing Table ----- Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 44.56.26.11 0.0.0.0 255.255.255.255 UH 0 0 1 sl0 44.56.26.0 44.56.26.11 255.255.255.0 UG 0 0 0 sl0 0.0.0.0 44.56.26.11 0.0.0.0 UG 0 0 1 sl0
You may use any number of tests to verify these commands. Use the route command to have the table displayed. Use the ifconfig sl0 command to see the configs for the sl0 device. The best test is to start up JNOS and do a telnet from Linux to the JNOS host: telnet ka1fsb-3 is what I use.
If you are having trouble setting up this slip interface, here are a few checkpoints to watch for. You must have slip capability compiled into your kernel, or else you have to load it as a module. Nothing will work unless you have the basics in place. If you do "dmesg | more" or "dmesg | grep -i SLIP", and you see a line like this:"SLIP: version 0.8.4-NET3.019-NEWTTY" ...or similiar, then you know you have the driver in the kernel. If you don't, then you could re-compile the kernel being sure to include the slip protocol option.
Or, you could add it as a module. To see the loaded modules, do "lsmod" and a list will be displayed. If it is there, then you are OK. If not, you may add a slip.o object file with the insmod command. The command looks like this:where the some_linux_version might be 2.0.36 for example. You may have to discover the path to the slip.o file and verify that you actually do have this object. Now an "lsmod" will show that the slip driver is loaded and ready to create a network interface. Below is my lsmod dump on bambi.ampr.org. Slip is there along with several other network "drivers."
- insmod /lib/modules/some_linux_version/net/slip.o
Module: #pages: Used by: iBCS 24 0 dummy 1 1 ne 2 1 8390 2 [ne] 0 ppp 5 0 slip 2 1 slhc 2 [ppp slip] 1As further confirmation that you really have an active "attachable" sl0 device, issue this command, "cat /proc/net/dev". A listing of all your devices will be shown along with the packet activity for each one. (If you have compiled the slip driver into the kernel, or loaded it as a module, you will see the sl0 device in the list if all went well. You cannot issue an "attach", as in slattach, until sl0 is established as a network interface device.)----- Inter-| Receive | Transmit face |packets errs drop fifo frame|packets errs drop fifo colls carrier lo: 18 0 0 0 0 18 0 0 0 0 0 nr0: 0 0 0 0 0 0 0 0 0 0 0 nr1: 0 0 0 0 0 0 0 0 0 0 0 nr2: 0 0 0 0 0 0 0 0 0 0 0 nr3: 0 0 0 0 0 0 0 0 0 0 0 eth0: 272 0 0 0 0 209 0 0 0 0 0 dummy0: No statistics available. sl0: 52 0 0 0 0 52 0 0 0 0 0 bpq0: 0 0 0 0 0 0 0 0 0 0 0 bc0: 0 0 0 0 0 1 0 0 0 0 0 bc1: 0 0 0 0 0 0 0 0 0 0 0 bc2: 0 0 0 0 0 0 0 0 0 0 0 bc3: 0 0 0 0 0 0 0 0 0 0 0
COMMENTARY : A quick observation about sl0 and SLIP. SLIP was probably never intended to be used in the manner described above, as an internal link into an application. Its original purpose was to be used over phone lines, such as a local dialup connection. Therefore, sometimes compression is assumed since that would give you the optimum data transfer rates. JNOS can do compression if you have flagged the Van Jacobson drivers in the config.h file, and set certain flags on the attach line. But, normally it doesn't.
So, if you are getting checksum errors and can't make the link, then one side of the "pipe" is doing compression when it shouldn't be. Thanks to Bob, WA2MNO for addressing this issue! So, make sure that neither side is doing compression or that both sides are doing it. (I have found that compression is nearly useless in this situation anyway... but experiment if you like, and tell me about it. I found no gain in performance.)
As a preliminary to setting up a slip line, you might want to verify that you really do have the Serial Line Internet Protocol compiled into your JNOS application. The simplest way to do this is to login to JNOS as the sysop and issue the following command from the server console:
This will produce a listing of all the major features that you have in your version and "compile" of the source code. Below is a sample excerpt listing from my JNOS. Notice the inclusion of the SLIP capability:
- info
----- . . . Generic termios interface driver Async interface drivers: KISS-TNC POLLED-KISS AX.25 NET/ROM-TNC NET/ROM network interface Async IP drivers: Serial Line (SLIP) Hardware interface packet tracing (minimal monitor-style trace available) Parallel printer Linked with (n)curses version 1.9.9e AX.25 UI packet tx/rx 1092 Jnos>If you see this line in your "info" dump, then you have SLIP up and available in your JNOS application. If you don't, then you will have to re-compile JNOS with the SLIP drivers included and defined. Please see JNOS Index page. (There is no modular counterpart which could be added on-the-fly as there is in Linux.)
Once you see the slip driver listed, your next step should be to edit your autoexec.nos file to configure its sl0 interface. As mentioned above, set up your JNOS sl0 device along the lines shown in my sample exec file: JNOS Autoexec Slip Parameters. Then move on to the routing configs using the sl0 device as detailed below... (Remember, you need at least one route between the host machine and the JNOS application just to login.)
While you are first attempting the sl0 link into JNOS, my recommendation is to keep it as simple as possible, and then add more IP routes if you are going to do TCP/IP over the air. If you are not running TCP/IP on the air, then you will only need a very simple IP routing table, just enough to "talk" to the host or "bridge" machine. Here is a "bare bones" routing table on my JNOS "machine" at 44.56.26.11. My local network is 44.56.26.0 and the .10 is a machine on that net.
JNOS Application 44.56.26.11 Routing Table ----- Destination Len Interface Gateway Metric P Timer Use 44.56.26.10 32 sl0 1 man 1413 44.56.26.0 24 sl0 1 man 0 44.0.0.0 8 sl0 1 man 0
This is all you really need to link up to any incoming local or LAN telnet session! (You may add more machines to this list if you want to, and a DNS IP from your ISP, if you are on-line enough to warrant.) Remember, I am using my amateur IP address as a network address. If you have a 192 or 10 address, known reserved internal addresses, then you would need to substitute accordingly.
NOTE : Just because you have setup a slip and included a DNS IP in your routing table, this by itself will not necessarily turn your JNOS application into an internet gateway. The machine that contacts your ISP via the ppp0 device has been temporarily bound to the IP address assigned by that ISP. Your local host machine now behaves as though it had a "new" IP address, probably nothing like the one you assigned it at boot time. For example, your machine might have an IP of 192.68.1.100, or your Amprnet 44 address, but on dial-up or connect, it now "looks" something like this, 12.226.70.241, or whatever was chosen and assigned to you by your ISP.
If your JNOS application has a different IP than the ISP's, which it certainly will, no doubt being your Amprnet 44 address, there is no way that a routing table can legally create the "illusion" that JNOS is bound to that ISP address, or can use it from inside the JNOS application.
The commands, as stated in the JNOS autoexec.nos file, to set up these routes are quite straightforward, and the list can be easily added to.
A cautionary note at this point. Most of the letters and appeals for help that I have received so far indicate that few sysops and admins have any trouble with the basic set up concerning all the above information. What seems to give operators a hard time is the necessary routing on both sides of the application, the JNOS routing table and the Linux host routing table! Don't forget the IP in SLIP, which means, don't forget that this is an IP (protocol). All IP's are directed by routing tables. So take your time and consider what it is you are trying to do. If there is a route "out," there must be a route "back," as in "what goes up, must come down." Begin slowly, and with routes that you are sure will work. Then add more "complex" routes, such as integrating into a Lan, and test each one as you go: ping, ping, ping. Routing is a vast subject and you may want to divert your practical goals momentarily to research how this routing business really works... Here is a reference to the JNOS manual about routing.
MORE CAUTIONS: Occasionally, you may see the sl0 network device fail on the JNOS host machine after a time out as recorded in the /var/adm/syslog file. The message "transmit timed out, bad line quality?" will sometimes appear from time to time, causing the link between the JNOS application and the network to shut down. While this fault may be difficult to diagnose, slowing the device speed may help in resolving the problem. For example, if you were running at 38400, try dropping down to 19200. Recall, you need to do this on the host and in the JNOS command line that sets up the application side of the link for the device sl0 in the autoexec.nos file.
Also, there are at least two versions of slattach, each with their own differing command line syntaxes. The smaller one is about 4k in size and the other, which is newer, is about 18k. The newer version is probably less prone to dropping the link due to time outs. (As you know, the program slattach converts a tty line like /dev/ptype into a network compatible device such as sl0. And the newer version of JNOS 2.0 now uses a tunnel device, tun0, instead of sl0 and is touted to be a significiant improvement in reliability.)
When you execute the slattach command above, what is really happening? First, a configurable network device, sl0, is being created. Later, this will become the hook for tying into the network. A "pipe" is also being set up, the master side first, ptype. When JNOS starts up, it completes the other side of the pipe by using ttype. It executes a similar attach to this network device, just as the Linux OS did using the slattach command. But, there's more. By using the /dev/ptype device, the system knows to use a line discipline that could enable a login session. Remember, not all connects over a network result in a login! And you want to login to JNOS as a user! Hence, the pseudo-terminal device...
On a more practical note, you may use any pty device found in the directory /dev. I just happened to choose ptype and ttype. But, there are usually up to 10 or more available!
If you would like to learn more about pseudo-terminal devices, an execellent hard-bound reference book is "Advanced Programming in the UNIX Environment" by W. Richard Stevens. (I looked at chapter 19 again before writing this brief article...)
Below is a sample script file that I use to set up my slips. Sometimes I am on another host, so that is why there are case statements in the script. It is optional. This file might give you some ideas as to the flexibility of using scripts to configure devices... This is run from the rc.local script.
Note that machine and network names were used as values for the script variables. This assumes that you have properly specified and resolved these names to IP addresses (numbers) in the hosts and networks files. (If they are not resolved, this script will not run properly. Of course, you may use IPs directly instead.)
#! /bin/sh # do_slips # 07-04-00. 08-06-00 # 05-16-01 # KA1FSB/kbn # ----------------------------------------------------------- # Set up the slip sl0 line here for the linux/jnos link # ----------------------------------------------------------- # Inits... MYHOST="" #----- The Linux host machine IP or name BRIDGE="" #----- The JNOS host IP or name JNOSHOST="" #----- The net variable is your local net, 44.56.26.0 NET="" # The JNOS host machine MYHOST=`cat /jnos/autoexec.nos | grep host | fgrep -v grep | cut -f2 -d " " |\ tr -d " "` # Linux host name or use IP BRIDGE="bambi.ampr.org" if [ "$MYHOST" != "" ] then # Convert to lower case?... MYHOST=`echo $MYHOST | tr -s [A-Z] [a-z]` case $MYHOST in #----- Note: below is another host and is an example only ka1fsb-1*) JNOSHOST=ka1fsb-1.ampr.org NET=mitchnet ;; ka1fsb-3*) JNOSHOST=ka1fsb-3.ampr.org NET=localnet ;; *) echo "Could not parse JNOS hostname... exiting!" exit 1 ;; esac else echo "No hostname found in autoexec.nos... exiting!" exit 1 fi # This assumes this is your first sl0 device. echo "Initiating pipe connection sl0 on ptype for JNOS/Linux..." # Likes to have this done again, why? May not need to be done! if [ -e "/etc/rc.d/rc.inet1" ] then /etc/rc.d/rc.inet1 else echo "Could not locate the rc.inet1 script/file!"; fi # # Open the Linux OS end first... /usr/sbin/slattach /dev/ptype 38400 & sleep 2 # Config the device sl0... echo "Configuring routes..." /sbin/ifconfig sl0 broadcast 255.255.255.255 pointopoint $JNOSHOST \ mtu 576 $BRIDGE # Add some basic service routes... /sbin/route add -host $JNOSHOST sl0 /sbin/route add -net $NET netmask 255.255.255.0 gw $JNOSHOST dev sl0 # Add in any extra routes... # Define the device on an IP case $MYHOST in ka1fsb-3*) /sbin/route add default gw 44.56.26.11 dev sl0 ;; ka1fsb-1*) /sbin/route add default gw 44.56.10.151 dev sl0 ;; esac # End of do_slips
Mail Document Request for: do_slips
A Few Caveats:
- Be sure your local mailer is properly "hooked" into your browser.
- Allow up to 24 hours for delivery, although 3-6 is typical...
- Mailed copy, being the latest "on-line" version, may differ slightly from above.
- Click on "Mail it to me" below to activate your mailer, then send from there.
- Please don't change the subject field. (Additional text body comments OK.)
- Sometimes server is down for extended periods of time... (1-10+ days)
- (You obtain, modify and run all data/code at your own risk.)
Enough "excuses," just Mail it to me!
What if ...
- If your browser-linked mailer doesn't seem to respond, you may send a
null-bodied email to ka1fsb@att.net with a subject of"Code Request - do_slips" not including the quotes... (Some browsers and their mail agents do not like excessive string data in the mailto format.)
(Courtesy KBNorton Computer Systems)