Title |
How to communicate through TCP/IP Ethernet network using SLIP |
Ref. No. |
QNX.000009314 |
Category(ies) |
Network, Configuration |
Issue |
Using SLIP, we've connected a standalone machine to node 2 on our TCP/IP Ethernet network. Our problem is that while the standalone machine and node 2 can "ping" each other, the standalone machine can't ping any other hosts on the network.
Here's the layout of our system:
The connection between node 2 and the standalone machine is a null modem cable attached to ser1 on both machines.
Here are the relevant portions of our host database:
x09# Host Databasex09-- /etc/hosts x09127.1x09localhost localhost.my.domain
x09192.168.200.1x09node1 x09192.168.200.2x09node2
x09192.168.200.200x09sliplone x09192.168.200.202x09slip2
And here's the netstart script we invoke as the superuser 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 -d forward node$SOCK & x09x09/etc/ifconfig en1 node$SOCK up x09x09/etc/inconfig lo0 localhost up x09x09/etc/inetd &
This script works with all the Ethernet nodes, though the "-s 1 -d forward" options to Socket are required only for node2, which has both a SLIP and an Ethernet interface.
On sliplone, the standalone node, we run the following script:
x09#!/bin/sh x09x09stay -f Socket;Socket -s 1 sliplone & x09x09/etc/ifconfig lo0 localhost up x09x09/etc/inetd &
To establish the SLIP connection between node2 and sliplone, we enter the following on slip2 (192.168.200.202):
x09/etc/slattach /dev/ser1 38400 x09/etc/ifconfig sl0 192.168.200.202 192.168.200.200 up
and enter the following on sliplone (192.168.200.200):
x09/etc/slattach /dev/ser1 38400 x09/etc/ifconfig sIO 192.168.200.200 192.168.200.202 up
Any idea where we've gone wrong?
|
Solution |
To communicate with sliplone (192.168.200.200), node1 (192.168.200.1) needs to use node2 (192.168.200.2) as a gateway. Enter the following on node1:
x09route add sliplone gateway node2
Likewise, to communicate with node1 (192.168.200.1), sliplone (192.168.200.200) needs to use slip2 (192.168.200.202) as a gateway. Enter the following on sliplone:
x09route add default gateway slip2
Alternatively, you could run arp -s slip2 ether_addr on node2, and run route add default gateway node2 on sliplone. Using this approach, you wouldn't have to add a gateway on any of the remaining nodes on the Ethernet LAN to allow them to communicate with sliplone.
After adding the gateways, run netstat -rn on sliplone. You'll see a routing table similar to the following:
x09Routing tables x09Destinationx09Gatewayx09Flagsx09Refsx09Usex09Interface
x09Route Tree for Protocol Family 2: x09(root node) => x09defaultx09192.168.200.202x09UGx090x094x09sIO x09127.0.0.1x09127.0.0.1x09UHx091x09148x09lo0 x09192.168.200.202x09192.168.200.200x09UHx091x0911x09sIO x09(root node)
The UG flag for the default entry indicates that the default gateway for sliplone is slip2 (192.168.200.202) and that the route is up. So if sliplone wants to communicate with an IP address on a route it doesn't know about, sliplone will route the packet to slip2. Then slip2 will forward the packet to the appropriate host-node1, for example.
|
|