TCP/IP Address Construct
A TCP/IP address is a 32 bit, binary number that has been converted to decimal.
Octet = An octet is simply a group of 8 numbers. The IP address 191.168.1.1 has four octets: 191, 168, 1, and 1. I know I said there are 8 numbers and I only showed you four, but keep in mind that IP is in binary, not decimal. Each set of numbers represent 8 binary digits (zeroes or ones).
Bits = A bit is simply a single character. In other words, 32 bits equals 32 zeroes or ones.
Binary = A number system that is based on two characters - 0 & 1.
Decimal 191 = Binary 10111111 | |||||||
1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 |
---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Decimal 54 = Binary 00110110 | |||||||
0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 |
---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Decimal 38 = Binary 00100110 | |||||||
0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 |
---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Decimal 15 = Binary 00001111 | |||||||
0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
191 | 54 | 38 | 15 |
10111111 | 00110110 | 00100110 | 00001111 |
191.54.38.15 = 10111111.00110110.00100110.00001111
Subnet Mask
A subnet mask is used to determine where the network ends and the hosts begin. We get this information by converting the decimal numbers within the subnet mask to binary. The 1's in our binary subnet mask represents the network portion of our IP address, and the 0's represent the hosts. Here's an example:
IP Address: 192.168.1.0
Subnet Mask: 255.255.255.0
The first thing we do is convert our first octet to binary:
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
When we add up all the decimal numbers underneath our binary 1's, we get 255 (128+64+32+16+8+4+2+1). In this example, the next two octets are also all 1's. And as you probably have guessed the fourth and final octet in our example is all 0's or all hosts.
So in binary, 255.255.255.0 is equal to:
11111111.11111111.11111111.00000000
Wherever our 1's stop and our zeros begin is called our network boundary:
11111111.11111111.11111111.|00000000
In this example, the first three octets are our network and the last one represents our hosts:
Subnet = 192.168.1.0
Hosts* = 192.168.1.1 - 192.168.1.254 (E.g. 192.168.1.1, 192.168.1.2, 192.168.1.3, etc...)
*The number of hosts on any network is determined by taking 2 to the power of the number of binary zero's. In this example, 8 0's = 2^8 = 256. However, we have to remove the first and last address from the pool of usable addresses. We will discuss this later, for now suffice it to say that the actual formula to determine how many hosts is (2^n)-2, where n = the number of binary zero's.
In our example n=8, so we have 2^8-2=256-2=254. We have a single network with 254 usable IP addresses for hosts (PC's, printers, etc...).
Now, let's take a look at what happens if we change our subnet mask:
IP Address: 192.168.1.0
Subnet Mask: 255.255.0.0
Just like the previous example, the first thing we need to do is to determine our network boundary by converting our decimal subnet mask to binary:
11111111.11111111.|00000000.00000000
Subnet = 192.168.0.0
Hosts = 192.168.0.1-192.168.255.254
Note that we can't use 192.168.0.0 as a host because it is the network address and 192.168.255.255 also can't be used because it is reserved for the broadcast address. However, all addresses in between the network address and the broadcast address can be assigned to hosts. Although it may look strange, addresses such as 192.168.0.255, 192.168.1.0, and 192.168.255.0 are all valid host addresses in the 192.168.0.0/16 network.
Note that we can't use 192.168.0.0 as a host because it is the network address and 192.168.255.255 also can't be used because it is reserved for the broadcast address. However, all addresses in between the network address and the broadcast address can be assigned to hosts. Although it may look strange, addresses such as 192.168.0.255, 192.168.1.0, and 192.168.255.0 are all valid host addresses in the 192.168.0.0/16 network.
So now we can use the same formula to determine the number of assignable hosts - 16 zeros = 2^16-2 = 65,534 hosts.
IP Address Classes
There are five classes of IP addresses:
Class | Purpose | First Octet Range | Maximum Hosts | Total Networks |
Class A | Very Large Networks | 1-126* | 16,777,216 (2^24) | 128 (2^7) |
Class B | Large Enterprise | 128-191 | 65,536 (2^16) | 16,384 (2^14) |
Class C | Small Business | 192-223 | 256 (2^8) | 2,097,152 (2^21) |
Class D | Multicast | 224-239 | N/A | N/A |
Class E | Experimental | 240-255 | N/A | N/A |
*IP addresses that begin with 127 are reserved for various functions.
Some find it easier to remember these addresses via the first binary bits of each network type:
0 = Class A
10 = Class B
110 = Class C
1110 - Class D
1111 - Class E
10 = Class B
110 = Class C
1110 - Class D
1111 - Class E
Private Network Ranges
Each class of IP addresses has a private address range. These ranges were created to conserve public IP addresses. Instead of issuing a real IP address to every host on your network, you can issue a private address and translate the private address to a public one when you communicate with the Internet. For example, a network with 200 or even 200,000 hosts, could use just one public IP address. This process is called NAT/PAT and will be covered in another lesson.
Class A Private Address = 10.0.0.0/8. If an IP address begins with the number 10, it is a class A private address.
Class B Private Address = 172.16.0.0/12. If an IP address begins with 172.16-31, it is a class B private address.
Class C Private Address = 192.168.0.0/16. If an IP address begins with 192.168, it is a class C private address.
Chances are if you look at the IP address of your PC right now, you will have a private IP address in one of the above ranges. If you are at home, your router is likely running DHCP and issued your PC a private IP Address. When you communicate on the Internet, the public IP address that has been issued by your ISP will be used. The router in your home is translating your private address to your public address. Key Topic: A private IP address cannot be routed over the Internet, but can be routed throughout your internal network.
Subnet Mask Chart
Decimal | Shorthand | Binary |
---|---|---|
255.0.0.0 | /8 | 11111111.00000000.00000000.00000000 |
255.128.0.0 | /9 | 11111111.10000000.00000000.00000000 |
255.192.0.0 | /10 | 11111111.11000000.00000000.00000000 |
255.224.0.0 | /11 | 11111111.11100000.00000000.00000000 |
255.240.0.0 | /12 | 11111111.11110000.00000000.00000000 |
255.248.0.0 | /13 | 11111111.11111000.00000000.00000000 |
255.252.0.0 | /14 | 11111111.11111100.00000000.00000000 |
255.254.0.0 | /15 | 11111111.11111110.00000000.00000000 |
255.255.0.0 | /16 | 11111111.11111111.00000000.00000000 |
255.255.128.0 | /17 | 11111111.11111111.10000000.00000000 |
255.255.192.0 | /18 | 11111111.11111111.11000000.00000000 |
255.255.224.0 | /19 | 11111111.11111111.11100000.00000000 |
255.255.240.0 | /20 | 11111111.11111111.11110000.00000000 |
255.255.248.0 | /21 | 11111111.11111111.11111000.00000000 |
255.255.252.0 | /22 | 11111111.11111111.11111100.00000000 |
255.255.254.0 | /23 | 11111111.11111111.11111110.00000000 |
255.255.255.0 | /24 | 11111111.11111111.11111111.00000000 |
255.255.255.128 | /25 | 11111111.11111111.11111111.10000000 |
255.255.255.192 | /26 | 11111111.11111111.11111111.11000000 |
255.255.255.224 | /27 | 11111111.11111111.11111111.11100000 |
255.255.255.240 | /28 | 11111111.11111111.11111111.11110000 |
255.255.255.248 | /29 | 11111111.11111111.11111111.11111000 |
255.255.255.252 | /30 | 11111111.11111111.11111111.11111100 |
There is no need to memorize these, as you practice they will become second nature.
Reserved Host Addresses
As mentioned earlier, for every subnet, the first and the last IP addresses are reserved:
First IP Address = Network ID
Last IP Address = Broadcast Address. The broadcast address is used for a specific type of network traffic that is destined for every device attached to a network.
Example:
IP Address = 192.168.1.1
Subnet Mask = 255.255.255.0
Network ID = 192.168.1.0
Broadcast Address = 192.168.1.255
Usable IP's = 192.168.1.1 - 192.168.1.254
Subnet Mask = 255.255.255.0
Network ID = 192.168.1.0
Broadcast Address = 192.168.1.255
Usable IP's = 192.168.1.1 - 192.168.1.254
No comments:
Post a Comment