Module3-Chapter1
Module3-Chapter1
NETWORK LAYER
(only selected topics for
first internals)
1.1
The services which are offered by the network layer protocol are as follows:
1.Packetizing
2.Routing
3.Forwarding
Packetizing
The source is not
network layer
allowed to change
carries a payload
the content of the
from the source to
payload unless it is
the destination
too large for delivery
without changing it
and needs to be
or using it.
fragmented..
SOURCE
RECEIVER
18.12
SA DA Data SA DA Data
Each packet is routed based on the information contained in its header: source and
destination addresses
Virtual-Circuit Approach: Connection-Oriented Service
• In a connection-oriented service there is a relationship between all packets
belonging to a message.
• A path is established between the source and the destination through which all
the packets will be routed during a call.
• This path is called a virtual circuit because to the user, the connection appears to
be a dedicated physical circuit.
• After connection setup, the datagrams can all follow the same path.
• All intermediate nodes between the two points put an entry of the routing in
their routing table with additional parameters like max packet size for the call.
• Additional to source and destination addresses, it must also contain a flow label,
a virtual circuit identifier that defines the virtual path the packet should follow.
• The virtual circuit is cleared after the data transfer is completed.
Figure 18.5: A virtual-circuit packet-switched network
18.16
Figure 18.6: Forwarding process in a router when used in a
virtual circuit network
Incoming
Outgoing
label
label
18.17
a three-phase process is used: setup, data transfer, and teardown.
• In the setup phase, the source and destination addresses of the sender and
receiver are used to make table entries for the connection-oriented service.
• In the teardown phase, the source and destination inform the router to
delete the corresponding entries.
• Data transfer occurs between these two phases.
Setup Phase
• a router creates an entry for a virtual circuit.
• Two auxiliary packets need to be exchanged between the sender and the
receiver: the request packet and the acknowledgment packet.
Teardown Phase
• In the teardown phase, source A, after sending all packets to B, sends a
special packet called a teardown packet.
• Destination B responds with a confirmation packet.
• All routers delete the corresponding entries from their tables.
Figure 18.7: Sending request packet in a virtual-
circuit network
A to B
A to B
A to B A to B
18.19
Figure 18.8: Sending acknowledgments in a virtual-circuit
network
18.20
Figure 18.9: Flow of one packet in an established virtual
circuit
18.21
Datagram approach Virtual Circuit approach
Node takes routing decisions to Node does not take any routing
forward the packets. decision.
Congestion cannot occur as all the Congestion can occur when the node
packets travel in different directions. is busy, and it does not allow other
packets to pass through.
Class E
• IP addresses belonging to class E are reserved for experimental and research
purposes.
• IP addresses of class E range from 240.0.0.0 – 255.255.255.254.
• The higher-order bits of the first octet of class E are always set to 1111.
• To reduce the address depletion, two strategies were proposed: subnetting and
supernetting.
• Subnetting is the procedure to divide the network into sub-networks or small
networks, these smaller networks are known as subnets.
• Computers belong to a subnet are addressed with an identical MSB group in IP
addresses.
• a few bits from the host portion are used to design small-sized subnetworks from
the original network.
• if all of the addresses in a network are not used, subnetting allows the addresses
to be divided among several organizations.
• Supernetting is the procedure to combine small networks into larger
spaces.
• Host addresses’ bits are increased.
Classless Addressing
Extracting Information from an Address
Given any address in the block, we normally like to know three pieces of information about the block to
which the address belongs: the number of addresses, the first address in the block, and the last address.
Since the value of prefix length, n, is given, we can easily find these three pieces of information, as shown
in Figure 18.21.
1. The number of addresses in the block is found as N = 232−n.
2. To find the first address, we keep the n leftmost bits and set the (32 − n) rightmost bits all to 0s.
3. To find the last address, we keep the n leftmost bits and set the (32 − n) rightmost bits all to 1s.
Subnetting
• More levels of hierarchy can be created using subnetting.
• An organization (or an ISP) that is granted a range of addresses may divide the range
into several subranges and assign each subrange to a subnetwork (or subnet).
• Note that nothing stops the organization from creating more levels. A subnetwork
can be divided into several sub-subnetworks.
• A sub-subnetwork can be divided into several sub-sub-subnetworks, and so on.
Designing Subnets:
• The subnetworks in a network should be carefully designed to enable the routing of
packets.
• We assume the total number of addresses granted to the organization is N, the
prefix length is n, the assigned number of addresses to each subnetwork is Nsub,
and the prefix length for each subnetwork is nsub.
Then the following steps need to be carefully followed to guarantee the
proper operation of the subnetworks.
Address Aggregation
• One of the advantages of the CIDR strategy is address aggregation
(sometimes called address summarization or route summarization).
• When blocks of addresses are combined to create a larger block,
routing can be done based on the prefix of the larger block.
• ICANN assigns a large block of addresses to an ISP.
• Each ISP in turn divides its assigned block into smaller subblocks and
grants the subblocks to its customers.
Special Addresses
• This-host Address : The only address in the block 0.0.0.0/32 is called the this-host address. It is
used when ever a host needs to send an IP datagram but it does not know its own address to use
as the source address.
• Limited-broadcast Address: The only address in the block 255.255.255.255/32 is called the
limited-broadcast address. It is used whenever a router or a host needs to send a datagram to all
devices in a network.
• Loopback Address : The block 127.0.0.0/8 is called the loopback address. A packet with one of the
addresses in this block as the destination address never leaves the host; it will remain in the host.
Any address in the block is used to test a piece of software in the machine. For example, we can
write a client and a server program in which one of the addresses in the block is used as the
server address. We can test the programs using the same host to see if they work before running
them on different computers.
• Private Addresses: Four blocks are assigned as private addresses: 10.0.0.0/8, 172.16.0.0/12,
192.168.0.0/16, and 169.254.0.0/16.
• Multicast Addresses : The block 224.0.0.0/4 is reserved for multicast addresses.
Network Address Resolution (NAT)
• A technology that can provide the mapping between the private and
universal addresses, and at the same time support virtual private
networks, is Network Address Translation (NAT).
• The technology allows a site to use a set of private addresses for
internal communication and a set of global Internet addresses (at
least one) for communication with the rest of the world.
• The site must have only one connection to the global Internet through
a NAT-capable router that runs NAT software. Figure 18.29 shows a
simple implementation of NAT.
Address Translation
• All of the outgoing packets go through the NAT router, which replaces
the source address in the packet with the global NAT address.
• All incoming packets also pass through the NAT router, which replaces
the destination address in the packet (the NAT router global address)
with the appropriate private address.
• Figure 18.30 shows an example of address translation.
Translation Table
• The reader may have noticed that translating the source addresses for an
outgoing packet is straightforward. But how does the NAT router know the
destination address for a packet coming from the Internet?
• There may be tens or hundreds of private IP addresses, each belonging to
one specific host. The problem is solved if the NAT router has a translation
table.
Using One IP Address:
• In its simplest form, a translation table has only two columns: the private
address and the external address (destination address of the packet).
• When the router translates the source address of the outgoing packet, it also
makes note of the destination address— where the packet is going.
• When the response comes back from the destination, the router uses the
source address of the packet (as the external address) to find the private
address of the packet. Figure 18.31 shows the idea.
Using a Pool of IP Addresses:
• The use of only one global address by the NAT router allows only one
private-network host to access a given external host.
• To remove this restriction, the NAT router can use a pool of global
addresses. For example, instead of using only one global address
(200.24.5.8), the NAT router can use four addresses (200.24.5.8, 200.24.5.9,
200.24.5.10, and 200.24.5.11).
• In this case, four private-network hosts can communicate with the same
external host at the same time because each pair of addresses defines a
separate connection.
• However, there are still some drawbacks. No more than four con nections
can be made to the same destination. No private-network host can access
two external server programs (e.g., HTTP and TELNET) at the same time.
• And, likewise, two private-network hosts cannot access the same external
server program (e.g., HTTP or TELNET) at the same time.
Using Both IP Addresses and Port Addresses:
• To allow a many-to-many relationship between private-network hosts
and external server programs, we need more information in the
translation table.
• For example, sup pose two hosts inside a private network with
addresses 172.18.3.1 and 172.18.3.2 need to access the HTTP server
on external host 25.8.3.2.
• If the translation table has five columns, instead of two, that include
the source and destination port addresses and the transport-layer
protocol, the ambiguity is eliminated.
• Table 18.1 shows an example of such a table.