IP Addressing


An IP (Internet Protocol) address is a unique identifier for a node or host connection on an IP network. An IP address is a 32 bit binary number usually represented as 4 decimal values, each representing 8 bits, in the range 0 to 255 (known as octets) separated by decimal points. This is known as "dotted decimal" notation.

Example: 140.179.220.200

It is sometimes useful to view the values in their binary form.

140     .179     .220     .200
10001100.10110011.11011100.11001000

Every IP address consists of two parts, one identifying the network and one identifying the node. The Class of the address and the subnet mask determine which part belongs to the network address and which part belongs to the node address.

Address Classes

There are 5 different address classes. You can determine which class any IP address is in by examining the first 4 bits of the IP address.

  • Class A addresses begin with 0xxx, or 1 to 126 decimal.
  • Class B addresses begin with 10xx, or 128 to 191 decimal.
  • Class C addresses begin with 110x, or 192 to 223 decimal.
  • Class D addresses begin with 1110, or 224 to 239 decimal.
  • Class E addresses begin with 1111, or 240 to 254 decimal.

Addresses beginning with 0111111, or 127 decimal, are reserved for loopback and for internal testing on a local machine. [You can test this: you should always be able to ping 127.0.0.1, which points to yourself] Class D addresses are reserved for multicasting. Class E addresses are reserved for future use. They should not be used for host addresses.
Now we can see how the Class determines, by default, which part of the IP address belongs to the network (N) and which part belongs to the node (n).

  • Class A -- NNNNNNNN.nnnnnnnn.nnnnnnn.nnnnnnn
  • Class B -- NNNNNNNN.NNNNNNNN.nnnnnnnn.nnnnnnnn
  • Class C -- NNNNNNNN.NNNNNNNN.NNNNNNNN.nnnnnnnn

In the example, 140.179.220.200 is a Class B address so by default the Network part of the address (also known as the Network Address) is defined by the first two octets (140.179.x.x) and the node part is defined by the last 2 octets (x.x.220.200).

In order to specify the network address for a given IP address, the node section is set to all "0"s. In our example, 140.179.0.0 specifies the network address for 140.179.220.200. When the node section is set to all "1"s, it specifies a broadcast that is sent to all hosts on the network. 140.179.255.255 specifies the example broadcast address. Note that this is true regardless of the length of the node section.

 

Subnetting


Subnetting an IP Network can be done for a variety of reasons, including organization, use of different physical media (such as Ethernet, FDDI, WAN, etc.), preservation of address space, and security. The most common reason is to control network traffic. In an Ethernet network, all nodes on a segment see all the packets transmitted by all the other nodes on that segment. Performance can be adversely affected under heavy traffic loads, due to collisions and the resulting retransmissions. A router is used to connect IP networks to minimize the amount of traffic each segment must receive.

Subnet Masking

Applying a subnet mask to an IP address allows you to identify the network and node parts of the address. Performing a bitwise logical AND operation between the IP address and the subnet mask results in the Network Address or Number.
For example, using our test IP address and the default Class B subnet mask, we get:

10001100.10110011.11110000.11001000      140.179.240.200   Class B IP Address
11111111.11111111.00000000.00000000      255.255.000.000   Default Class B Subnet Mask
--------------------------------------------------------
10001100.10110011.00000000.00000000      140.179.000.000   Network Address

Default subnet masks:

  • Class A - 255.0.0.0 - 11111111.00000000.00000000.00000000
  • Class B - 255.255.0.0 - 11111111.11111111.00000000.00000000
  • Class C - 255.255.255.0 - 11111111.11111111.11111111.00000000

 

Allowed Class A Subnet and Host IP addresses


# bits Subnet Mask # Subnets # Hosts Nets * Hosts
2 255.192.0.0 2 4194302 8388604
3 255.224.0.0 6 2097150 12582900
4 255.240.0.0 14 1048574 14680036
5 255.248.0.0 30 524286 15728580
6 255.252.0.0 62 262142 16252804
7 255.254.0.0 126 131070 16514820
8 255.255.0.0 254 65534 16645636
9 255.255.128.0 510 32766 16710660
10 255.255.192.0 1022 16382 16742404
11 255.255.224.0 2046 8190 16756740
12 255.255.240.0 4094 4094 16760836
13 255.255.248.0 8190 2046 16756740
14 255.255.252.0 16382 1022 16742404
15 255.255.254.0 32766 510 16710660
16 255.255.255.0 65534 254 16645636
17 255.255.255.128 131070 126 16514820
18 255.255.255.192 262142 62 16252804
19 255.255.255.224 524286 30 15728580
20 255.255.255.240 1048574 14 14680036
21 255.255.255.248 2097150 6 12582900
22 255.255.255.252 4194302 2 8388604

 

Allowed Class B Subnet and Host IP addresses


# bits Subnet Mask # Subnets # Hosts Nets * Hosts
2 255.255.192.0 2 16382 32764
3 255.255.224.0 6 8190 49140
4 255.255.240.0 14 4094 57316
5 255.255.248.0 30 2046 61380
6 255.255.252.0 62 1022 63364
7 255.255.254.0 126 510 64260
8 255.255.255.0 254 254 64516
9 255.255.255.128 510 126 64260
10 255.255.255.192 1022 62 63364
11 255.255.255.224 2046 30 61380
12 255.255.255.240 4094 14 57316
13 255.255.255.248 8190 6 49140
14 255.255.255.252 16382 2 32764

 

Allowed Class C Subnet and Host IP addresses


# bits Subnet Mask # Subnets # Hosts Nets * Hosts
2 255.255.255.192 2 62 124
3 255.255.255.224 6 30 180
4 255.255.255.240 14 14 196
5 255.255.255.248 30 6 180
6 255.255.255.252 62 2 124

An Example


Here is another, more detailed, example. Say you are assigned a Class C network number of 200.133.175.0 .
You want to utilize this network across multiple small groups within an organization. You can do this by subnetting that network with a subnet address.

We will break this network into 14 subnets of 14 nodes each. This will limit us to 196 nodes on the network instead of the 254 we would have without subnetting, but gives us the advantages of traffic isolation and security. To accomplish this, we need to use a subnet mask 4 bits long.
Recall that the default Class C subnet mask is

255.255.255.0 (11111111.11111111.11111111.00000000 binary)

Extending this by 4 bits yeilds a mask of

255.255.255.240 (11111111.11111111.11111111.11110000 binary)

This gives us 16 possible network numbers, 2 of which cannot be used:

Subnet bits Network Number Node Addresses Broadcast Address
0000 200.133.175.0 Reserved None
0001 200.133.175.16 .17 thru .30 200.133.175.31
0010 200.133.175.32 .33 thru .46 200.133.175.47
0011 200.133.175.48 .49 thru .62 200.133.175.63
0100 200.133.175.64 .65 thru .78 200.133.175.79
0101 200.133.175.80 .81 thru .94 200.133.175.95
0110 200.133.175.96 .97 thru .110 200.133.175.111
0111 200.133.175.112 .113 thru .126 200.133.175.127
1000 200.133.175.128 .129 thru .142 200.133.175.143
1001 200.133.175.144 .145 thru .158 200.133.175.159
1010 200.133.175.160 .161 thru .174 200.133.175.175
1011 200.133.175.176 .177 thru .190 200.133.175.191
1100 200.133.175.192 .193 thru .206 200.133.175.207
1101 200.133.175.208 .209 thru .222 200.133.175.223
1110 200.133.175.224 .225 thru .238 200.133.175.239
1111 200.133.175.240 Reserved None