Table 7-5 IP Address Classes Address Class Number of Networks Number of Hosts Per Network * The 127.x.x.x address range is reserved as a loopback address, used for testing and diagnostic
Trang 1Decimal and Binary Conversion
There is usually more than one way to solve a math problem, and decimal-to-binary
conversion is no exception This section explores one method, but feel free to use
another method if it is easier
To convert a decimal number to binary, the idea is to first find the biggest power of 2
that “fits” into the decimal number, as shown in Table 7-1 If this process is designed
to work with computers, the most logical place to start is with the largest values that
fit into 1 or 2 bytes
As mentioned, the most common grouping of bits is 8, which make up one byte But
sometimes the largest value that can be held in 1 byte (255) is not large enough for the
values needed In this situation you must combine bytes, so instead of having two 8-bit
numbers you have one 16-bit number, or instead of three 8-bit numbers you have one
24-bit number The same rules apply as for 8-bit numbers: You multiply the previous
position value by 2 to get the present column value Table 7-1 documents these values
(starting with a 2-byte/16-bit number), which are very important when you’re learning
the mechanics of subnetting
Because working with computers often is referenced by bytes, it is easiest to start with
byte boundaries and calculate from there, as shown in Table 7-2 To better demonstrate,
look at the next couple of calculation examples, the first being 6,783 Because this
number is greater than 255, the largest value possible in a single byte, you use 2 bytes
Start calculating from 215 The result is that 6,783 equals 00011010 01111111
Table 7-1 Calculating Available Host Addresses
Table 7-2 Decimal-to-Binary Conversion Chart
Position Power Decimal Value Position Value Binary Count Remainder
continues
Trang 2The second example is 104 Because this number is less than 255, the conversion can
be done in 1 byte, as shown in Table 7-3
So 104 is 01101000
Table 7-3 Converting an 8-Bit Number
Position Power Decimal Value Position Value Binary Count Remainder
Table 7-2 Decimal-to-Binary Conversion Chart (Continued)
Position Power Decimal Value Position Value Binary Count Remainder
Trang 3This method works for any decimal number Consider the decimal number 1,000,000
Because 1,000,000 is greater than the largest value that can be held in 2 bytes (65535),
you need at least 3 bytes By multiplying by 2 until you reach 24 bits (3 bytes), you get
the value 8,388,608, meaning that the largest value that 24 bits can hold is 16,777,215
So starting at the 24 bit, follow the process until you get to 0 Continuing with the
pro-cedure, you’ll determine that the decimal number 1,000,000 equals the binary number
00001111 01000010 01000000
Binary-to-decimal conversion is just the opposite Simply place the binary number in
the table If there is a 1 in a column position, add that value to the total Table 7-4
demonstrates an example of this.It shows converting 00000100 00011101 to decimal,
resulting in 1053
Table 7-4 Decimal-to-Binary Conversion of a 16-Bit Number
Position Power Decimal Value Position Value Binary Count Remainder
Trang 4IPv4 Addressing
IP forwards packets from the network on which they originate to the destination network,
as shown in Figure 7-16 This addressing scheme, therefore, must include an identifier for both the source and destination networks By using the destination network identifier,
IP can deliver a packet to the destination network When the packet arrives at a router connected to the destination network, IP must then locate the particular computer connected to that network This works in much the same way as the postal system When the mail is routed, it must first be delivered to the post office at the destination city using the zip code, and then that post office must locate the final destination in that city using the street address This is a two-step process
Figure 7-16 Communication Path
Accordingly, every IP address has two parts, as shown in Figure 7-17 One part identifies the network to which the system is connected, and a second part identifies that particular system on the network This kind of address is called a hierarchical address, because it contains different levels, as shown in Figure 7-18 As Figure 7-18 illustrates, each octet ranges from 0 to 255 Each octet breaks down into 256 subgroups, and they break down into another 256 subgroups with 256 addresses in each By referring to the group address directly above a group in the hierarchy, all the groups that branch from that address can be referenced as a single unit An IP address combines these two identifiers into one number This number must be unique, because duplicate addresses are not allowed The first part identifies the system’s network address The second part, the host part, tells which particular machine it is on that network
!
"
#
$ &
'
%
Trang 5
Figure 7-17 Network and Host Portions of the IP Address
Figure 7-18 Hierarchical IP Addresses
How does a user determine which portion of the address identifies the network and
which portion identifies the host? The answer begins with the designers of the Internet,
who thought networks would be built in different sizes, depending on the number of
computers (hosts) they contained, as shown in Table 7-5
Table 7-5 IP Address Classes
Address Class Number of Networks Number of Hosts Per Network
* The 127.x.x.x address range is reserved as a loopback address, used for testing and diagnostic
purposes.
16,777,216
1.2
1.3 1.1
2.1
3.1
1
2 3
1 2 3 1 1
1.0.0.0 2.0.0.0 3.0.0.0 10.0.0.0 11.0.0.0 255.0.0.0
10.1.0.0 10.2.0.0 10.3.0.0 10.255.0.0
10.2.1.0 10.2.2.0 10.2.3.0 10.2.255.0 10.255.1.0 10.255.2.0 10.255.3.0 10.255.255.0
10.2.2.1 10.2.2.2 10.2.2.3 10.2.255.0 10.255.2.1 10.255.2.2 10.255.2.3 10.255.2.255
Internet Address
Trang 6The assumption was that there would be a relatively small number of large networks, possibly with millions of computers The designers envisioned a larger number of medium-sized networks, with perhaps thousands of computers each Finally, they saw a great number of networks having several hundred or fewer machines Thus, the designers divided the available IP addresses into classes to define the large (Class A), medium (Class B), and small (Class C) networks, as shown in Table 7-6 Knowing the class of an IP address is the first step in determining which part of the address identifies the network and which part identifies the host
IP Address Classes
To accommodate different-sized networks and to aid in classifying them, IP addresses are divided into groupings called classes, as shown in Figure 7-19 This is called classful addressing Each complete 32-bit IP address is broken into a network part and a host part A bit or bit sequence at the start of each address determines the class of the address,
as shown in Figure 7-20 There are five IP address classes
Figure 7-19 Network and Host Division
Table 7-6 Identifying Address Classes
Address Class High-Order Bits First Octet Address Range
Number of Bits in the Network Address
* 127 (01111111) is a Class A address reserved for loopback testing and cannot be assigned to a network.
8
32 Bits
8 Bits
1 Byte 1 Byte8 Bits 1 Byte8 Bits 1 Byte8 Bits
Trang 7Figure 7-20 Address Class Prefixes
Class A Addresses
TheClass A address, shown in Figure 7-21, was designed to support extremely large
networks A Class A IP address uses only the first octet to indicate the network address
The remaining three octets enumerate host addresses
Figure 7-21 Class A Addresses
The first bit of a Class A address is always 0 With that first bit a 0, the lowest number
that can be represented is 00000000 (decimal 0), and the highest number that can be
represented is 01111111 (decimal 127) However, these two numbers, 0 and 127, are
reserved and cannot be used as a network address Any address that has a value between
1 and 126 in the first octet is a Class A address
Class B Addresses
TheClass B address, shown in Figure 7-22, was designed to support the needs of
moderate- to large-sized networks A Class B IP address uses two of the four octets
to indicate the network address The other two octets specify host addresses
Class A: Prefix Value 0
7 Network Bits Host Bits
Class B: Prefix Value 10
14 Network Bits Host Bits
Class C: Prefix Value 110
21 Network Bits Host Bits
No of Prefix Bits 4 Class D: Prefix Value 1110
28 Address
No of Prefix Bits 4 Class E: Prefix Value 1111
28 Address Class D addresses are used for multicast groups There is no need
to allocate octets or bits to separate network and host addresses.
Class Eaddresses are reserved for research use only.
NOTE
The 127.0.0.0 net-work is reserved for loopback testing (routers or local machines can use this address to send packets to themselves) Therefore, it cannot
be assigned to a network.
24 Bits
Trang 8Figure 7-22 Class B Addresses
The first 2 bits of the first octet of a Class B address are always 10 The remaining 6 bits may be populated with either 1s or 0s Therefore, the lowest number that can be repre-sented with a Class B address is 10000000 (decimal 128), and the highest number that can be represented is 10111111 (decimal 191) Any address that starts with a value in the range of 128 to 191 in the first octet is a Class B address
Class C Addresses
TheClass C address, shown in Figure 7-23, is the most commonly used of the original
address classes This address space was intended to support a lot of small networks
Figure 7-23 Class C Addresses
A Class C address begins with binary 110 Therefore, the lowest number that can be represented is 11000000 (decimal 192), and the highest number that can be represented
is 11011111 (decimal 223) If an address contains a number in the range of 192 to 223
in the first octet, it is a Class C address
Class D Addresses
TheClass D address, shown in Figure 7-24, was created to enable multicasting in an
IP address A multicast address is a unique network address that directs packets that have that destination address to predefined groups of IP addresses Therefore, a single station can simultaneously transmit a single stream of data to multiple recipients
Figure 7-24 Class D Addresses
Class B: Network Network Host Host
16 Bits
Class C: Network Network Network Host
8 Bits
Net Portion Host Portion
Trang 9The Class D address space, much like the other address spaces, is mathematically
con-strained The first 4 bits of a Class D address must be 1110 Therefore, the first octet
range for Class D addresses is 11100000 to 11101111, or 224 to 239 An IP address
that starts with a value in the range of 224 to 239 in the first octet is a Class D address
Class E Addresses
AClass E address, shown in Figure 7-25, has been defined However, the Internet
Engineering Task Force (IETF) reserves these addresses for its own research Therefore,
no Class E addresses have been released for use in the Internet The first 4 bits of a
Class E address are always set to 1 Therefore, the first octet range for Class E addresses
is 11110000 to 11111111, or 240 to 255
Figure 7-25 Class E Addresses
Table 7-7 shows the IP address range of the first octet (in decimal and binary) for each
IP address class
Table 7-7 IP Address Classes: Range of the First Octet
IP Address Class IP Address Range (First Octet Decimal Value)
Determine the class based on the decimal value of the first octet.
* 127 (01111111) is a Class A address reserved for loopback testing and cannot be assigned to a
network.
Net Portion Host Portion
Trang 10Reserved IP Addresses
Certain addresses are reserved and cannot be assigned to devices on a network These reserved host addresses include the following:
■ Network addresses are used to identify the network itself (see Figure 7-26) The upper box represents the 198.150.11.0 network Data that is sent to any host
on that network (198.150.11.1 to 198.150.11.254) is seen outside the LAN as 198.159.11.0 The only time the host numbers matter is when the data is on the LAN The LAN in the lower box is treated the same as the upper LAN, except that its network number is 198.150.12.0
■ Thebroadcast address is used to broadcast packets to all the devices on a
net-work (see Figure 7-27) The upper box represents the 198.150.11.255 broadcast address Data that is sent to the broadcast address is read by any host on that network (198.150.11.1 to 198.150.11.254) The LAN in the lower box is treated the same as the upper LAN, except that its broadcast address is 198.150.12.255
Figure 7-26 Network Address
An IP address that has binary 0s in all host bit positions is reserved for the network
address, as shown in Figure 7-28 This Class B address has all its host bits set to 0 That
is why it is identified as the network address Therefore, as a Class A network example, 113.0.0.0 is the IP address of the network containing the host 113.1.2.3 A router uses the network IP address when it forwards data on the Internet As a Class B network example, the IP address 176.10.0.0 is a network address, as shown in Figure 7-28
198.150.11.15 198.150.11.16 198.150.11.17 198.150.11.18 198.150.11.19
Internet
198.150.12.12 198.150.12.13 198.150.12.14 198.150.12.15 198.150.12.16