Overview
|
The
network layer is responsible for navigating the data through the network.
The function of the network layer is to find the best path through the
network. The network layer's addressing scheme is used by devices to
determine the destination of data as it moves through the network. In this
chapter, you will learn about the router’s use and operations in performing
the key internetworking function of the Open System Interconnection (OSI)
reference model’s network layer, Layer 3.
In addition, you will
learn about IP addressing and the three classes of networks in IP
addressing schemes. You also will learn that some IP addresses have been
set aside by the American Registry for Internet Numbers (ARIN) and cannot
be assigned to any network. Finally, you will learn about subnetworks and
subnet masks and their IP addressing schemes.
|
|
10.1
|
Importance of a Network Layer
|
|
|
10.1.1
|
Identifiers
|
The
network layer is responsible for moving data through a set of networks (internetwork).
The network layer's addressing scheme is used by devices to determine the
destination of data as it moves through the networks.
Protocols that have no
network layer can only be used on small internal networks. These protocols
usually use only a name (i.e. MAC address) to identify the computer on a
network. The problem with this approach is that, as the network grows in
size, it becomes increasingly difficult to organize all the names, such as
making sure that two computers aren't using the same name.
Protocols that support
the network layer use a hierarchical addressing scheme that allows for
unique addresses across network boundaries, along with a method for finding
a path for data to travel between networks. While MAC addresses use a flat
addressing scheme that makes it difficult to locate devices on other
networks.
Hierarchical addressing
schemes enable information to traverse an internetwork, along with a method
to find the destination in an efficient fashion. The telephone network is
an example of the use of hierarchical addressing. The telephone system uses
an area code that designates a geographical area for the call's first stop
(hop). The next three digits represent the local exchange (second
hop). The final digits represent the individual destination telephone
(which is, or course, the final hop).
Network devices need an
addressing scheme that allows them to forward data packets through the
internetwork (a set of networks composed of multiple segments using the
same type of addressing). There are several network layer protocols with
different addressing schemes that allow devices to forward data throughout
an internetwork.
|
|
10.1
|
Importance of a Network Layer
|
|
|
10.1.2
|
Segmentation and autonomous systems
|
There
are two primary reasons why multiple networks are necessary - the growth in
size of each network and the growth in the number of networks.
When a LAN, MAN, or WAN
grows, it may become necessary or desirable for network traffic control to
break it up into smaller pieces called network segments (or just segments).
This results in the network becoming a group of networks, each requiring a
separate address.
There are already a
vast number of networks in existence; separate computer networks are common
in offices, schools, companies, businesses, and countries. It is convenient
to have these separate networks (or autonomous systems, if each is managed
by a single administration) communicate with each other over the Internet.
However, they must do it with sensible addressing schemes and appropriate
internetworking devices. If not, the network traffic flow would become
severely clogged, and neither the local networks, nor the Internet, would
function.
An analogy that might
help you understand the need for network segmentation is to imagine a
highway system and the number of vehicles that use it. As the population in
the areas surrounding the highways increases, the roads become burdened
with too many vehicles. Networks operate much in the same way. As networks
grow, the amount of traffic grows. One solution might be to increase the
bandwidth, much the same as increasing the speed limits of, or adding lanes
to, the highways. Another solution might be to use devices that segment the
network and control the flow of traffic, the same way a highway would use
devices such as stoplights to control the movement of traffic.
|
|
10.1
|
Importance of a Network Layer
|
|
|
10.1.3
|
Communication between separate networks
|
The
Internet is a collection of network segments that are tied together to
facilitate the sharing of information. Once again, a good analogy would be
the example of the highway system with the large multiple lanes that have
been constructed to interconnect many geographical regions.
Networks operate in
much the same manner, with companies known as Internet service providers
(ISPs) offering services that tie together multiple network
segments.
|
|
10.1
|
Importance of a Network Layer
|
|
|
10.1.4
|
Layer 3 network devices
|
Routers are
internetworking devices which operate at OSI Layer 3 (the network layer).
They tie together, or interconnect, network segments or entire networks.
They pass data packets between networks based on Layer 3 information.
Routers
make logical decisions regarding the best path for the delivery of data on
an internetwork and then direct packets to the appropriate output port and
segment. Routers take packets from LAN devices (e.g. workstations) and,
based on Layer 3 information, forward them through the network. In fact,
routing is sometimes referred to as Layer 3 switching.
|
|
10.2
|
Path Determination
|
|
|
10.2.1
|
Path determination
|
Path
determination
occurs at Layer 3 (network layer). It enables a router to evaluate the
available paths to a destination, and to establish the preferred handling
of a packet. Routing services use network topology information when
evaluating network paths. Path determination is the process that the router
uses to choose the next hop in the path for the packet to travel to its
destination. This process is also called routing the packet.
Path determination for
a packet can be compared to a person driving a car from one side of a city
to the other. The driver has a map that shows the streets that he/she needs
to take to get to the destination. The drive from one intersection to
another is a hop. Similarly, a router uses a map that shows the available
paths to a destination.
Routers can also make
their decisions based on the traffic density and the speed of the link
(bandwidth), just as a driver may choose a faster path (a highway) or use
less crowded back streets.
|
|
10.2
|
Path Determination
|
|
|
10.2.2
|
Network layer addressing
|
The
network address helps the router identify a path within the network cloud.
The router uses the network address to identify the destination network of
a packet within an internetwork.
In addition to the
network address, network protocols use some form of host, or node, address.
For some network layer protocols, a network administrator assigns network
host addresses according to some predetermined internetwork addressing
plan. For other network layer protocols, assigning host addresses is
partially or completely dynamic/automatic. The graphic shows three devices
in Network 1 (two workstations and a router), each with its own unique host
address. (it also shows that the router is connected to two other networks
- Networks 2 & 3).
Addressing occurs at
the network layer. Earlier analogies of a network address include the first
portions (area code and first three digits) of a telephone number. The
remaining (last four) digits of a phone number tell the phone company
equipment which specific phone to ring. This is similar to the function of
the host portion of an address. The host portion tells the router to which
specific device it should deliver a packet.
Without network layer
addressing, routing can not take place. Routers require network addresses
to ensure proper delivery of packets. Without some hierarchical addressing
structure, packets would not be able to travel across an internetwork. In a similar way, without some hierarchical structure
to telephone numbers, postal addresses, or transportation systems, there
would not be a smooth delivery of the goods and services.
|
|
10.2
|
Path Determination
|
|
|
10.2.3
|
Layer 3 and computer mobility
|
A MAC address can be
compared to your name and the network address to your mailing address. For
example, if you were to move to another town, your name would remain
unchanged, but your mailing address would indicate your new location.
Network devices (routers as well as individual computers) have both a MAC
address and a protocol (network layer) address. When
you physically move a computer to a different network, the computer
maintains the same MAC address, but you must assign it a new network
address.
|
|
10.2
|
Path Determination
|
|
|
10.2.4
|
Comparing flat and hierarchical addressing
|
The
function of the network layer is to find the best path through the network.
To accomplish this, it uses two addressing methods - flat addressing and
hierarchical addressing. A flat addressing scheme assigns a device
the next available address. There is no thought given to the structure of
the addressing scheme. An example of a flat addressing scheme would be
military identification numbering system, or a birth identification
numbering system. MAC addresses function in the same manner. A vendor is
given a block of addresses; the first half of each address is for the
vendor's code, the rest of the MAC address is a number that has been
sequentially assigned.
The postal system ZIP
codes are a good example of hierarchical addressing. In the ZIP code system
the address is determined by the location of the building, not by a
randomly assigned number. The addressing scheme that you will use
throughout this course is Internet Protocol (IP) addressing. IP addresses
have a specific structure and are not randomly assigned.
|
|
10.3
|
IP Addresses within the IP Header
|
|
|
10.3.1
|
Network layer datagrams
|
The Internet Protocol (IP) is the most popular implementation
of a hierarchical network addressing scheme. IP is the network protocol the
Internet uses. As
information flows down the layers of the OSI model, the data is
encapsulated at each layer. At the network layer, the data is encapsulated
within packets (also known as datagrams). IP determines the form of the IP
packet header (which includes addressing and other control information),
but does not concern itself with the actual data -- it accepts whatever is
passed down from the higher layers.
Figures and
explain
this further. For
more information on IP and IP addressing, visit some of these sites:
|
|
10.3
|
IP Addresses within the IP Header
|
|
|
10.3.2
|
Network layer fields
|
The
Layer 3 packet/datagram becomes the Layer 2 data, which is then
encapsulated into frames (as previously discussed). Similarly, the IP
packet consists of the data from upper layers plus an IP header, which
consists of:
- version - indicates the version of
IP currently used (4 bits)
- IP header length (HLEN) - indicates the datagram
header length in 32 bit words (4 bits)
- type-of-service - specifies the level of
importance that has been assigned by a particular upper-layer protocol
(8 bits)
- total length - specifies the length of
the entire IP packet, including data and header, in bytes (16 bits)
- identification - contains an integer that
identifies the current datagram (16 bits)
- flags - a 3-bit field in which
the 2 low-order bits control fragmentation – one bit specifying
whether the packet can be fragmented, and the second whether the
packet is the last fragment in a series of fragmented packets (3 bits)
- fragment offset - the field that is used
to help piece together datagram fragments (13 bits)
- time-to-live - maintains a counter that
gradually decreases, by increments, to zero, at which point the
datagram is discarded, keeping the packets from looping endlessly (8
bits)
- protocol - indicates which
upper-layer protocol receives incoming packets after IP processing has
been completed (8 bits)
- header checksum - helps ensure IP header
integrity (16 bits)
- source address - specifies the sending
node (32 bits)
- destination address - specifies the receiving
node (32 bits)
- options - allows IP to support
various options, such as security (variable length)
- data - contains upper-layer
information (variable length, maximum 64 Kb)
·
padding - extra zeros are added to this
field to ensure that the IP header is always a multiple of 32 bits
|
|
10.3
|
IP Addresses within the IP Header
|
|
|
10.3.3
|
IP header source and destination fields
|
The IP
address contains the information that is necessary to route a packet
through the network. Each source and destination address field contains a
32 bit address. The source address field contains the IP address of the
device that sends the packet. The destination field contains the IP address
of the device that receives the packet.
|
|
10.3
|
IP Addresses within the IP Header
|
|
|
10.3.4
|
IP address as a 32-bit binary number
|
An IP
address is represented by a 32 bit binary number. As a quick review,
remember that each binary digit can be only 0 or 1. In a binary
number, the value of the right-most bit (also called the least significant
bit) is either 0 or 1. The corresponding decimal value of each bit doubles
as you move left in the binary number. So the decimal value
of the 2nd bit from the right is either 0 or 2. The third
bit is either 0 or 4, the fourth bit 0 or 8, etc ...
IP addresses are
expressed as dotted-decimal numbers - we break up the 32 bits of the
address into four octets (an octet is a group of 8 bits). The maximum decimal value of each octet is 255. The
largest 8 bit binary number is 11111111. Those bits, from left to right,
have decimal values of 128, 64, 32, 16, 8, 4, 2, and 1. Added together,
they total 255.
What is the decimal
value of the highlighted octet in the graphic? What is the value of the bit
on the far left side? The next bit? Since those are the only 2 bits on (or
set), then the decimal value is 128+64=192!
|
|
10.3
|
IP Addresses within the IP Header
|
|
|
10.3.5
|
IP address component fields
|
The
network number of an IP address identifies the network to which a device is
attached. The host portion of an IP address identifies the specific device
on that network. Because IP addresses consist of four octets
separated by dots, one, two, or three of these octets may be used to
identify the network number. Similarly, up to three of these octets may be
used to identify the host portion of an IP address.
|
|
10.4
|
IP Address Classes
|
|
|
10.4.1
|
IP address classes
|
There are three classes
of IP addresses that an organization can receive from the American Registry
for Internet Numbers (ARIN) (or the organization's ISP). They are Class A,
B, and C. ARIN
now reserves Class A addresses for governments throughout the world
(although a few large companies, such as Hewlett Packard, have received one
in the past) and Class B addresses for medium-sized companies. All other
requestors are issued Class C addresses.
|
|
Class A
When written in a binary format, the first (leftmost) bit of a Class A address
is always 0. An example of a Class A IP address is 124.95.44.15. The first
octet, 124, identifies the network number assigned by ARIN. The internal
administrators of the network assign the remaining 24 bits. An easy way to
recognize whether a device is part of a Class A network is to look at the first
octet of its IP address, which will range from 0-126. (127 does start
with a 0 bit, but has been reserved for special purposes.)
All Class A IP addresses
use only the first 8 bits to identify the network part of the address. The
remaining three octets can be used for the host portion of the address. Every
network that uses a Class A IP address can have assigned up to 2 to-the-power
of 24 (224) (minus 2), or 16,777,214, possible IP addresses to
devices that are attached to its network.
Class B
The first 2 bits of a Class B address are always 10 (one and zero). An example
of a Class B IP address is 151.10.13.28. The first two octets identify the
network number assigned by ARIN. The internal administrators of the network
assign the remaining 16 bits. An easy way to recognize whether a device is part
of a Class B network is to look at the first octet of its IP address. Class B
IP addresses always have values ranging from 128 to 191 in their first octet.
All Class B IP addresses
use the first 16 bits to identify the network part of the address. The two
remaining octets of the IP address can be used for the host portion of the
address. Every network that uses a Class B IP address can have assigned up to 2
to-the-power of 16 (216) (minus 2 again!), or 65,534, possible IP
addresses to devices that are attached to its network.
Class C
The first 3 bits of a Class C address are always 110 (one, one and zero). An
example of a Class C IP address is 201.110.213.28. The first three octets
identify the network number assigned by ARIN. The internal administrators of
the network assign the remaining 8 bits . An easy way to recognize whether
a device is part of a Class C network is to look at the first octet of its IP
address. Class C IP addresses always have values
ranging from 192 to 223 in their first octet.
All Class C IP addresses
use the first 24 bits to identify the network part of the address. Only the
last octet of a Class C IP address can be used for the host portion of the
address. Every network that uses a Class C IP address can have assigned up to 28
(minus 2), or 254, possible IP addresses to devices that are attached to its
network.
10.4
|
IP Address Classes
|
|
|
10.4.2
|
IP addresses as decimal numbers
|
IP addresses identify a
device on a network and the network to which it is attached. To make them
easy to remember, IP addresses are usually written in dotted decimal
notation. Therefore, IP addresses are 4 decimal numbers separated by dots.
An example of this is the address 166.122.23.130. Keep in mind that a
decimal number is a base 10 number, the type we use in everyday life.
|
|
10.4
|
IP Address Classes
|
|
|
10.4.3
|
Binary and decimal conversion review
|
Each
place in an octet represents a different power of 2. As in the Base 10
number system, the powers increase from right to left.
Figure
illustrates a method for converting binary numbers to decimal numbers.
Figure allows
you to practice your conversion skills.
Figure
illustrates a method for converting decimal numbers to binary numbers.
Figure allows
you to practice your conversion skills.
Example:
10010000
(Work from right to left).
0 x 20
|
=
|
0
|
0 x 21
|
=
|
0
|
0 x 22
|
=
|
0
|
0 x 23
|
=
|
0
|
1 x 24
|
=
|
16
|
0 x 25
|
=
|
0
|
0 x 26
|
=
|
0
|
1 x 27
|
=
|
128
|
__________
|
Total
|
=
|
144
|
In this example, there
are 0 values of 20; 0 values of 21; 0 values of 22;
0 values of 23; 1 value of 24; 0 values of 25;
0 values of 26; and 1 value of 27. There are no 1s,
no 2s, no 4s, no 8s, one 16s, no 32s, no 64, and one 128. Added together,
the values total 144, therefore, the binary number 10010000 equals the
decimal number 144.
|
|
10.4
|
IP Address Classes
|
|
|
10.4.4
|
Converting decimal IP addresses to binary equivalents.
|
In
order to convert decimal IP addresses to binary numbers you must know the
decimal values of each of the 8 bits in each octet. Starting with the bit
that is on the left side of the octet, the values start at 128 and are
reduced by half each time you move 1 bit to the right, continuing to a
value of 1 on the right side of the octet.. The conversion below
illustrates the first octet only.
Example:
Convert the first octet of 192.57.30.224 to a binary format.
128
|
+64
|
+0
|
+0
|
+0
|
+0
|
+0
|
+0
|
=
|
192
|
27
|
26
|
25
|
24
|
23
|
22
|
21
|
20
|
|
|
1
|
1
|
0
|
0
|
0
|
0
|
0
|
0
|
=
|
11000000
|
The first step is to
select the octet on the far left and determine whether the value is greater
than 128. In this instance (192), it is. Then place a 1 in the first bit
and subtract 128 from 192. The remainder is 64. The value of the next bit
is 64, which is equal to the value of the remainder, so that bit would be 1
as well. Subtract 64 from 64. The remainder is 0, therefore the remaining
bits would all be 0. The binary number for the first octet would be
11000000.
Exercise:
Convert the remaining octets (57, 30, 224), in the IP address, to binary
format.
|
|
10.4
|
IP Address Classes
|
|
|
10.4.5
|
Converting binary IP addresses to decimal equivalents
|
To convert binary IP
addresses to decimal numbers, use the opposite approach you used to convert
decimal numbers to binary numbers.
Example:
Convert the first octet of the binary IP address
10101010.11111111.00000000.11001101 to a dotted decimal number.
1
|
0
|
1
|
0
|
1
|
0
|
1
|
0
|
|
|
27
|
26
|
25
|
24
|
23
|
22
|
21
|
20
|
|
|
128
|
0
|
32
|
0
|
8
|
0
|
2
|
0
|
=
|
128 +
32 + 8 + 2 = 170
|
To convert this IP
address, start with the bit that is on the far left side in the first
octet. It is 1. You know that the value of a bit
in that position is 128, therefore the decimal number starts with a value
of 128. The next value is 0, so skip it. The third value is 1; any bit in
that position has a value of 32; therefore, you add 32 to 128 to get 160. The
fourth bit is 0, so skip it. The fifth bit is 1, which means that you add 8
to the current total of 160, giving you a new total of 168. The sixth bit
is also 0, so skip it and the seventh bit is 1, which means add 2 to the
current total of 168. The last bit is 0, so you can skip it.
|
|