Network Routing Basics

We've seen how TCP/IP addresses combined with netmasks determine networks. For example, 192.168.200.83 and 192.168.201.35 are on separate networks if the netmask is 255.255.255.0 (a class C netmask).

If this concept isn't completely clear to you, go back and review.

My Unix and Linux Troubleshooting E-Book will show you how to
solve tough system problems!

See Networks 101 and Advanced TCP and CIDR

So, let's say that 192.168.200.83 is our server, and 192.168.201.35 is a Windows 95 machine. Again, it's a class C netmask (255.255.255.0), so there is going to have to be a router in the network. That router is going to have to have one port on the 192.168.200 network, and one on the 192.168.201 network.

How that happens depends on the router, but usually these things get configured initially by connecting to a serial port, and typing commands to set addresses and protocols on the other network ports. For the purposes of this article, we'll assume that the router has one port addressed at 192.168.200.1 and another at 192.168.201.1 (it's very common for routers to use the "1" address).

Starting at the Win95 machine, it needs to have a route so that it can get off its network (192.168.201) to the server's network (192.168.200). You'd do this in Settings->Control Panel ->Networks. Under the Properties for TCP/IP, you'd find a tab for Gateway. Here you'd enter the address of the router port on your network. That's 192.168.201.1 because the Win95 machine is on the 192.168.201 network.

If you dropped out to DOS and typed "ping 192.168.200.83" (that's the server address) before setting that gateway, you'd get "Destination host unreachable" (from a Unix machine you would get "No route to host"). After making this setting (and rebooting the 95 machine, you'll get "Request timed out" instead.

The problem is that the Win95 machine knows how to get to the server through the router, but the server doesn't know how to get back. The server needs a route to get to the 192.168.200 network.






So we need to do it there, also. If the server were a SCO Unix machine, we might type "route add 192.168.201.0 192.168.200.1" (on older SCO you'd do "route add 192.168.201.0 192.168.200.1 0".

Note that we are saying our route goes to 192.168.201.0, not to a specific address: the .0 says we're giving a route to the whole network. If this were a class A network (255.0.0.0 netmask) we'd use route add 10.0.0.0, etc.

NT is similar to Win95, though in both cases you can also issue "route add" commands at the command prompt. With NT and (I think) 95, doing this adds the routing information to the registry, so it sticks through a reboot. On SCO, that's not the case. You'll need to add the commands to a start-up file (/etc/rc2.d/S99route, for example: it doesn't exist, but you can create it) or modify the /etc/gateways file (see 'man routed'for the syntax of that file). The disadvantage of /etc/gateways is that it is used by routed, so if you are not running routed, that won't work.

You could also modify /etc/tcp and add your routes after it sets up its default routes. That has the disadvantage of modifying a system file: an upgrade will overwrite that.

SCO 5.0.4 adds a /etc/rc2.d/S90iproute script that reads /usr/internet/etc/sco_ip/routes. It's the Internet Manager that can add info to that file, but there's no reason you can't do it manually. The format is simple:



# comments are ok
# simple form
net default 10.1.1.3
# it's smart enough to delete the previous default
net default 192.168.1.2 
# routes to specific hosts
host 192.168.1.8 10.1.1.7
# netmasks optional
net 192.168.1.0 10.1.1.3 255.255.255.0
# if field 1 isn't host or net, it's ignored
happiness 172.16.80.10 10.1.1.1
sanjose 172.16.80.10 10.1.1.1


Another advantage of this script is that when called with "stop" (/etc/rc2.d/S90iproute stop), it will delete the routes listed in the file.

Beginning with 5.0.6, you can add the default route in /etc/default/tcp. Just modify the GATEWAY= line, and /etc/tcp will read that. DON'T DO THIS ON PRIOR RELEASES; /etc/tcp doesn't look for that until 5.0.6

See also :

Networking 101

cartoon
Need eyes on the ground at your customer's site?
Installation and light training Boston and New England
Reliable and experienced, punctual and professional.

Advanced TCP

CIDR

Publish your articles, comments, book reviews or opinions here!










-
Google Friend Connect users can
comment on this page here


Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner



Views for this page
Today This Week This Month This Year  Overall
122189 1,103

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

pavatar.jpg
More:




Unix/Linux Consultants


http://www.schewanick.com SCO Unix, Solaris, Linx (various), PHP, MySQL, Apache, uniBasic, dL4, Perl, System Administration and more....


UBB Computer Services Support for Openserver, Unixware and Linux. Windows integration with Unix/Linux servers. Hardware, Backup and Networking issues. Located near Sacramento CA, we provide onsite support throughout Northern CA and Nationwide via remote access. We are a SCO Authorized Partner and a Microlite BackupEdge Certified Reseller.


http://thatitguy.com Business networking servers, Linux and Unix experts. In business since 1997! Windows and Exchange to Samba and Scalix migration experts.



Twitter
  • Dec 3 14:01
    Just went out and added more bungee reinforcement. That ought to hold it..
  • Dec 3 13:58
    I'm second guessing myself on how I bungeed the cover on my golf cart for winter storage. Wondering if high wind could rip it off..









Change Congress