Archive for June, 2010

Monday, June 7th, 2010 by sales@ciscokits.com

IP Addressing, conversions between binary and decimal

Today we will continue your preparation for the CCNA exam. We will talk about IP addressing and conversions between binary and decimal. Understanding how IP addressing works is a critical step in your preparation for Cisco’s CCNA exam because it will help you learn easily how routers take decisions to forward packets in your network.

IP addressing is the key function of every IP network to function. Today, when you say IP, you talk about IPv4. Soon, IPv6 will take its place, but now, every time when we’ll say IP we will talk about IPv4.

IP enables hosts to communicate with each other at the Network layer. In IPv4 each packet contains a source and destination address. That’s how the routers on the network knows where the packet is coming from and where they must forward the packet. The IP addresses fields are represented in 32 bits. Routers know how to interpret those numbers, but for a human to understand them would be too difficult. From our point of view, we use what’s called a dotted decimal address. A dotted decimal address is the human representation of the binary address. For example, the address 192.168.10.1 is a dotted decimal address. In its binary form, the address is 11000000101010000000101000000001. IP addresses have 4 octets. For example, 192 is the first octet, 168 the second, 10 the third and 1 the last octet. In its binary form, 11000000 is the first octet, 10101000 the second, 00001010 the third and 00000001 the last octet. Every octet, in its decimal form, can get a value from 0 to 255.

In the binary system there are only 1s and 0s. Depending on their position in the octet, they get different values. Each position is a power of 2. To get the decimal number you have to sum up those number.

 1 1 1 1 1 1 1 1 2^7 = 128 2^6 = 64 2^5 = 32 2^4 = 16 2^3 = 8 2^2 = 4 2^1 = 2 2^0 = 1

For example, we know that 10101000 is 168. But let’s see if we get the same number after we make the calculations.

2^7 * 1 + 2^6 * 0 + 2^5 * 1 + 2^4 * 0 + 2^3 * 1 + 2^2 * 0 + 2^1 * 0 + 2^0 * 0 = 128 + 32 + 8 = 168

Let’s now learn how to convert those numbers from decimal to binary. The decimal to binary conversion is similar to binary to decimal conversion. Keep in mind those powers of 2. When you calculate the binary value, you take those powers of 2 and compare them with your number. If your number is greater, you write down 1 and you subtract that power of 2 from the number. If your number is lower than the power of 2, you write down 0. You continue to make the calculations until you reach 2^0.

Let’s take the same number, 168, and convert it to binary.

168 is greater than 128. We write down 1 and we subtract 128 from 168. We get 40. 40 is lower than 64. We write 0 and we continue. 40 is greater than 32. We write 1 and we subtract 32 from 40, getting us 8. 8 is lower than 16. Write 0. We continue to 8, which is equal to 8. We write down 1 and from this point we can fill the remaining 3 spaces with 0s. Finally, we get 10101000.

168 >= 128?               1      168 – 128 = 40
40 >= 64?                   0
40 >= 32?                   1       40 – 32 = 8
8 >= 16?                     0
8 >= 8?                       1        8 – 8 = 0
0 >= 4?                       0
0 >= 2?                       0
0 >= 1?                       0

Try to practice these conversions. This is a requirement in the CCNA exam, and you may have to do some calculations. You can start for example to find out what’s the binary representation of 215? What about 110 or 16? Are you able to calculate the decimal value for 11010011, 00010110, 01110001?

We continue in our CCNA certification topic with the types of IP addresses.

The network address is the address by which we refer a network. It is always the first address in an IP address range.

The broadcast address is a special address used to send data to all hosts on a network. It is always the last address in an IP address range.

The host address is the address assigned to a single host in a network. The value of the IP address must have a value between the network and the broadcast address.

We will discuss these types of addresses in the IP address components lesson.

An IPv4 host can communicate in different ways: unicast, broadcast and multicast.

In Unicast a host sends packets to only one host on the network and a host in other network.

Broadcast is the process of sending packets to all hosts in a network. Broadcast messages are not routed in other networks, allowing hosts to communicate on their network.

Multicast traffic is the traffic sent from one host to a selected group of hosts using a special IP address. Multicast is often used by routing protocols, in video and audio distribution and software distribution. In IPv4, there is a special block of addresses reserved for multicasting: 224.0.0.0 to 239.255.255.255.

Host addresses are from 0.0.0.0 to 223.255.255.255 and are used for IPv4 hosts.

Multicast addresses, as stated above, are from 224.0.0.0 to 239.255.255.255 and are used for special purposes.

Experimental addresses are used only for research and experimentation and cannot be used in IPv4 networks. The range is from 240.0.0.0 to 255.255.255.254.

However, not all host addresses can be routed through the internet. There is a private address space used for communications in your internal network, which can be freely used by anyone. The private address blocks are: 10.0.0.0 to 10.255.255.255 (10.0.0.0/8), 172.16.0.0 to 172.31.255.255 (172.16.0.0/12) and 192.168.0.0 to 192.168.255.255 (192.168.0.0/16).

Although these addresses cannot be routed in the Internet, you can still have Internet connectivity. This process is called Network Address Translation (NAT). In this process, one or many hosts having private IP addresses are mapped to a router’s public IP address.

Back in the days, when classless routing was not used, the IP addresses were classified in 5 different classes.

Class A addresses were the ones from 0.0.0.0 to 127.255.255.255. A class A network is has a default netmask of 255.0.0.0 allowing for up to 16,777,214 hosts per network ( 2^24 – 2). However, there’s possible to create only 128 network from the whole class A space. Or at least it was, back in the days, when classless routing was not used.

Class B addresses are from 128.0.0.0 to 191.255.255.255. The whole class B was able to create 16,384 networks (2^14) with a maximum number of 65,534 hosts per network (2^16 – 2). The default netmask si 255.255.0.0.

Class C networks were found within the 192.0.0.0 – 223.255.255.255 range. This class allowed for more networks -2,097,150 ( 2^21 ) but the maximum hosts per network was only 254 (2^8 – 2).

The class D and the class E address blocks are the same used today for multicasting, respectively the experimental addresses.

However, these days we use classless addressing. The process of assigning classless addresses is called subneting. We will learn you how to subnet on a separate, dedicated topic.

We hope we have found this introduction in IP addressing helpful. We must note that you must be able to effectively use IP addressing and convert the addresses between their decimal and binary forms when you’ll take the CCNA exam.