The design of IP routing allows for very simple route definitions for small networks, while not hindering the flexibility of routing in complex environments. A key concept in IP routing is the ability to define what addresses are locally reachable as opposed to not directly known destinations. Every IP capable host knows about at least three classes of destination: itself, locally connected computers and everywhere else.
Most fully-featured IP-aware networked operating systems (all unix-like operating systems with IP stacks, modern Macintoshes, and modern Windows) include support for the loopback device and IP. This is an IP and range configured on the host machine itself which allows the machine to talk to itself. Linux systems can communicate over IP on any locally configured IP address, whether on the loopback device or not. This is the first class of destinations: locally hosted addresses.
The second class of IP addresses are addresses in the locally connected network segment. Each machine with a connection to an IP network can reach a subset of the entire IP address space on its directly connected network interface.
All other hosts or destination IPs fall into a third range. Any IP which is not on the machine itself or locally reachable (i.e. connected to the same media segment) is only reachable through an IP routing device. This routing device must have an IP address in a locally reachable IP address range.
All IP networking is a permutation of these three fundamental concepts of reachability. This list summarizes the three possible classifications for reachability of destination IP addresses from any single source machine.
The IP address is reachable on the machine itself. Under linux this is considered scope host and is used for IPs bound to any network device including loopback devices, and the network range for the loopback device. Addresses of this nature are called local IPs or locally hosted IPs.
The IP address is reachable on the directly connected link layer medium. Addresses of this type are called locally reachable or (preferred) directly reachable IPs.
The IP address is ultimately reachable through a router which is reachable on a directly connected link layer medium. This class of IP addresses is only reachable through a gateway.
As a practical description of the above, this partial diagram of the example network shows two machines connected to 192.168.99.0/24. On tristan the IP addresses 127.0.0.1 (loopback--not pictured) and 192.168.99.35 are considered locally hosted IP addresses. The directly reachable IP addresses fall inside the 192.168.99.0/24 network. Any other destination addresses are only reachable through a gateway, probably masq-gw.
Before examining the routing system in more detail, there are some terms to identify and define. These terms are general IP networking terms and should be familiar to users who have used IP on other operating systems and networking equipment.
A single number between decimal 0 and 255, hexadecimal 0x00 and 0xff. An octet is a single byte in size.
Examples: 140, 254, 255, 1, 0, 7.
A locally unique four octet logical identifier which a machine can use to communicate using the Internet Protocol. This address is determined by combining the network address and the administratively assigned host address. Simply put, the IP address is a unique number identifying a host on a network.
Examples: 192.168.99.35, 220.127.116.11, 18.104.22.168.
Examples: 192.168.1.27/24, 10.10.17.24/8, 172.20.158.75/16.
A four octet address and network mask identifying the usable range of IP addresses. Conventional and CIDR notations combine the four bare octets with the netmask or prefix length to define this address. Briefly, a network address is the first address in a range, and is reserved to identify the entire network.
Examples: 192.168.187.0/24, 22.214.171.124/26, 126.96.36.199/255.255.255.248, 10.0.0.0/255.0.0.0, 188.8.131.52/28.
A four-octet set of bits which, when AND'd with a particular IP address produces the network address. Combined with a network address or IP address, the netmask identifies the range of IP addresses which are directly reachable.
Examples: 255.255.255.0, 255.255.0.0, 255.255.192.0, 255.255.255.224, 255.0.0.0.
An alternate representation of network mask, this is a single integer between 0 and 32, identifying the number of significant bits in an IP address or network address. This is the "slash-number" component of a CIDR address.
Examples: 184.108.40.206/24, 220.127.116.11/30, 10.158.42.72/29, 10.48.7.198/9, 192.168.154.64/26.
A four octet address derived from an OR operation between the host address portion of a network address and the full broadcast special 255.255.255.255. The broadcast is the highest allowable address in a given network, and is reserved for broadcast traffic.
Examples: 192.168.205.255/24, 172.18.255.255/16, 18.104.22.168/26.
These definitions are common to IP networking in general, and are understood by all in the IP networking community. For less terse introductory material on matters of IP network addressing in general, see Section I.1.3, “General IP Networking Resources”.
As is apparent from the interdependencies amongst the above definitions, each term defines a separate part of the concept of the relationships between an IP address and its network. A good IP calculator can assist in mastering these IP fundamentals.
Example 4.2. Using ipcalc to display IP information
[user@workstation]$ ipcalc -n 22.214.171.124/26 Address: 126.96.36.199 00001100.00000111.10010101.00 000000 Netmask: 255.255.255.192 = 26 11111111.11111111.11111111.11 000000 Wildcard: 0.0.0.63 00000000.00000000.00000000.00 111111 => Network: 188.8.131.52/26 00001100.00000111.10010101.00 000000 (Class A) Broadcast: 184.108.40.206 00001100.00000111.10010101.00 111111 HostMin: 220.127.116.11 00001100.00000111.10010101.00 000001 HostMax: 18.104.22.168 00001100.00000111.10010101.00 111110 Hosts/Net: 62
A tool similar to the one shown in Example 4.2 can assist in visualizing the relationships among IP addressing concepts.
Subequently, this chapter will introduce some concrete examples of routing in a real network. The example network illustrates this network and all of the addresses involved.