Gelbe Linie

IP ADDRESSING


A host is a computer or device, such as a router, on a TCP/IP network. Every TCP/IP host is uniquely identified by its IP address. An IP address consists of a network ID and a host ID.

If two different hosts belong to the same network, they have the same network ID. The two hosts will have different host ID's and can communicate with each other locally without going through a router.

If two hosts have different network ID's, they belong to different segments on the network. They must communicate with each other remotely through a router or default gateway.

An IP address consists of 32 binary bits, where each bit is either a 0 or 1. We first write the 32 bits into four 8-bit numbers separated by a period in between each 8-bit number.

11000001 . 00001010 . 00011110 . 00000010 (IP address in binary form)

To convert the IP address from binary to decimal form, we convert each of the four 8-bit numbers according to the following table:

8 Bit (octet)

1

1

1

1

1

1

1

1

Decimal (power of 2)

128

64

32

16

8

4

2

1

The above IP address would translate into

11000001 = 128 + 64 + 1 = 193
00001010 = 8 + 2 = 10
00011110 = 16 + 8 + 4 + 2 = 30
00000010 = 2

So in decimal form, the IP address is: 193.10.30.2. The network ID in the address consists of a certain number of bits starting from the left. The host ID consists of the remaining bits.


Example 1

The network ID might consist of the first 8 leftmost bits. Then the host ID consists of the remaining 24 bits.

01010001 . 00001010 . 00011110 . 00000010 (IP address in binary form)

[---8 bits--] [--------------------24 bits-------------------]

[--net ID--] [--------------------host ID-------------------]

01010001 . 10001010 . 00011110 . 00001010 would be an IP address that has the same network ID but a different host ID. The two IP addresses in decimal form are respectively 81.10.30.2 and 81.138.30.10. The two IP addresses are class A addresses because the first eight bits has a decimal value that lies in the range 1 through 126. The network segment they both belong to is known as 81.0.0.0, where zeros have been substituted in the host ID bits.


Example 2

The network ID consists of the first 16 leftmost bits and the host ID consists of the next 16 bits.

10000001 . 00001010 . 00011110 . 00000010 (IP address in binary form)

[-----------16 bits ---------] [-----------16 bits----------]

[------------net ID----------] [-----------host ID----------]

10000001 . 00001010 . 00011111 . 00010010 would be an IP address that has the same network ID but a different host ID. The two IP addresses in decimal form are respectively, 129.10.30.2 and 129.10.31.18. The two IP addresses are class B addresses because the first eight bits has a decimal value that lies in the range of 128 -191. The network segment that both IP addresses belong to is named 129.10.0.0, where zeros have been substituted in the host ID bits.


Example 3

The network ID consists of the first 24 leftmost bits and the host ID consists of the next 8 bits.

11000001 . 00001010 . 00011110 . 00000010 (IP address in binary form)

[-------------------24 bits------------------] [----8 bits---]

[-------------------net ID-------------------] [---host ID--]

11000001 . 00001010 . 00011110 . 00000110 would be an IP address that has the same network ID but a different host ID. The two IP addresses in decimal form are respectively, 193.10.30.2 and 193.10.30.6. The two IP addresses are class C addresses because the first eight bits has a decimal value that lies in the range of 192-223. The network segment that both IP addresses belong to is named 193.10.30.0, where zeros have been substituted in the host ID bits.