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
If this concept isn't completely clear to you, go back and
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 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"
Starting at the Win 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 Win 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
machine, you'll get "Request timed out" instead.
See Why "no route to host" when it can be pinged? also.
The problem is that the Win 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
So we need to do it there, also. If the server were a SCO Unix
machine, we might type "route add default 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.
Linux is similar, but you need "gw" in there: "route add default gw 192.168.200.1"
NT is similar to Win, though in both cases you can also issue
"route add" commands at the command prompt. With NT and (I think)
, 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
So how does the OS know where to send a packet when you have
more than one card in your machine such as when you have DS
internet access and an internal network? You may not have realized
this, but that's routing.
The OS "knows" by the addresseses and netmask you have put on
Lets say you have two cards: your internal network card which is
192.168.2.10 with a mask of 255.255.255.0, and your external card
which gets a DHCP address that's real, but let's pretend that right
this minute it's 64.xyz,xyz.12 again with a 255.255.255.0 mask.
If you "ping 192.168.2.27" (some other machine on your internal
network, the only place that packet will be sent to is your
If you ping something on the network of the other card, that's
where those packets will go.
So what if you ping something else like "132.xyz.xyz.89" ?
That's where your default route comes into play. It might, for
example, be 64.xyz,xyz.1. It *has* to be something on one of the
networks defined by your cards. It could not be "144.xyz.xyz.1" for
instance because you have no such network. So, if it were
64.xyz.xyz.1, the packets would go out your 64. interface and find
their way to that router, which presumably can get them to the 132
address, either directly or by sending them along somewhere
You can see this stuff in action by using "traceroute"
Here's a traceroute from my machine to world.std.com
1 18.104.22.168 (22.214.171.124) 12.640 ms 23.976 ms 12.765 ms
2 126.96.36.199 (188.8.131.52) 12.103 ms 13.057 ms 12.767 ms
3 184.108.40.206 (220.127.116.11) 12.732 ms 12.472 ms 12.177 ms
4 SRP2-0-NDHMMA1-RTR01.necore.mediaone.net (18.104.22.168) 13.177 ms 22.586 ms 11.567 ms
5 22.214.171.124 (126.96.36.199) 16.168 ms 14.617 ms 16.164 ms
6 gbr1-p60.cb1ma.ip.att.net (188.8.131.52) 15.968 ms 21.932 ms 19.366 ms
7 gbr3-p70.cb1ma.ip.att.net (184.108.40.206) 14.354 ms 16.152 ms 20.548 ms
8 gbr4-p10.n54ny.ip.att.net (220.127.116.11) 40.957 ms 25.775 ms 19.749 ms
9 ggr1-p370.n54ny.ip.att.net (18.104.22.168) 22.161 ms 20.915 ms 18.146 ms
10 att-gw.ny.uu.net (22.214.171.124) 49.996 ms 21.813 ms 20.946 ms
11 0.so-5-2-0.XL1.NYC8.ALTER.NET (126.96.36.199) 20.369 ms 21.435 ms 19.783 ms
12 0.so-3-0-0.XR1.NYC8.ALTER.NET (188.8.131.52) 20.199 ms 20.250 ms 20.146 ms
13 283.ATM7-0.XR1.BOS1.ALTER.NET (184.108.40.206) 30.349 ms 30.457 ms 29.981 ms
14 191.ATM7-0.GW3.BOS1.ALTER.NET (220.127.116.11) 35.961 ms 26.439 ms 40.353 ms
15 Boston-STD.std.com (18.104.22.168) 43.999 ms 61.854 ms 50.184 ms
16 world.std.com (22.214.171.124) 63.528 ms 81.948 ms 84.958 ms
No route to host
It's important to understand that this message doesn't necessarily come from the system that tried to get somewhere. It comes from the machine doesn't know how to get to the next stop. If your own routing table is incorrect, then it's you. If you can get to at least the next hop (as seen in a traceroute), then the "no route" message comes from them, not you. That could mean you have the wrong gateway route, but it could also mean that they do. See Telnet: route to host for a detailed explanation.
See also :
Got something to add? Send me email.
Increase ad revenue 50-250% with Ezoic
More Articles by Tony Lawrence
Find me on Google+
© 2013-08-17 Tony Lawrence