ping some_other_machinehow does IP know whether to select the Ethernet line or the X.25 line? This chapter looks at the internals of how IP determines routes and how you can pick IP addresses to simplify this.
This chapter is intended to be a companion to Network Design which describes a sample internet. It demonstrates a network design using the rules outlined in that chapter.
Generally, each physically separate connection is a separate IP network. Therefore, if you have Ethernet attached to your system, that is one network. If you have an X.25 network connection, that is a different IP network.
The other key part to note about the definition of an IP network is that each network (each physical connection) must have a different network portion in its address. For example, the sample intranet had addresses:
Networks 192.44.44.0 and 192.25.25.0 are therefore local IP networks from Scrooge's perspective.
Now back to the original problem -- with specific numbers. Suppose data is to be sent to 192.25.25.3. Which interface will IP use? It will use X.25, not Ethernet. This is because the network portion of the address of the destination machine (192.25.25) matches the network portion of the local X.25 IP interface.
It should now be clear why each interface must have a different network portion in its address. If one uses 192.25.25.xxx for both X.25 and Ethernet and wanted to deliver data to 192.25.25.3, IP would not know whether to use Ethernet or X.25.
So how do you set up routes to foreign hosts? The first answer is try to avoid the issue if you can. When you have complete control over the selection of IP addresses, the easiest (and therefore generally preferable) method of handling IP routing is to assign everyone on one physical connection with the same network portion. For example, all the hosts on Ethernet (including the local interface) may be 192.44.44.xxx and all the hosts that can be reached via X.25 (including the local "xinet" interface) may have an IP address of 192.25.25.xxx. IP will then implicitly know how to reach the remote hosts (as described above).
But what if the network portion of the address of someone you want to reach is not on the same network as any of the local interfaces? This question breaks down into two situations:
Figure 6: Using a gateway to access a remote LAN
If a user on Scrooge attempts to access Louie (192.33.33.3), IP will not automatically know how to reach that host.
By now, the experienced IP administrator will be thinking of the IP command
route add ...There is however one very common pitfall that you must watch out for. The first thing you might want to do in the above example is:
route add 192.33.33.3 192.25.25.1 1where the final "1" in each case is the metric or the number of "hops" to the remote host. Do not do this. You should never route data via your own workstation's IP address. Think of this from IP's perspective. You are telling it to send the data to 192.25.25.1 first. IP looks at this and responds "OK, I'm already there. 192.25.25.1 is me." Therefore, the data is not sent to any interface. The remote machine does not receive the data.
What you need to do is route the call to some remote host. The network portion of the IP address should match the appropriate local interface, but the host portion must be different. You can use:
route add 192.33.33.3 192.25.25.3 1
Figure 7: Using X.25 to access a remote network
Here we want to consider accessing Dewey (192.66.66.1) from Scrooge. Since the network portion of Dewey's IP address does not match any of the interfaces in Scrooge, IP will not automatically know how to reach it.
Again, do not tell the IP software in Scrooge to route via 192.25.25.1 or the data will not actually leave Scrooge.
There are two solutions to this problem: create an additional IP address for your own machine or for the remote machine.
An Additional Local IP Address
The devices used by NetcomRouter (xinetN) are logical devices
and not directly associated with physical connections. For this example, we
can therefore have two devices on Scrooge even if there is only one data
network connection.
Suppose we assign xinet0 and xinet1 with addresses 192.25.25.1 and 192.66.66.1 respectively. Using the file x25hosts, both interfaces can be used to communicate with remote hosts via the same X.25 wire. Now Scrooge has an interface on network 192.66.66 and IP will automatically know which interface to use to get to Dewey (192.66.66.1).
Since there is a limit of 8 xinet devices, additional local IP addresses are most useful when the number of IP networks you need to communicate with is small.
An Aliased Remote IP Address
As an alternative to the additional local IP address solution, create an alias
for Dewey's X.25 IP interface: 192.25.25.100. Then tell IP to route to this
address:
route add 192.66.66.1 192.25.25.100 1
Now IP will try to send the data to 192.25.25.100, the alias for the remote host. Also, since the local IP address for the xinet interface is 192.25.25.1, IP will send the data to NetcomRouter -- exactly what you want.
There is just one thing more that you need to do. NetcomRouter will be told
to send the data to 192.25.25.100 (the alias). If you set up
/etc/x25hosts for this IP address, NetcomRouter can deliver it. Just
change the entry in the file to the alias address. That is, from:
192.66.66.1 89035555 link00 IP
to:
192.25.25.100 89035555 link00 IP
That's all. Note that what you have effectively done is created an alias name for routing purposes only. You do not have to change the IP address for the remote (for example, in /etc/hosts). For all other purposes, you can refer to the remote by its real name or address.
Creating aliases for remote hosts is best used when the number of different IP networks in your system is large.
Copyright © 1997-2002 The Software Group Limited.
All Rights Reserved.
® Netcom is a registered trademark of The Software Group Limited.