Modul 5
Modul 5
Modul 5
Introduction
5.0.1
As a network administrator you must know how to convert binary addresses into dotted decimal
and dotted decimal addresses into binary. You will also need to know how to convert dotted
decimal into hexadecimal and vice versa. (Hint: You still need your binary conversion skills to
make this work.)
Surprisingly, it is not that hard when you learn a few tricks. This module contains an activi ty called
the Binary Game which will really help you get started. So, why wait?
5.0.2
Module Objective: Calculate numbers between decimal, binary, and hexadecimal systems.
Table caption
Topic Title Topic Objective
Binary Number
Calculate numbers between decimal and binary systems.
System
Hexadecimal
Calculate numbers between decimal and hexadecimal systems.
Number System
Binary is a numbering system that consists of the digits 0 and 1 called bits. In contrast, the
decimal numbering system consists of 10 digits consisting of the digits 0 – 9.
Binary is important for us to understand because hosts, servers, and network devices use
binary addressing. Specifically, they use binary IPv4 addresses, as shown in the figure, to
identify each other.
There is a central router with two LANs directly connected and one WAN connected to a
cloud. Each LAN has a switch and a PC. The WAN has one PC. Each device has an IPv4
address that is in dotted binary notation instead of dotted decimal notation.
Each address consists of a string of 32 bits, divided into four sections called octets. Each octet
contains 8 bits (or 1 byte) separated with a dot. For example, PC1 in the figure is assigned IPv4
address 11000000.10101000.00001010.00001010. Its default gateway address would be that of
R1 Gigabit Ethernet interface 11000000.10101000.00001010.00000001.
Binary works well with hosts and network devices. However, it is very challenging for humans to
work with.
For ease of use by people, IPv4 addresses are commonly expressed in dotted decimal notation.
PC1 is assigned the IPv4 address 192.168.10.10, and its default gateway address is
192.168.10.1, as shown in the figure.
For a solid understanding of network addressing, it is necessary to know binary addressing and
gain practical skills converting between binary and dotted decimal IPv4 addresses. This section
will cover how to convert between base two (binary) and base 10 (decimal) numbering systems.
5.1.2
Radix10101010Position in
Number3210Calculate(103)(102)(101)(100)Position
value1000100101
Radix 10 10 10 10
Position in Number 3 2 1 0
Row 1, Radix is the number base. Decimal notation is based on 10, therefore the radix is 10.
Row 2, Position in number considers the position of the decimal number starting with, from right
to left, 0 (1st position), 1 (2nd position), 2 (3rd position), 3 (4th position). These numbers also
represent the exponential value use to calculate the positional value in the 4th row.
Row 3 calculates the positional value by taking the radix and raising it by the exponential value of
its position in row 2.
Note: n0 is = 1.
Row 4 positional value represents units of thousands, hundreds, tens, and ones.
To use the positional system, match a given number to its positional value. The ex ample in the
table illustrates how positional notation is used with the decimal number 1234.
Result 1,234
Radix22222222Position in Number76543210Calculate(27)(26)(25)(24)(23)(22)(21)(20)Position
value1286432168421
Radix 2 2 2 2 2 2 2 2
Position in Number 7 6 5 4 3 2 1 0
Calculate (2 7 ) (2 6 ) (2 5 ) (2 4 ) (2 3 ) (2 2 ) (2 1 ) (2 0 )
Row 1, Radix is the number base. Binary notation is based on 2, therefore the radix is 2.
Row 2, Position in number considers the position of the binary number starting with, from right to
left, 0 (1st position), 1 (2nd position), 2 (3rd position), 3 (4th position). These numbers also
represent the exponential value use to calculate the positional value in the 4th row.
Row 3 calculates the positional value by taking the radix and raising it by the exponential value of
its position in row 2.
Note: n0 is = 1.
Row 4 positional value represents units of ones, twos, fours, eights, etc.
The example in the table illustrates how a binary number 11000000 corresponds to the number
192. If the binary number had been 10101000, then the corresponding decimal number would be
168.
Calculate 1 x 128 1 x 64 0 x 32 0 x 16 0 x8 0 x4 0 x2 0 x1
Result 192
5.1.5
Calculate 128 64 32 16 8 4 2 1
Result 192
Next convert the second octet of 10101000 as shown in the table. The resulting decimal value is
168, and it goes into the second octet.
Calculate 128 64 32 16 8 4 2 1
Result 168
Calculate 128 64 32 16 8 4 2 1
Result 11
Convert the fourth octet of 00001010 as shown in the table. This completes the IP address and
produces 192.168.11.10.
Calculate 128 64 32 16 8 4 2 1
Positional Value1286432168421Binary Number
(11000000)00001010Calculate1286432168421Add Them Up...0+ 0+ 0+ 0+ 8+ 0+ 2+ 0Result10
Result 10
5.1.6
This activity allows you to practice 8-bit binary to decimal conversion as much as necessary. We
recommend that you work with this tool until you are able to do the conversion without error.
Convert the binary number shown in the octet to its decimal value.
Decimal
Value
Base 2 2 2 2 2 2 2 2
Exponent 7 6 5 4 3 2 1 0
osition 128 64 32 16 8 4 2 1
Bit 1 1 1 1 0 1 1 0
Binary Number
5.1.8
The first octet number 192 is converted to binary using the previously explained positional
notation process.
It is possible to bypass the process of subtraction with easier or smaller decimal numbers. For
instance, notice that it is fairly easy to calculate the third octet converted to a binary number
without actually going through the subtraction process (8 + 2 = 10). The binary value of the third
octet is 00001010.
The fourth octet is 11 (8 + 2 + 1). The binary value of the fourth octet is 00001011.
Converting between binary and decimal may seem challenging at first, but with practice it should
become easier over time.
Is the first octet number 192 equal to or greater than the high-order bit 128?
Yes it is, therefore add a 1 to the high-order positional value to a represent 128.
Subtract 128 from 192 to produce a remainder of 64.
5.1.8
The first octet number 192 is converted to binary using the previously explained positional
notation process.
It is possible to bypass the process of subtraction with easier or smaller decimal numbers. For
instance, notice that it is fairly easy to calculate the third octet converted to a binary number
without actually going through the subtraction process (8 + 2 = 10). The binary value of the third
octet is 00001010.
The fourth octet is 11 (8 + 2 + 1). The binary value of the fourth octet is 00001011.
Converting between binary and decimal may seem challenging at first, but with practice it s hould
become easier over time.
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Step 7
Step 8
Step 9
Step 10
Step 11
Is the remainder 64 equal to or greater than the next high-order bit 64?
It is equal, therefore add a 1 to next high-order positional value.
5.1.9
This activity allows you to practice decimal conversions to 8-bit binary values. We recommend
that you work with this tool until you are able to do the conversion without error. Convert the
decimal number shown in the Decimal Value row to its binary bits.
ecimal 148
alue
ase 2 2 2 2 2 2 2 2
xponent 7 6 5 4 3 2 1 0
osition 128 64 32 16 8 4 2 1
it
5.1.10
Activity - Binary Game
This is a fun way to learn binary numbers for networking.
You will need to log in to cisco.com to use this link. It will be necessary to create an account
if you do not already have one.
There are also a variety of free mobile binary games. Search for "binary game" in your app
store.
5.1.11
IPv4 Addresses
As mentioned in the beginning of this topic, routers and computers only understand binary, while
humans work in decimal. It is important for you to gain a thorough understanding of these two
numbering systems and how they are used in networking.
The computer stores the address as the entire 32-bit data stream.
1.
Number Systems
2. Hexadecimal Number System
Just as decimal is a base ten number system, hexadecimal is a base sixteen system. The base
sixteen number system uses the digits 0 to 9 and the letters A to F. The figure shows the
equivalent decimal and hexadecimal values for binary 0000 to 1111.
This graphic has three columns. The first column has the numbers 0 through 15 in decimal.
The second column has the numbers 0 through 15 in binary. All of the numbers in binary are
expressed with 4 place values. For example 0 is 0000, 10 is 1010, 15 is 1111, etc. The third
column is parallel with the other two columns. This column has the numbers 0 through 15 in
hexadecimal. These are expressed with one value. For example 5 is 5, 10 is A, 11 is B, 12 is
C, 13 is D, 14 is E, and 15 is F. It should be noted that these may be expressed with upper or
lower case. In this diagram they are all upper case letters representing the numeric values.
Binary and hexadecimal work well together because it is easier to express a value as a
single hexadecimal digit than as four binary bits.
IPv6 addresses are 128 bits in length and every 4 bits is represented by a s ingle hexadecimal
digit; for a total of 32 hexadecimal values. IPv6 addresses are not case-sensitive and can be
written in either lowercase or uppercase.
As shown in the figure, the preferred format for writing an IPv6 address is x:x:x:x:x:x:x:x, with
each “x” consisting of four hexadecimal values. When referring to 8 bits of an IPv4 address we
use the term octet. In IPv6, a hextet is the unofficial term used to refer to a segment of 16 bits or
four hexadecimal values. Each “x” is a single hextet, 16 bits, or four hexadecimal digits.
This graphic has a top line with the 8 hextets of the IPv6 address expressed as X:X:X: X: X: X: X: X.
Beneath each X are the numbers 0000 representing the first number that can be in this field
below each 0 is the to and below that are the lower case numbers ffff representing the maximum
value that can be made in a single hextet. Under the X in the fourth hextet is an orange arrow
pointing to the numbers 0000 to ffff, which are in a box. Under the box is another arrow point
down to to a section of numbers. At the center of the arrow is the statement 4 hexadecimal digits
= 16 binary digits. Under the arrow are a section of numbers with four parts. Each of the four
parts has 0000 under that the word to under that the numbers 1111.
This is to represent the binary of each hexadecimal number, since each number is made of 4
binary digits and there are 4 hexadecimal digits in each hextet for a total of 16 bits.
For example, 168 converted into hex using the three-step process.
5.2.4
Binary is a numbering system that consists of the numbers 0 and 1 called bits. In contrast, the
decimal numbering system consists of 10 digits consisting of the numbers 0 – 9. Binary is
important for us to understand because hosts, servers, and network devices use binary
addressing, specifically, binary IPv4 addresses, to identify each other. You must know binary
addressing and how to convert between binary and dotted decimal IPv4 addresses. This topic
presented a few ways to convert decimal to binary and binary to decimal.
Just as decimal is a base ten number system, hexadecimal is a base sixteen system. The base
sixteen number system uses the numbers 0 to 9 and the letters A to F. The hexadecimal
numbering system is used in networking to represent IPv6 addresses and Ethernet MAC
addresses. IPv6 addresses are 128 bits in length and every 4 bits is represented by a single
hexadecimal digit; for a total of 32 hexadecimal values. To convert hexadecimal to decimal, you
must first convert the hexadecimal to binary, then convert the binary to decimal. To convert
decimal to hexadecimal, you must also first convert the decimal to binary.
5.3.2
10101101
10110101
10100111
10100101
2. Given the binary address of 11101100 00010001 00001100 00001010, which address does this
represent in dotted decimal format?
234.16.12.10
234.17.10.9
236.17.12.6
236.17.12.10
3. How many binary bits exist within an IPv6 address?
256
64
128
32
48
4. What is the binary equivalent of the decimal number 232?
11110010
10011000
11101000
11000110
5. Which two statements are correct about IPv4 and IPv6 addresses? (Choose two.)
hexadecimal
ASCII
dotted decimal
binary
7. What is the dotted decimal representation of the IPv4 address
11001011.00000000.01110001.11010011?
209.165.201.223
203.0.113.211
198.51.100.201
192.0.2.199
8. What is the decimal equivalent of the binary number 10010101?
149
157
168
192
9. What is the decimal equivalent of the hex number 0x3F?
87
93
77
63
10. What is the dotted decimal representation of the IPv4 address which is represented as the binary
string 00001010.01100100.00010101.00000001?
100.10.11.1
10.100.21.1
10.10.20.1
100.21.10.1
11. What is the decimal equivalent of 0xC9?
200
201
185
199
12. Which is a valid hexadecimal number?
h
f
j
13. What is the binary representation of 0xCA?
10111010
11011010
11010101
11001010
14. How many bits are in an IPv4 address?
32
128
256
64