nw layer
nw layer
7
• Switching: Packet Switching - Internet protocol - IPV4 – IP Addressing
– Subnetting - IPV6, ARP, RARP, ICMP, DHCP
• The network layer in the TCP/IP
protocol suite is responsible for the
host-to-host delivery of messages.
• It provides services to the transport
layer and receives services from the
data-link layer.
• Figure shows the communication between Alice and
Bob at the network layer.
• At the source host, the network layer encapsulates data
received from the transport layer in a network layer
packet.
• At the destination host, the network layer decapsulates
data from the network layer and delivers it to the
transport layer.
• The routers do not do any encapsulation or
decapsulation unless in some special cases when the
packet needs to be fragmented.
• Communication at the network layer
• SERVICES
• Packetizing
• The first duty of the network layer is definitely
packetizing: encapsulating the payload (data received from
the upper layer) in a network-layer packet at the source and
decapsulating the payload from the network-layer packet at
the destination.
• In other words, one duty of the network layer is to carry a
payload from the source to the destination without
changing it or using it.
• The network layer is doing the service of a carrier such as
the postal office, which is responsible for delivery of
packages from a sender to a receiver without changing or
using the contents.
• The source host receives the payload from an upper-layer
protocol, adds a header that contains the source and
destination addresses and some other information that is
required by the network-layer protocol (as discussed later),
and delivers the packet to the data-link layer.
• The destination host receives the network-layer packet from
its datalink layer, decapsulates the packet, and delivers the
payload to the corresponding upper-layer protocol.
• If the packet is fragmented at the source or at routers along
the path, the network layer is responsible for waiting until all
fragments arrive, reassembling them, and delivering them to
the upper layer protocol.
• Routing
• The network layer is responsible for routing a network-
layer packet from its source to the destination.
• A physical network is a combination of networks (LANs
and WANs) and routers that connect them.
• This means that there is more than one route from the
source to the destination.
• The network layer is responsible for finding the best one
among these possible routes.
• The network layer needs to have some specific strategies
for defining the best route.
Error Control
• Although error control also can be implemented in the network
layer, the designers of the network layer in the Internet ignored
this issue for the data being carried by the network layer.
• One reason for this decision is the fact that the packet in the
network layer may be fragmented at each router, which makes
error checking at this layer inefficient.
• The designers of the network layer, however, have added a
checksum field to the datagram to control any corruption in the
header, but not the whole datagram.
• This checksum may prevent any changes or corruptions in the
header of the datagram between two hops and from end to end.
Flow Control
• Flow control regulates the amount of data a source can
send without overwhelming the receiver.
• If the upper layer at the source computer produces data
faster than the upper layer at the destination computer
can consume it, the receiver will be overwhelmed with
data.
• To control the flow of data, the receiver needs to send
some feedback to the sender to inform the latter that it
is overwhelmed with data.
Congestion Control
• Another issue in a network-layer protocol is congestion control.
• Congestion in the network layer is a situation in which too many
datagrams are present in an area of the Internet.
• Congestion may occur if the number of datagrams sent by source
computers is beyond the capacity of the network or routers.
• In this situation, some routers may drop some of the datagrams.
• However, as more datagrams are dropped, the situation may become worse
because, due to the error-control mechanism at the upper layers, the sender
may send duplicates of the lost packets.
• If the congestion continues, sometimes a situation may reach a point where
the system collapses and no datagrams are delivered.
Quality of Service
• As the Internet has allowed new applications such as multimedia
communication (in particular real-time communication of audio and
video), the quality of service (QoS) of the communication has become
more and more important.
• The Internet has thrived by providing better quality of service to
support these applications.
• However, to keep the network layer untouched, these provisions are
mostly implemented in the upper layer.
Security
• Another issue related to communication at the network layer
is security.
• Security was not a concern when the Internet was originally
designed because it was used by a small number of users at
universities for research activities; other people had no access
to the Internet.
• The network layer was designed with no security provision.
• Today, however, security is a big concern.
• To provide security for a connectionless network layer, we
need to have another virtual level that changes the
connectionless service to a connection-oriented service.
PACKET SWITCHING
• A router, in fact, is a switch that creates a connection between an
input port and an output port (or a set of output ports), just as an
electrical switch connects the input to the output to let electricity
flow.
• Although in data communications switching techniques are divided
into two broad categories, circuit switching and packet switching,
only packet switching is used at the network layer because the unit
of data at this layer is a packet.
• At the network layer, a message from the upper layer is divided into
manageable packets and each packet is sent through the network.
• The source of the message sends the packets one by one; the
destination of the message receives the packets one by one.
• The destination waits for all packets belonging to the same
message to arrive before delivering the message to the upper
layer.
• The connecting devices in a packet-switched network still
need to decide how to route the packets to the final
destination.
• Today, a packet switched network can use two different
approaches to route the packets: the datagram approach and
the virtual-circuit approach.
Datagram Approach: Connectionless Service
• When the Internet started, to make it simple, the network
layer was designed to provide a connectionless service in
which the network-layer protocol treats each packet
independently, with each packet having no relationship to
any other packet.
• The idea was that the network layer is only responsible for
delivery of packets from the source to the destination.
• In this approach, the packets in a message may or may not
travel the same path to their destination.
• When the network layer provides a connectionless
service, each packet traveling in the Internet is an
independent entity; there is no relationship between
packets belonging to the same message.
• The switches in this type of network are called routers.
• A packet belonging to a message may be followed by a
packet belonging to the same message or to a different
message.
• A packet may be followed by a packet coming from the
same source or from a different source.
• Each packet is routed based on the information
contained in its header: source and destination
addresses.
• The destination address defines where it should go; the
source address defines where it comes from.
• The router in this case routes the packet based only on
the destination address.
• The source address may be used to send an error
message to the source if the packet is discarded.
Virtual-Circuit Approach: Connection- Oriented Service
• In a connection-oriented service (also called a virtual-circuit
approach), there is a relationship between all packets belonging to
a message.
• Before all datagrams in a message can be sent, a virtual connection
should be set up to define the path for the datagrams.
• After connection setup, the datagrams can all follow the same path.
• In this type of service, not only must the packet contain the source
and destination addresses, it must also contain a flow label, a
virtual-circuit identifier that defines the virtual path the packet
should follow.
• Although it looks as though the use of the label may make
the source and destination addresses unnecessary during the
data transfer phase, parts of the Internet at the network layer
still keep these addresses.
• One reason is that part of the packet path may still be using
the connectionless service.
• Another reason is that the protocol at the network layer is
designed with these addresses, and it may take a while before
they can be changed.
PERFORMANCE
• The upper-layer protocols that use the service of the
network layer expect to receive an ideal service, but
the network layer is not perfect.
• The performance of a network can be measured in
terms of delay, throughput, and packet loss.
• Congestion control is an issue that can improve the
performance.
Delay
• All of us expect an instantaneous response from a
network, but a packet, from its source to its
destination, encounters delays.
• The delays in a network can be divided into four
types: transmission delay, propagation delay,
processing delay, and queuing delay.
• Let us first discuss each of these delay types and
then show how to calculate a packet delay from the
source to the destination.
Transmission Delay
• A source host or a router cannot send a packet instantaneously.
• A sender needs to put the bits in a packet on the line one by one.
• If the first bit of the packet is put on the line at time t1 and the last
bit is put on the line at time t2, transmission delay of the packet is
(t2 − t1).
• Definitely, the transmission delay is longer for a longer packet and
shorter if the sender can transmit faster.
• The transmission delay is
• Note that this type of abbreviation is allowed only once per address.
• If there is more than one run of zero sections, only one of them can be
compressed.
Mixed Notation
• Sometimes we see a mixed representation of an IPv6 address: colon hex
and dotted-decimal notation.
• This is appropriate during the transition period in which an IPv4 address
is embedded in an IPv6 address (as the rightmost 32 bits).
• We can use the colon hex notation for the leftmost six sections and 4-
byte dotted-decimal notation instead of the rightmost two sections.
• However, this happens when all or most of the leftmost sections of the
IPv6 address are zeros.
• For example, the address (::130.24.24.18) is a legitimate address in IPv6,
in which the zero compression shows that all 96 leftmost bits of the
address are zeros.
Three Address Types
• In IPv6, a destination address can belong to one of three categories: unicast,
anycast, and multicast.
• Unicast Address
• A unicast address defines a single interface (computer or router).
• The packet sent to a unicast address will be routed to the intended recipient.
• Anycast Address
• An anycast address defines a group of computers that all share a single address.
• A packet with an any cast address is delivered to only one member of the group, the
most reachable one.
• An any cast communication is used, for example, when there are several servers that
can respond to an inquiry.
• The request is sent to the one that is most reachable.
• The hardware and software generate only one copy of the request; the copy reaches
only one of the servers.
• IPv6 does not designate a block for any casting; the addresses are assigned from the
unicast block.
• Multicast Address
• A multicast address also defines a group of computers.
• However, there is a difference between any casting and
multicasting. In any casting, only one copy of the packet is
sent to one of the members of the group; in multicasting
each member of the group receives a copy.
• As we will see shortly, IPv6 has designated a block for
multicasting from which the same address is assigned to
the members of the group.
• It is interesting that IPv6 does not define broadcasting,
even in a limited version.
• IPv6 considers broadcasting as a special case of
multicasting.
• Address Space Allocation
• Like the address space of IPv4, the address space of IPv6
is divided into several blocks of varying size and each
block is allocated for a special purpose.
• Most of the blocks are still unassigned and have been set
aside for future use.
• Table 7.5 shows only the assigned blocks.
• In this table, the last column shows the fraction each block
occupies in the whole address space.
Global Unicast Addresses
• The block in the address space that is used for unicast (one-to-one)
communication between two hosts in the Internet is called the global unicast
address block.
• CIDR for the block is 2000::/3, which means that the 3 leftmost bits are the
same for all addresses in this block (001).
• The size of this block is 2125 bits, which is more than enough for Internet
expansion for many years to come.
• An address in this block is divided into three parts: global routing prefix (n
bits), subnet identifier (m bits), and interface identifier (q bits), as shown in
Figure 7.41.
• The figure also shows the recommended length for each part.
• The global routing prefix is used to route the packet through the
Internet to the organization site, such as the ISP that owns the block.
• Because the first 3 bits in this part are fixed (001), the rest of the 45
bits can be defined for up to 2 45 sites (a private organization or an
ISP).
• The global routers in the Internet route a packet to its destination site
based on the value of n.
• The next m bits (16 bits based on recommendation) define a subnet in
an organization.
• This means that an organization can have up to 2 16 = 65,536 subnets,
which is more than enough.
• The last q bits (64 bits based on recommendation) define the interface
identifier.
• The interface identifier is similar to the hostid in IPv4 addressing
although the term interface identifier is a better choice because, as
we discussed earlier, the host identifier actually defines the
interface, not the host.
• If the host is moved from one interface to another, its IP address
needs to be changed.
• In IPv4 addressing, there is not a specific relation between the
hostid (at the IP level) and link-layer address (at the data-link
layer) because the linklayer address is normally much longer than
the hostid.
• The IPv6 addressing allows this relationship.
• A link-layer address whose length is less than 64 bits can be
embedded as the whole or part of the interface identifier,
eliminating the mapping process.
• Two common link-layer addressing schemes can be
considered for this purpose: the 64-bit extended unique
identifier (EUI-64) defined by IEEE and the 48-bit link-layer
address defined by Ethernet.
DHCP: Dynamic Host Configuration Protocol
• Application
• simplification of installation and maintenance of networked computers
• supplies systems with all necessary information, such as
• IP address,
• DNS server address,
• domain name,
• subnet mask,
• default router etc.
• enables automatic integration of systems into an Intranet or the Internet, can be used to
acquire a COA for Mobile IP
• Client/Server-Model
• the client sends via a MAC broadcast a request to the DHCP server (might be via a DHCP relay)
DHCPDISCOVER
DHCPDISCOVER
server client
client relay
• DHCP relay agent is any TCP/IP host which is used to forward
request and replies between DHCP server and client when the server
is present on the different network.
• Relay agents receive DHCP messages and then generate a
new DHCP message to send out on another INTERFACE.
• A client sends requests using MAC broadcasts to reach all
devices in the LAN.
• A DHCP relay might be needed to forward requests across
inter-working units to a DHCP server.
• The client broadcasts a DHCPDISCOVER into the subnet.
• There might be a relay to forward this broadcast.
• In the case shown, two servers receive this broadcast and
determine the configuration they can offer to the client.
• One example for this could be the checking of available IP
addresses and choosing one for the client.
• Servers reply to the client’s request with DHCPOFFER and
offer a list of configuration parameters.
• The client can now choose one of the configurations offered.
• The client in turn replies to the servers, accepting one of the
configurations and rejecting the others using
DHCPREQUEST.
• If a server receives a DHCPREQUEST with a rejection, it
can free the reserved configuration for other possible clients.
• The server with the configuration accepted by the client now
confirms the configuration with DHCPACK.
• This completes the initialization phase.
DHCP - protocol mechanisms
selection of configuration
DHCPREQUEST DHCPREQUEST
(reject) (options) confirmation of
configuration
DHCPACK
initialization completed
release
DHCPRELEASE delete context
• If a client leaves a subnet, it should release the configuration
received by the server using DHCPRELEASE.
• Now the server can free the context stored for the client and
offer the configuration again.
• The configuration a client gets from a server is only leased for
a certain amount of time, it has to be reconfirmed from time to
time.
• Otherwise the server will free the configuration.
• This timeout of configuration helps in the case of crashed
nodes or nodes moved away without releasing the context.
• DHCP is a good candidate for supporting the
acquisition of care-of addresses for mobile nodes.
• The same holds for all other parameters needed, such
as addresses of the default router, DNS servers, the
timeserver etc.
• A DHCP server should be located in the subnet of the
access point of the mobile node, or at least a DHCP
relay should provide forwarding of the messages
DHCP characteristics
• Server
• several servers can be configured for DHCP, coordination not
yet standardized (i.e., manual configuration)
• Renewal of configurations
• IP addresses have to be requested periodically, simplified
protocol
• Options
• available for routers, subnet mask, NTP (network time
protocol) timeserver, SLP (service location protocol)
directory, DNS (domain name system)
ARP AND RARP PROTOCOLS