IP Addressing

IP Addressing

In today’s world of inter-connected computers, you may have a connection to hundred of thousands of other machines. Granted there is no single cable connecting all of these computers, however there is a logical connection in that you can use the telnet program from your PC in California and connect to a machine in Germany. The problem is, how do the packets get from one end to another. Added to that, how do you keep your local network in California from getting overloaded with packets that are being sent between machines in Germany and at the same time making sure that those telnet packets do get through? The answer is provided by the Internet Protocol (IP).

Just as a street address is not always sufficient to get your letter delivery, so is the host IP address not always sufficient to get the packet delivered. If I sent you a letter, it could be sent to a single, central post office, whose job it was to distribute mail throughout the entire US. Because of the incredibly large number of pieces of mail, this is impractical. Instead, there are thousands of offices, all over the country, whose job it is to route the mail for us.

If we lived in a small town, the local post office could catch a letter destined for a local address before it goes further. Mail with addresses outside could be sent to other post offices to be processed.

A similar situation applies to IP addresses. In local, self-contained networks, the IP address alone is sufficient. However, when multiple networks are combined, machines spend more time trying to figure out if the packet belongs to them than actually processing information. The solution is a network mask. Just as a zip code tells a postal worker whether to process a particular piece of mail locally or not, the network mask (or netmask) tells machines whether or not they can simply ignore a packet or need to process it further. How this works, we’ll get to in a moment.

Every machine on the network, needs to have its own, unique IP address. Just like every house has a unique mail address. If that network is connected to the rest of the world, that address must not only be unique within the local network, but unique within the rest of the world, as well. With the most common IP version (IPv4), IP addresses are 32-bit values. They are usually represented by four sets of numbers, ranging from 0-255 separated by dots (.). This is referred to as dotted-decimal notation. In dotted-decimal notation, an address might look like this:

147.132.42.18

Since each of these numbers range between 0-255, they can be represented by eight bits and are therefore referred to as an octet. This IP address is often thought of as being composed of a network portion (at the beginning) and a node (or machine) portion at the end. This would be comparable to writing a street address as:

95061.Main_Street.42

Where 95061 is the zip code and Main Street is the street and 42 is the address on that street. The reason we write the street address in this fashion, is that it’s common to think of the IP address as moving from the general to the more specific.

Currently, there are three classes of networks in common use, which are broken down by both the range used in the first octet and the number of octets used to identify the network. Class A networks are the largest and use the first octet as the network address. Networks in this class will have the first octet in the range 1-126. Class B networks used the first two octets, with the first being in the range 128-192. The smallest networks, class C use the first three octets in the network address and with the first in the range 192-223. How IP addresses are broken down by the different network classes is shown in Table 0\1.

ClassRange within 1st octetNetwork ID Host ID Possible networks Possible hosts per network
A 1-126 a b.c.d. 126 16,777,214
B 128-191 a.b c.d 16,384 65,534
C 192-223 a.b.c d 2,097,151 254
Table – IP Address Breakdown by Network

There are a couple of things I would like to point out about this table. First, the network address 127 represents the local computer, regardless of what network it is really on. This is helpful for testing as well as many internal operations. Network addresses 224 and above are reserved for special purposes such as multicast addresses. The terms “possible networks” and “possible hosts per network” are those that are calculated mathematically. In some cases, 0 and 255 are not acceptable values for either the network address or the host address. However, 0 can be used in a network address for either the second or third octet (for example, 10.2.0).

Keep in mind that a Class A address does not necessarily mean that there are 16 million hosts on a single network. This would be impossible to administrate and would over burden most network technologies. What normally happens is that a single entity with a lot of machines, such as Hewlett-Packard is given a Class A address. They will then break it down further into smaller sub-nets. We’ll get into more details about this shortly.

A network host uses the network ID and host ID to determine which packets it should receive or ignore and to determine the scope of its transmissions (only nodes with the same network ID accept each other’s IP-level broadcasts). Because the sender’s IP address is included in every outgoing IP packet, it is useful for the receiving computer system to derive the originating network ID and host ID from the IP address field. This is done by using subnet masks, as described in the following section.

In some cases, there is no need to have IP addresses that are unique world-wide, since the network will never be connected to the rest of the world. For example, in a factory where the machines communicate only with each other via TCP/IP. There is no reason for these machines to be accessible from the Internet. Therefore, there is no need for them to have an official IP address.

You could just randomly assign IP addresses to these machines and hope that your router or firewall is configured correctly not to pass along the packets from these machines. One slip and you have the potential for not only messing up your own network, but someone else’s as well.

The solution was provided in RFC-1918. Here, three sets of IP addresses were defined for use in “private” networks. These won’t be routed and there is no need to coordinate their use with any of the registrations agencies. The IP addresses are:

10.0.0.0 – 10.255.255.255
172.16.0.0 – 172.31.255.255
192.168.0.0 – 192.168.255.255

As you can see that there is just a single class A address, but 16 class B and 255 class C networks. Therefore, no matter what size your network is, you can find a private network for your needs. Note also that because these are private addresses, there is no requirement that says if you have only a class C network, for example, that you need to use addresses in the 192.168 range. I have worked in companies that have created a large number of class C networks in the 10. private address range.