Internet Protocol (IP)
Next we will move on to IP or internet protocol, which is how we address devices on a network. The IP address is a 32 bit address that is broken into 4 octets. So 32 bits means that we have 32 1s and/or 0s that represent the address of a device. These 32 bits are broken up into 4 groups of 8 bits or 4 octets. An IP address of 192.168.1.2 means that 192 is in the first octect, 168 is the second octect, and so on.
IPv4 Address Classes
There are different classes of IP address, class a, b, c, d, and e. Class a addresses range from 0 to 127 in the first octet, this means that any address with 0 – 127 in the first group is a class a address, so 100.1.245.1 is a class a address because it falls into that range. Class b address have a range of 128-191, and Class C addresses range from 192-223. These classes are defined by the number in the first octet. If this number falls within a certain range it is considered a certain class. The following image explains the different classes.
The left most bits are what determine the class of an IP address. For example a class A address when converted in binary will ALWAYS have the first bit turned off, or a 0. Class B addresses must begin with 10 for the left most bits, and class C will always start with 110. The following image will illustrate Class A, B, and C address ranges.
As you can see when you convert the addresses into binary they all following the left-most bit rule that defines each class. An example of a class B address would be 172.16.0.0. If we were to convert the first octet into binary we would get 10101010 and if you notice the first 2 bits are 10, which makes it a class B address.
Private IP AddressesEach address class has special reserved ranges of IP addresses that cannot be used in a public network. These privates ranges are used for internal private networks.
There are additional private IP addresses such as 127.0.0.1 which is the loopback address. The loopback address is a pingable address that is used to testing you IP protocol stack. Should you attempt to ping 127.0.0.1 and it fails then you know that there is an issue with IP. Additionally class D addresses are reserved for multicast, and class E addresses are reserved for future use and experimental purposes.
Network and Host PortionsEvery IP address has 2 very import portions to it. They are the network and host portion. The network portion defines what network you belong to, and the host portion defines who you are on that network. These 2 portions are defined by your subnet mask. We'll go over this more in the following sections.
|
|
Binary ANDing
Lets take a look at the IP address pictured above. We know that it is a class B address as defined by the first octet. The picture displays which octets are a part of the network and host portion of the address. These portions are defined by the subnet mask of 255.255.0.0. What happens is the IP address is compared to the subnet mask and for every bit that is turned on in the subnet mask, the corresponding bit is defined as the network portion of the address. This is called binary ANDing.
In the above example the IP address is being compared to the subnet mask through the binary ANDing process. The network portion by itself represent the network address, or the network that the IP address belongs to. When you add the host portion to the address it goes from a network address to a host address.
Lets take another example. Lets take a class C address with its default subnet mask and figure out the network and host portions of the address. The IP address we will work with is 192.168.1.1 with a 255.255.255.0 subnet mask. Well right away we know that the first 3 octets of the subnet mask are all 1's since 255 in binary is 8 1's. So we compare it to the IP address and we find that the first 3 octets define our network portion of the address, 192.168.1.0, and the last octet defines our host portion, 192.168.1.1. It does get a little more complicated when we start adding custom subnet masks but for now just get used to the idea of comparing the IP address to the subnet mask through the binary ANDing process.
You need to memorize every class range, there default subnet masks, and the private address range for each class.
Lets take another example. Lets take a class C address with its default subnet mask and figure out the network and host portions of the address. The IP address we will work with is 192.168.1.1 with a 255.255.255.0 subnet mask. Well right away we know that the first 3 octets of the subnet mask are all 1's since 255 in binary is 8 1's. So we compare it to the IP address and we find that the first 3 octets define our network portion of the address, 192.168.1.0, and the last octet defines our host portion, 192.168.1.1. It does get a little more complicated when we start adding custom subnet masks but for now just get used to the idea of comparing the IP address to the subnet mask through the binary ANDing process.
You need to memorize every class range, there default subnet masks, and the private address range for each class.