Network Layer (Part IV)
Network Layer (Part IV)
Overview
• A router is a type of internetworking
device that passes data packets between
networks based on Layer 3 addresses.
•
A router has the ability to make
intelligent decisions regarding the best
path for delivery of data on the network.
• In this chapter, you will learn how routers
use a Layer 3 addressing scheme to
make forwarding decisions.
Overview
• In addition, you will learn how devices on local-area
networks (LANs) use Address Resolution Protocol
(ARP) before forwarding data to a destination.
• You will learn what happens when a device on one
network does not know the MAC address of a device
on another network.
• You will learn that Reverse Address Resolution
Protocol (RARP) is the protocol a device uses when
it does not know its own IP address.
• Lastly, you will learn the diference between routing
and routed protocols and how routers track distance
between locations.
• You will also learn about distance-vector, link-state,
and hybrid routing approaches and how each
resolves common routing problems.
Layer 3 Devices : Routers
• In networking, there are two addressing schemes:
one uses the MAC address, a data link (Layer 2)
address; the other uses an address located at the
network layer (Layer 3) of the OSI model.
• An example of a Layer 3 address is an IP address.
A router is a type of internetworking device that
passes data packets between networks, based on
Layer 3 addresses.
• A router has the ability to make intelligent
decisions regarding the best path for delivery of
data on the network
Layer 3 Devices : Routers
Layer 3 Devices : Routers
Layer 3 Devices : Layer 3
addresses
• Bridges and switches use physical, or MAC
addresses, to make data forwarding decisions.
• Routers use a Layer 3 addressing scheme to
make forwarding decisions.
• They use IP, or logical addresses, rather than
MAC addresses.
• Because IP addresses are implemented in
software, and refer to the network on which a
device is located, sometimes these Layer 3
addresses are referred to as protocol
addresses, or network addresses
Layer 3 Devices : Layer 3
addresses
• Physical, or MAC addresses, are usually assigned by
the NIC manufacturer and are hard-coded into the
NIC.
• The network administrator usually assigns IP
addresses.
• In fact, it is not unusual for a network administrator
to group devices together in the IP addressing
scheme, according to their geographical location,
department, or foor within a building.
• Because they are implemented in software, IP
addresses are fairly easy to change.
• Finally, bridges and switches are primarily used to
connect segments of a network.
• Routers are used to connect separate networks and
Layer 3 Devices : Layer 3
addresses
Layer 3 Devices : Layer 3
addresses
Layer 3 Devices : Unique
network numbers
• Routers connect two or more
networks, each of which must have a
unique network number in order for
routing to be successful.
• The unique network number is
incorporated into the IP address that
is assigned to each device attached
to that network.
Layer 3 Devices : Unique
network numbers
• Example:
A network has a unique network
number - A. It has four devices
attached to it. The IP addresses of
the devices are A2, A3, A4, and A5.
Since the interface where the router
connects to a network is considered
to be part of that network, the
interface where the router connects
to network A has an IP address of A1
Layer 3 Devices : Unique
network numbers
• Example:
Another network, with a unique
network number - B - has four
devices attached to it. This network
is also attached to the same router,
but at a diferent interface. The IP
addresses of the devices on this
second network are B1, B2, B3, and
B4. The IP address of the router's
second interface is B5.
Layer 3 Devices : Unique
network numbers
• Example:
You want to send data from one network to another. The
source network is A; the destination network is B; and a
router is connected to networks A, B, C, and D. When
data (frames), coming from network A, reaches the
router, the router performs the following functions:
– It strips of the data link header, carried by the frame. (The
data link header contains the MAC addresses of the source and
destination.)
– It examines the network layer address to determine the
destination network.
– It consults its routing tables to determine which of its interfaces
it will use to send the data, in order for it to reach its
destination network.
Layer 3 Devices : Unique
network numbers
• In
the
example,
the
router
determines that it should send the
data from network A to network B,
from its interface, with address B5.
Before actually sending the data out
interface B5, the router would
encapsulate
the
data
in
the
appropriate data link frame.
Layer 3 Devices : Unique
network numbers
Layer 3 Devices : Unique
network numbers
Layer 3 Devices : Unique
network numbers
Layer 3 Devices : Router
interface/port
• A router’s attachment to a network is
called an interface; it may also be
referred to as a port.
• In IP routing, each interface must
have a separate, unique network (or
subnetwork) address.
Layer 3 Devices : Router
interface/port
Network-to-Network Communications :
Methods for assigning an IP address
• After you have determined the addressing
scheme for a network, you must choose
the method for assigning addresses to
hosts.
• There are essentially two methods for
assigning IP addresses - static addressing
and dynamic addressing.
• Regardless of which addressing scheme
you use, no two interfaces can have the
same IP address.
Network-to-Network Communications :
Methods for assigning an IP address
Static Addressing
If you assign IP addresses statically, you must go to each
individual device and confgure it with an IP address.
• This method requires you to keep very meticulous records,
because problems can occur on the network if you use
duplicate IP addresses.
• Some operating systems, such as Windows 95 and
Windows NT, send an ARP request to check for a duplicate
IP address when they attempt to initialize TCP/IP.
• If they discover a duplicate, the operating systems will not
initialize TCP/IP and will generate an error message.
• Record keeping is important too, because not all operating
systems identify duplicate IP addresses.
Network-to-Network Communications :
Methods for assigning an IP address
• Dynamic
Addressing
There are a few diferent methods that you can use to
assign IP addresses dynamically. Examples of these
are:
• Reverse Address Resolution Protocol (RARP)
Reverse address resolution protocol (RARP) binds MAC
addresses to IP addresses. This binding allows some
network devices to encapsulate data before sending
them out on the network. A network device such as a
diskless workstation might know its MAC address, but
not its IP address. Devices using RARP require that a
RARP server be present on the network to answer
RARP requests.
Network-to-Network Communications :
Methods for assigning an IP address
• Let's look at an example where a source device wants to
send data to another device.
• In our example the source knows its own MAC address,
but is unable to locate its own IP address in its ARP table.
• In order for the destination device to retrieve the data,
pass it to higher layers of the OSI model, and respond to
the originating device, the source must include both its
MAC address and IP address.
• Therefore, the source initiates a process called a RARP
request, which helps it detect its own IP address. The
device builds a RARP request packet and sends it out on
the network. To ensure that all devices see the RARP
request on the network, it uses a broadcast IP address.
Network-to-Network Communications :
Methods for assigning an IP address
• RARP uses the same packet format as ARP. But in a
RARP request, the MAC headers, IP headers, and
"operation code" are diferent from an ARP request.
• The RARP packet format contains places for MAC
addresses of both destination and source.
• The source IP address feld is empty. The broadcast
goes to all devices on the network; therefore the
destination IP address will be set to all binary 1s.
• Workstations running RARP have codes in ROM that
direct them to start the RARP process, and locate
the RARP server.
Network-to-Network Communications :
Methods for assigning an IP address
• BOOTstrap Protocol (BOOTP)
A device uses BOOTstrap protocol (BOOTP) when
it starts up, to obtain an IP address.
• BOOTP uses UDP to carry messages; the UDP
message is encapsulated in an IP datagram.
• A computer uses BOOTP to send a broadcast IP
datagram (using a destination IP address of all
1s - 255.255.255.255).
• A BOOTP server receives the broadcast and then
sends a broadcast. The client receives a
datagram and checks the MAC address.
Network-to-Network Communications :
Methods for assigning an IP address
• If it fnds its own MAC address in the destination address
feld, then it takes the IP address in that datagram.
• Like RARP, BOOTP operates in a client-server
environment, and only requires a single packet exchange.
• However, unlike RARP, which only sends back a 4 octet IP
address, BOOTP datagrams can include the IP address,
the address of a router (default gateway), the address of
a server, and a vendor-specifc feld.
• One of the problems with BOOTP is that it was not
designed to provide dynamic address assignment.
• With BOOTP you create a confguration fle that specifes
the parameters for each device.
Network-to-Network Communications :
Methods for assigning an IP address
• Dynamic Host Confguration Protocol (DHCP)
Dynamic host confguration protocol (DHCP) has been
proposed as a successor to BOOTP.
• Unlike BOOTP, DHCP allows a host to obtain an IP address
quickly and dynamically.
• All that is required using DHCP is a defned range of IP
addresses on a DHCP server. As hosts come online they
contact the DHCP server and request an address.
• The DHCP server chooses an address and allocates it to
that host.
• With DHCP, the entire computer’s confguration can be
obtained in one message (e.g. along with the IP address,
the server can also send a subnet mask).
Network-to-Network Communications :
Methods for assigning an IP address
Network-to-Network Communications :
Methods for assigning an IP address
Network-to-Network Communications :
DHCP initialization sequence
• When a DHCP client boots, it enters an initialize
state. It sends DHCPDISCOVER broadcast
messages, which are UDP packets with the port
number set to the BOOTP port.
• After sending the DHCPDISCOVER packets, the
client moves into the select state and collects
DHCPOFFER responses from DHCP server.
• The client then selects the frst response it
receives and negotiates lease time (the length of
time it can keep the address without renewing it)
with
the
DHCP
server
by
sending
a
DHCPREQUEST packet.
• The DHCP server acknowledges a client request
with a DHCPACK packet.
Network-to-Network Communications :
DHCP initialization sequence
Network-to-Network
Communications :
IP key components
• In order for devices to communicate, the sending
devices need both, the IP addresses and the
MAC addresses, of the destination devices.
• When they try to communicate with devices
whose IP addresses they know, they must
determine the MAC addresses.
• The TCP/IP suite has a protocol, called ARP, that
can automatically obtain the MAC address.
• ARP enables a computer to fnd the MAC address
of the computer that is associated with an IP
address.
Network-to-Network Communications :
IP key components
• Note: The basic unit of data transfer in IP is the
IP packet.
• Packet processing occurs in software, which
means that content and format are not
hardware dependent.
• A packet is divided into two major components:
the header, which includes source and
destination addresses; and the data.
• Other types of protocols have their own
formats. The IP packet is unique to IP.
Network-to-Network Communications :
IP key components
• Note: Another major component of IP is Internet
Control Message Protocol (ICMP).
• This protocol is used by a device to report a
problem to the sender of a message.
• For example, if a router receives a packet that it
cannot deliver, it sends a message back to the
sender of the packet.
• One of the many features of ICMP is echorequest/echo-reply, which is a component that
tests whether a packet can reach a destination
by pinging the destination.
Network-to-Network Communications :
IP key components
Network-to-Network Communications : Function
of the address resolution protocol (ARP)
• Layer 3 protocols determine whether data passes
beyond the network layer to higher levels of the OSI
model.
• A data packet must contain both, a destination MAC
address and a destination IP address.
• If it lacks one or the other, the data will not pass from
Layer 3 to the upper layers.
• In this way, MAC addresses and IP addresses act as
checks and balances for each other.
• After devices determine the IP addresses of the
destination devices, they can add the destination
MAC addresses to the data packets.
Network-to-Network Communications : Function
of the address resolution protocol (ARP)
• There are a variety of ways that devices can
determine the MAC addresses they need to
add to the encapsulated data.
• Some keep tables that contain all the MAC
addresses and IP addresses of other devices
that are connected to the same LAN.
• They are called Address Resolution Protocol
(ARP) tables, and they map IP addresses to
the corresponding MAC addresses.
Network-to-Network Communications : Function
of the address resolution protocol (ARP)
• ARP tables are sections of RAM memory, in
which the cached memory is maintained
automatically on each of the devices.
• It is a rare occasion when you must make an
ARP table entry manually.
• Each computer on a network maintains its
own ARP table.
• Whenever a network device wants to send
data across a network, it uses information
provided by its ARP table.
Network-to-Network Communications : Function
of the address resolution protocol (ARP)
• When a source determines the IP address for a
destination, the source consults its ARP table in
order to locate the MAC address for the
destination.
• If the source locates an entry in its table
(destination IP address to destination MAC
address), it binds, or associates, the IP address to
the MAC address and uses it to encapsulate the
data.
• The data packet is then sent out over the
networking media to be picked up by the
destination.
Network-to-Network Communications : Function
of the address resolution protocol (ARP)
Network-to-Network Communications : Function
of the address resolution protocol (ARP)
Overview
• A router is a type of internetworking
device that passes data packets between
networks based on Layer 3 addresses.
•
A router has the ability to make
intelligent decisions regarding the best
path for delivery of data on the network.
• In this chapter, you will learn how routers
use a Layer 3 addressing scheme to
make forwarding decisions.
Overview
• In addition, you will learn how devices on local-area
networks (LANs) use Address Resolution Protocol
(ARP) before forwarding data to a destination.
• You will learn what happens when a device on one
network does not know the MAC address of a device
on another network.
• You will learn that Reverse Address Resolution
Protocol (RARP) is the protocol a device uses when
it does not know its own IP address.
• Lastly, you will learn the diference between routing
and routed protocols and how routers track distance
between locations.
• You will also learn about distance-vector, link-state,
and hybrid routing approaches and how each
resolves common routing problems.
Layer 3 Devices : Routers
• In networking, there are two addressing schemes:
one uses the MAC address, a data link (Layer 2)
address; the other uses an address located at the
network layer (Layer 3) of the OSI model.
• An example of a Layer 3 address is an IP address.
A router is a type of internetworking device that
passes data packets between networks, based on
Layer 3 addresses.
• A router has the ability to make intelligent
decisions regarding the best path for delivery of
data on the network
Layer 3 Devices : Routers
Layer 3 Devices : Routers
Layer 3 Devices : Layer 3
addresses
• Bridges and switches use physical, or MAC
addresses, to make data forwarding decisions.
• Routers use a Layer 3 addressing scheme to
make forwarding decisions.
• They use IP, or logical addresses, rather than
MAC addresses.
• Because IP addresses are implemented in
software, and refer to the network on which a
device is located, sometimes these Layer 3
addresses are referred to as protocol
addresses, or network addresses
Layer 3 Devices : Layer 3
addresses
• Physical, or MAC addresses, are usually assigned by
the NIC manufacturer and are hard-coded into the
NIC.
• The network administrator usually assigns IP
addresses.
• In fact, it is not unusual for a network administrator
to group devices together in the IP addressing
scheme, according to their geographical location,
department, or foor within a building.
• Because they are implemented in software, IP
addresses are fairly easy to change.
• Finally, bridges and switches are primarily used to
connect segments of a network.
• Routers are used to connect separate networks and
Layer 3 Devices : Layer 3
addresses
Layer 3 Devices : Layer 3
addresses
Layer 3 Devices : Unique
network numbers
• Routers connect two or more
networks, each of which must have a
unique network number in order for
routing to be successful.
• The unique network number is
incorporated into the IP address that
is assigned to each device attached
to that network.
Layer 3 Devices : Unique
network numbers
• Example:
A network has a unique network
number - A. It has four devices
attached to it. The IP addresses of
the devices are A2, A3, A4, and A5.
Since the interface where the router
connects to a network is considered
to be part of that network, the
interface where the router connects
to network A has an IP address of A1
Layer 3 Devices : Unique
network numbers
• Example:
Another network, with a unique
network number - B - has four
devices attached to it. This network
is also attached to the same router,
but at a diferent interface. The IP
addresses of the devices on this
second network are B1, B2, B3, and
B4. The IP address of the router's
second interface is B5.
Layer 3 Devices : Unique
network numbers
• Example:
You want to send data from one network to another. The
source network is A; the destination network is B; and a
router is connected to networks A, B, C, and D. When
data (frames), coming from network A, reaches the
router, the router performs the following functions:
– It strips of the data link header, carried by the frame. (The
data link header contains the MAC addresses of the source and
destination.)
– It examines the network layer address to determine the
destination network.
– It consults its routing tables to determine which of its interfaces
it will use to send the data, in order for it to reach its
destination network.
Layer 3 Devices : Unique
network numbers
• In
the
example,
the
router
determines that it should send the
data from network A to network B,
from its interface, with address B5.
Before actually sending the data out
interface B5, the router would
encapsulate
the
data
in
the
appropriate data link frame.
Layer 3 Devices : Unique
network numbers
Layer 3 Devices : Unique
network numbers
Layer 3 Devices : Unique
network numbers
Layer 3 Devices : Router
interface/port
• A router’s attachment to a network is
called an interface; it may also be
referred to as a port.
• In IP routing, each interface must
have a separate, unique network (or
subnetwork) address.
Layer 3 Devices : Router
interface/port
Network-to-Network Communications :
Methods for assigning an IP address
• After you have determined the addressing
scheme for a network, you must choose
the method for assigning addresses to
hosts.
• There are essentially two methods for
assigning IP addresses - static addressing
and dynamic addressing.
• Regardless of which addressing scheme
you use, no two interfaces can have the
same IP address.
Network-to-Network Communications :
Methods for assigning an IP address
Static Addressing
If you assign IP addresses statically, you must go to each
individual device and confgure it with an IP address.
• This method requires you to keep very meticulous records,
because problems can occur on the network if you use
duplicate IP addresses.
• Some operating systems, such as Windows 95 and
Windows NT, send an ARP request to check for a duplicate
IP address when they attempt to initialize TCP/IP.
• If they discover a duplicate, the operating systems will not
initialize TCP/IP and will generate an error message.
• Record keeping is important too, because not all operating
systems identify duplicate IP addresses.
Network-to-Network Communications :
Methods for assigning an IP address
• Dynamic
Addressing
There are a few diferent methods that you can use to
assign IP addresses dynamically. Examples of these
are:
• Reverse Address Resolution Protocol (RARP)
Reverse address resolution protocol (RARP) binds MAC
addresses to IP addresses. This binding allows some
network devices to encapsulate data before sending
them out on the network. A network device such as a
diskless workstation might know its MAC address, but
not its IP address. Devices using RARP require that a
RARP server be present on the network to answer
RARP requests.
Network-to-Network Communications :
Methods for assigning an IP address
• Let's look at an example where a source device wants to
send data to another device.
• In our example the source knows its own MAC address,
but is unable to locate its own IP address in its ARP table.
• In order for the destination device to retrieve the data,
pass it to higher layers of the OSI model, and respond to
the originating device, the source must include both its
MAC address and IP address.
• Therefore, the source initiates a process called a RARP
request, which helps it detect its own IP address. The
device builds a RARP request packet and sends it out on
the network. To ensure that all devices see the RARP
request on the network, it uses a broadcast IP address.
Network-to-Network Communications :
Methods for assigning an IP address
• RARP uses the same packet format as ARP. But in a
RARP request, the MAC headers, IP headers, and
"operation code" are diferent from an ARP request.
• The RARP packet format contains places for MAC
addresses of both destination and source.
• The source IP address feld is empty. The broadcast
goes to all devices on the network; therefore the
destination IP address will be set to all binary 1s.
• Workstations running RARP have codes in ROM that
direct them to start the RARP process, and locate
the RARP server.
Network-to-Network Communications :
Methods for assigning an IP address
• BOOTstrap Protocol (BOOTP)
A device uses BOOTstrap protocol (BOOTP) when
it starts up, to obtain an IP address.
• BOOTP uses UDP to carry messages; the UDP
message is encapsulated in an IP datagram.
• A computer uses BOOTP to send a broadcast IP
datagram (using a destination IP address of all
1s - 255.255.255.255).
• A BOOTP server receives the broadcast and then
sends a broadcast. The client receives a
datagram and checks the MAC address.
Network-to-Network Communications :
Methods for assigning an IP address
• If it fnds its own MAC address in the destination address
feld, then it takes the IP address in that datagram.
• Like RARP, BOOTP operates in a client-server
environment, and only requires a single packet exchange.
• However, unlike RARP, which only sends back a 4 octet IP
address, BOOTP datagrams can include the IP address,
the address of a router (default gateway), the address of
a server, and a vendor-specifc feld.
• One of the problems with BOOTP is that it was not
designed to provide dynamic address assignment.
• With BOOTP you create a confguration fle that specifes
the parameters for each device.
Network-to-Network Communications :
Methods for assigning an IP address
• Dynamic Host Confguration Protocol (DHCP)
Dynamic host confguration protocol (DHCP) has been
proposed as a successor to BOOTP.
• Unlike BOOTP, DHCP allows a host to obtain an IP address
quickly and dynamically.
• All that is required using DHCP is a defned range of IP
addresses on a DHCP server. As hosts come online they
contact the DHCP server and request an address.
• The DHCP server chooses an address and allocates it to
that host.
• With DHCP, the entire computer’s confguration can be
obtained in one message (e.g. along with the IP address,
the server can also send a subnet mask).
Network-to-Network Communications :
Methods for assigning an IP address
Network-to-Network Communications :
Methods for assigning an IP address
Network-to-Network Communications :
DHCP initialization sequence
• When a DHCP client boots, it enters an initialize
state. It sends DHCPDISCOVER broadcast
messages, which are UDP packets with the port
number set to the BOOTP port.
• After sending the DHCPDISCOVER packets, the
client moves into the select state and collects
DHCPOFFER responses from DHCP server.
• The client then selects the frst response it
receives and negotiates lease time (the length of
time it can keep the address without renewing it)
with
the
DHCP
server
by
sending
a
DHCPREQUEST packet.
• The DHCP server acknowledges a client request
with a DHCPACK packet.
Network-to-Network Communications :
DHCP initialization sequence
Network-to-Network
Communications :
IP key components
• In order for devices to communicate, the sending
devices need both, the IP addresses and the
MAC addresses, of the destination devices.
• When they try to communicate with devices
whose IP addresses they know, they must
determine the MAC addresses.
• The TCP/IP suite has a protocol, called ARP, that
can automatically obtain the MAC address.
• ARP enables a computer to fnd the MAC address
of the computer that is associated with an IP
address.
Network-to-Network Communications :
IP key components
• Note: The basic unit of data transfer in IP is the
IP packet.
• Packet processing occurs in software, which
means that content and format are not
hardware dependent.
• A packet is divided into two major components:
the header, which includes source and
destination addresses; and the data.
• Other types of protocols have their own
formats. The IP packet is unique to IP.
Network-to-Network Communications :
IP key components
• Note: Another major component of IP is Internet
Control Message Protocol (ICMP).
• This protocol is used by a device to report a
problem to the sender of a message.
• For example, if a router receives a packet that it
cannot deliver, it sends a message back to the
sender of the packet.
• One of the many features of ICMP is echorequest/echo-reply, which is a component that
tests whether a packet can reach a destination
by pinging the destination.
Network-to-Network Communications :
IP key components
Network-to-Network Communications : Function
of the address resolution protocol (ARP)
• Layer 3 protocols determine whether data passes
beyond the network layer to higher levels of the OSI
model.
• A data packet must contain both, a destination MAC
address and a destination IP address.
• If it lacks one or the other, the data will not pass from
Layer 3 to the upper layers.
• In this way, MAC addresses and IP addresses act as
checks and balances for each other.
• After devices determine the IP addresses of the
destination devices, they can add the destination
MAC addresses to the data packets.
Network-to-Network Communications : Function
of the address resolution protocol (ARP)
• There are a variety of ways that devices can
determine the MAC addresses they need to
add to the encapsulated data.
• Some keep tables that contain all the MAC
addresses and IP addresses of other devices
that are connected to the same LAN.
• They are called Address Resolution Protocol
(ARP) tables, and they map IP addresses to
the corresponding MAC addresses.
Network-to-Network Communications : Function
of the address resolution protocol (ARP)
• ARP tables are sections of RAM memory, in
which the cached memory is maintained
automatically on each of the devices.
• It is a rare occasion when you must make an
ARP table entry manually.
• Each computer on a network maintains its
own ARP table.
• Whenever a network device wants to send
data across a network, it uses information
provided by its ARP table.
Network-to-Network Communications : Function
of the address resolution protocol (ARP)
• When a source determines the IP address for a
destination, the source consults its ARP table in
order to locate the MAC address for the
destination.
• If the source locates an entry in its table
(destination IP address to destination MAC
address), it binds, or associates, the IP address to
the MAC address and uses it to encapsulate the
data.
• The data packet is then sent out over the
networking media to be picked up by the
destination.
Network-to-Network Communications : Function
of the address resolution protocol (ARP)
Network-to-Network Communications : Function
of the address resolution protocol (ARP)