100% found this document useful (1 vote)
161 views

CNS Unit 3

The network layer performs important functions such as routing, logical addressing, internetworking, and fragmentation. There are three main switching techniques - circuit switching, message switching, and packet switching. Circuit switching establishes a dedicated physical connection between sender and receiver. Message switching transmits entire messages between nodes without dedicated connections. Packet switching breaks messages into packets that can take different routes to the destination. The document then discusses virtual circuit and datagram approaches to packet switching, as well as IP addressing classes A, B, C, D and E.

Uploaded by

Parth Gadewar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
161 views

CNS Unit 3

The network layer performs important functions such as routing, logical addressing, internetworking, and fragmentation. There are three main switching techniques - circuit switching, message switching, and packet switching. Circuit switching establishes a dedicated physical connection between sender and receiver. Message switching transmits entire messages between nodes without dedicated connections. Packet switching breaks messages into packets that can take different routes to the destination. The document then discusses virtual circuit and datagram approaches to packet switching, as well as IP addressing classes A, B, C, D and E.

Uploaded by

Parth Gadewar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 207

Unit 3 – Network layer

Subject - CNS (2019 pattern)


Syllabus
Functions of Network Layer
• Routing: When a packet reaches the router's input link, the router will
move the packets to the router's output link. For example, a packet from S1
to R1 must be forwarded to the next router on the path to S2.
• Logical Addressing: The data link layer implements the physical addressing
and network layer implements the logical addressing. Logical addressing is
also used to distinguish between source and destination system. The
network layer adds a header to the packet which includes the logical
addresses of both the sender and the receiver.
• Internetworking: This is the main role of the network layer that it provides
the logical connection between different types of networks.
• Fragmentation: The fragmentation is a process of breaking the packets into
the smallest individual data units that travel through different networks.
Switching Techniques

In large networks there might be multiple paths linking sender


and receiver. Information may be switched as it travels through
various communication channels. There are three typical
switching techniques available for digital traffic.

• Circuit Switching
• Message Switching
• Packet Switching
Circuit Switching
• Circuit switching is a technique that directly connects the
sender and the receiver in an unbroken path.
• Telephone switching equipment, for example, establishes a
path that connects the caller's telephone to the receiver's
telephone by making a physical connection.
• With this type of switching technique, once a connection is
established, a dedicated path exists between both ends
until the connection is terminated.
• Routing decisions must be made when the circuit is first
established, but there are no decisions made after that
time.
• Three phases
• Establish
• Transfer
• Disconnect
Public Circuit Switched Network
Circuit Establishment
Circuit Switching

• Circuit switching in a network operates almost the same way


as the telephone system works.

• A complete end-to-end path must exist before


communication can take place.

• Once the connection has been initiated and completed to the


destination device, the destination device must acknowledge
that it is ready and willing to carry on a transfer.
Circuit switching

Advantages:
• The communication channel (once established) is dedicated.

Disadvantages:
• Possible long wait to establish a connection

• More expensive than any other switching techniques,


because a dedicated path is required for each connection.

• Inefficient use of the communication channel, because the


channel is not used when the connected systems are not
using it.
Message Switching
• With message switching there is no need to establish a dedicated path between
two stations.

• When a station sends a message, the destination address is appended to the


message.

• The message is then transmitted through the network, in its entirety, from node
to node.

• Each node receives the entire message, stores it in its entirety on disk, and then
transmits the message to the next node.

• This type of network is called a store-and-forward network.


Message Switching

A message-switching node is typically a general-purpose


computer. The device needs sufficient secondary-storage
capacity to store the incoming messages, which could be long.
A time delay is introduced using this type of scheme due to
store- and-forward time, plus the time required to find the next
node in the transmission path.
Message Switching
Advantages:
• Channel efficiency can be greater compared to circuit-
switched systems, because more devices are sharing the
channel.

• Message priorities can be established due to store-and-forward


technique.

• Message broadcasting can be achieved with the use of


broadcast address appended in the message.
Message Switching
Disadvantages
• Message switching is not compatible with interactive
applications.

• Store-and-forward devices are expensive, because they


must have large disks to hold potentially long messages.
Packet Switching
• Packet switching can be seen as a solution that tries to combine the
advantages of message and circuit switching and to minimize the
disadvantages of both.
• There are two methods of packet switching: Datagram and virtual circuit.
Packet Switching
• In both packet switching methods, a message is broken into
small parts, called packets.

• Each packet is tagged with appropriate source and destination


addresses.

• Since packets have a strictly defined maximum length, they


can be stored in main memory instead of disk, therefore access
delay and cost are minimized.
Packet Switching

• With current technology, packets are generally accepted onto


the network on a first-come, first-served basis. If the network
becomes overloaded, packets are delayed or discarded
(``dropped'').
Packet Switching: Datagram
• Datagram packet switching is similar to message switching in
that each packet is a self-contained unit with complete
addressing information attached.

• This fact allows packets to take a variety of possible paths


through the network.

• So the packets, each with the same destination address, do not


follow the same route, and they may arrive out of sequence at
the exit point node (or the destination).

• Reordering is done at the destination point based on the


sequence number of the packets.
Datagram
Diagram
Packet Switching:Virtual Circuit

• In the virtual circuit approach, a preplanned route is established


before any data packets are sent.

• A logical connection is established when


 a sender send a "call request packet" to the receiver and
 the receiver send back an acknowledge packet "call accepted
packet" to the sender if the receiver agrees on conversational
parameters.

• The conversational parameters can be maximum packet sizes,


path to be taken, and other variables necessary to establish and
maintain the conversation.

•Virtual circuits imply acknowledgements, flow control, and error


Packet Switching: Virtual Circuit
• In virtual circuit, the route between stations does not mean that
this is a dedicated path, as in circuit switching.
• A packet is still buffered at each node and queued for output over
a line.
• The difference between virtual circuit and datagram approaches:

 With virtual circuit, the node does not need to make a routing
decision for each packet.

 It is made only once for all packets using that virtual circuit.
Virtual
Circuit
Diagram
Packet Switching: Virtual Circuit

VC's offer guarantees that

the packets sent arrive in the order sent


with no duplicates or omissions
with no errors (with high probability)
regardless of how they are implemented internally.
Advantages of packet switching
Advantages:
• Packet switching is cost effective, because switching
devices do not need massive amount of secondary
storage.
• Packet switching offers improved delay characteristics,
because there are no long messages in the queue
(maximum packet size is fixed).
• Packet can be rerouted if there is any problem, such as,
busy or disabled links.
• The advantage of packet switching is that many
network users can share the same channel at the same
time. Packet switching can maximize link efficiency by
making optimal use of link bandwidth.
Disadvantages of packet switching

Disadvantages:
• Protocols for packet switching are typically more
complex.

• It can add some initial costs in implementation.

• If packet is lost, sender needs to retransmit the data.

• Another disadvantage is that packet-switched systems still


can’t deliver the same quality as dedicated circuits in
applications requiring very little delay - like voice
conversations or moving images.
Comparison of Virtual-Circuit and
Datagram Networks

Comparison of datagram and virtual-circuit networks


IP Addresses
An Internet Protocol address (IP address) is a numerical label
assigned to each device participating in a computer network
that uses the Internet Protocol for communication
An IP address is a
32-bit
address.

The IP addresses
are
unique.
The address space of IPv4 is
232
or
4,294,967,296.
In classful addressing,
the address space is
divided into five classes:
A, B, C, D, and E.
Finding the class in binary notation
Finding the class in decimal notation
Finding the address class
Netid and hostid
Class A Address

• The first bit of the first octet is always set to 0 (zero). Thus the first octet
ranges from 1 – 127, i.e.

Class A addressing can have 126 networks (27-2) and


16777214 hosts (224-2).

Class A IP address format is


thus: 0NNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH
Class B Address

An IP address which belongs to class B has the first


two bits in the first octet set to 10, i.e.

Class B IP Addresses range from 128.0.x.x to 191.255.x.x.


Class B has 16384 (214) Network addresses and 65534 (216-
2) Host addresses
Class B IP address format is:
10NNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH
Class C Address

• The first octet of Class C IP address has its first 3 bits set to 110,
that is:

Class C IP addresses range from 192.0.0.x to


223.255.255.x.
Class C gives 2097152 (221) Network addresses and 254 (28-2)
Host addresses.

Class C IP address format


is: 110NNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH
The network address is the
beginning address of each block.
It can be found by applying
the default mask to
any of the addresses in the block
(including itself).
It retains the netid of the block
and sets the hostid to zero.
Given the network address 17.0.0.0, find
the class, the block, and the range of the
addresses.
Given the network address 17.0.0.0, find
the class, the block, and the range of the
addresses.

Solution

The class is A because the first byte is between 0 and 127.


The block has a netid of 17.
The addresses range from 17.0.0.0 to 17.255.255.255.
Given the network address 132.21.0.0, find
the class, the block, and the range of the
addresses.
Given the network address 132.21.0.0, find
the class, the block, and the range of the
addresses.

Solution

The class is B because the first byte is between 128 and 191.
The block has a netid of 132.21. The addresses range from
132.21.0.0 to 132.21.255.255.
Given the network address 220.34.76.0, find
the class, the block, and the range of the
addresses.
Given the network address 220.34.76.0, find
the class, the block, and the range of the
addresses.
Solution

The class is C because the first byte is between


192 and 223.
The block has a netid of 220.34.76.
The addresses range from 220.34.76.0
to 220.34.76.255.
Mask
A mask is a 32-bit binary number that gives
the first address in the block (the network
address) when bitwise ANDed with an address
in the block. i.e.

Network address = IPaddress AND Mask


Masking concept
AND operation
Default masks for classful addressing
A block of addresses is granted to a small organization. We
know that one of the addresses is 205.16.37.39/28. What is
the first address in the block? (i.e. find n/w address using
mask)
A block of addresses is granted to a small organization. We
know that one of the addresses is 205.16.37.39/28. What is
the first address in the block?

Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
Mask is 11111111 11111111 11111111 11110000

If we set 32−28 rightmost bits to 0, we get


11001101 00010000 00100101 0010000
or
205.16.37.32.
What is the network address if one of the addresses is
167.199.170.82/27?
What is the network address if one of the addresses is
167.199.170.82/27?

Solution
The prefix length is 27, which means that we
must keep the first 27 bits as is and change the
remaining bits (5) to 0s. The 5 bits affect only
the last byte. The last byte is 01010010.
Changing the last 5 bits to 0s, we get 01000000
or 64. The network address is 167.199.170.64/27.
A small organization is given a block with the beginning
address and the prefix length 205.16.37.24/29 (in slash
notation). What is the range of the block?
Solution
The beginning address is 205.16.37.24. To find the
last address we keep the first 29 bits and change the
last 3 bits to 1s.
Beginning:11001111 00010000 00100101 00011000
Ending : 11001111 00010000 00100101 00011111
There are only 8 addresses in this block.
Subnetting

Subnetting is the strategy used to partition a single physical network


into more than one smaller logical sub-networks (subnets).

Subnets are designed by accepting bits from the IP address's host


part and using these bits to assign a number of smaller sub-networks
inside the original network.

Subnetting helps to reduce the network complexity.

Subnetting is essential when a single network number has to be


allocated over numerous segments of a local area network (LAN).
Addresses in a network with
and without subnetting
Default mask and subnet mask
Finding the Subnet Address
Given an IP address, we can find the
subnet address the same way we found the
network address. We apply the mask to the
address. We can do this in two ways:
straight or short-cut.
Finding the Subnet Address

Straight Method
In the straight method, we use binary
notation for both the address and the
mask and then apply the AND operation
to find the subnet address.
Example 1

What is the subnetwork address if the


destination address is 200.45.34.56 and the
subnet mask is 255.255.240.0?
Solution

11001000 00101101 00100010 00111000


11111111 11111111 11110000 00000000
11001000 00101101 00100000 00000000

The subnetwork address is 200.45.32.0.


Short-Cut Method
** If the byte in the mask is 255, copy the
byte in the address.
** If the byte in the mask is 0, replace the
byte in the address with 0.
** If the byte in the mask is neither 255
nor 0, we write the mask and the address
in binary and apply the AND operation.
Example 2

What is the subnetwork address if the


destination address is 19.30.80.5 and the
mask is 255.255.192.0?
Solution
The number of subnets must be
a power of 2.
A company is granted the site address
201.70.64.0 (class C). The company needs
six subnets. Design the subnets.

Solution

The number of 1s in the default


mask is 24 (class C).
Solution (Continued)

The company needs six subnets. This number


6 is not a power of 2. The next number that is
a power of 2 is 8 (23). We need 3 more 1s in
the subnet mask. The total number of 1s in
the subnet mask is 27 (24 + 3).
The total number of 0s is 5 (32 - 27). The
mask is
Solution (Continued)

11111111 11111111 11111111 11100000


or
255.255.255.224
The number of subnets is 8.
The number of addresses in each subnet
is 25 (5 is the number of 0s) or 32.
See Figure on next slide…
Example 4

A company is granted the site address


181.56.0.0 (class B). The company needs
1000 subnets. Design the subnets.
Solution

The number of 1s in the default mask is 16


(class B).
Solution (Continued)

The company needs 1000 subnets. This


number is not a power of 2. The next number
that is a power of 2 is 1024 (210). We need 10
more 1s in the subnet mask.
The total number of 1s in the subnet mask is
26 (16 + 10).
The total number of 0s is 6 (32 - 26).
Solution (Continued)

The mask is
11111111 11111111 11111111 11000000
or
255.255.255.192
The number of subnets is 1024.
The number of addresses in each subnet is 26
(6 is the number of 0s) or 64.
See Figure 5.9
Example 14
An organization is granted the block 130.34.12.64/26.
The organization needs to have four subnets. What are the
subnet addresses and the range of addresses for each
subnet?

Solution

The suffix length is 6. This means the total number


of addresses in the block is 64 (26). If we create
four subnets, each subnet will have 16 addresses.
Solution (Continued)
Let us first find the subnet prefix (subnet mask).
We need four subnets, which means we need to add
two more 1s to the site prefix. The subnet prefix is
then /28.
Subnet 1: 130.34.12.64/28 to 130.34.12.79/28.
Subnet 2 : 130.34.12.80/28 to 130.34.12.95/28.
Subnet 3: 130.34.12.96/28 to 130.34.12.111/28.
Subnet 4: 130.34.12.112/28 to 130.34.12.127/28.
An ISP is granted a block of addresses starting with
190.100.0.0/16. The ISP needs to distribute these
addresses to three groups of customers as follows:

1. The first group has 64 customers; each needs 256 addresses.


2. The second group has 128 customers; each needs 128 addresses.

3. The third group has 128 customers; each needs 64 addresses.

Design the subblocks and give the slash notation for each
subblock. Find out how many addresses are still available
after these allocations.
Solution
Group 1
For this group, each customer needs 256 addresses.
This means the suffix length is 8 (28 = 256). The
prefix length is then 32 - 8 = 24.
01: 190.100.0.0/24 190.100.0.255/24
02: 190.100.1.0/24 190.100.1.255/24
…………………………………..
64: 190.100.63.0/24190.100.63.255/24
Total = 64  256 = 16,384
Solution (Continued)
Group 2
For this group, each customer needs 128 addresses.
This means the suffix length is 7 (27 = 128). The
prefix length is then 32 - 7 = 25. The addresses
are:
001: 190.100.64.0/25 190.100.64.127/25
002: 190.100.64.128/25 190.100.64.255/25
003: 190.100.127.128/25 190.100.127.255/25
Total = 128  128 = 16,384
Solution (Continued)
Group 3
For this group, each customer needs 64 addresses.
This means the suffix length is 6 (26 = 64). The
prefix length is then 32 - 6 = 26.
001:190.100.128.0/26 190.100.128.63/26
002:190.100.128.64/26 190.100.128.127/26
…………………………
128:190.100.159.192/26 190.100.159.255/26
Total = 128  64 = 8,192
IPv4 ADDRESSES

An IPv4 address is a 32-bit address that uniquely and


universally defines the connection of a device (for
example, a computer or a router) to the Internet.

19.79
Note

An IPv4 address is 32 bits long.

19.80
Note

The IPv4 addresses are unique


and universal.

19.81
Note

The address space of IPv4 is


232 or 4,294,967,296.

19.82
Addresses for private networks

19.83
IPv6 ADDRESSES

Despite all short-term solutions, address depletion is still a


long-term problem for the Internet. This and other problems in
the IP protocol itself have been the motivation for IPv6.

19.84
Note

An IPv6 address is 128 bits long.

19.85
IPv6 address in binary and hexadecimal colon notation

19.86
128-bit IPv6 Address
3FFE:085B:1F1F:0000:0000:0000:00A9:1234

8 groups of 16-bit hexadecimal numbers separated by “:”

Leading zeros can be removed

3FFE:85B:1F1F::A9:1234

:: = all zeros in one or more group of 16-bit hexadecimal numbers


Example

Expand the address 0:15::1:12:1213 to its original.

Solution
We first need to align the left side of the double colon to
the left of the original pattern and the right side of the
double colon to the right of the original pattern to find
how many 0s we need to replace the double colon.

This means that the original address is.

19.88
19.89
IPv4 Header

• Version (4 bits)
• Indicates the version of IP and is set to 4.
• Internet Header Length (4 bits)
• Indicates the number of 4-byte blocks in the IPv4 header.
• Because an IPv4 header is a minimum of 20 bytes in size, the smallest value of the Internet
Header Length (IHL) field is 5.
• Type of Service (4 bits)
• Indicates the desired service expected by this packet for delivery through routers across the
IPv4 internetwork.
• Contains a 6-bit Differentiated Services Code Point (DSCP) field (RFC 2472) and two flags to
support Explicit Congestion Notification (RFC 3168).

IPv6 Packet Format 90


IPv4 Header - Review

• Total Length (16 bits)


• Indicates the total length of the IPv4 packet (IPv4 header + IPv4 payload) and does not include link layer
framing.
• indicate an IPv4 packet that is up to 65,535 bytes long.
• Identification (16 bits)
• Identifies this specific IPv4 packet.
• The Identification field is selected by the originating source of the IPv4 packet. If the IPv4 packet is
fragmented, all of the fragments retain the Identification field value so that the destination node can group
the fragments for reassembly.
• Flags (3 bits)
• Identifies flags for the fragmentation process.
• There are two flags—one to indicate whether the IPv4 packet might be fragmented and another to indicate
whether more fragments follow the current fragment.
• Fragment Offset (13 bits)
• Indicates the position of the fragment relative to the original IPv4 payload.

91
IPv4 Header - Review

• Time to Live ( 8 bits)


• Indicate the maximum number of links on which an IPv4 packet can travel before being discarded.
• Originally used as a time count with which an IPv4 router determined the length of time required (in seconds)
to forward the IPv4 packet, decrementing the TTL accordingly. Modern routers almost always forward an IPv4
packet in less than a second and are required by RFC 791 to decrement the TTL by at least one. Therefore, the
TTL becomes a maximum link count with the value set by the sending node. When the TTL equals 0,an ICMP
Time Expired-TTL Expired in Transit message is sent to the source IPv4 address and the packet is discarded.
• Protocol (8 bits)
• Identifies the upper layer protocol.
• For example, TCP uses a Protocol of 6, UDP uses a Protocol of 17, and ICMP uses a Protocol of 1.
• The Protocol field is used to demultiplex an IPv4 packet to the upper layer protocol.

92
IPv4 Header - Review

• Header Checksum (16 Bits)


• Provides a checksum on the IPv4 header only.
• The IPv4 payload is not included in the checksum calculation as the IPv4 payload and usually contains its own
checksum. Each IPv4 node that receives IPv4 packets verifies the IPv4 header checksum and silently discards
the IPv4 packet if checksum verification fails. When a router forwards an IPv4 packet, it must decrement the
TTL. Therefore, the Header Checksum is recomputed at each hop between source and destination.
• Source Address ( 32 bits)
• Stores the IPv4 address of the originating host.
• Destination Address (32 bits)
• Stores the IPv4 address of the destination host.
• Options (multiple of 32 bits)
• Stores one or more IPv4 options.
• If the IPv4 option or options do not use all 32 bits, padding options must be added so that the IPv4 header is
an integral number of 4-byte blocks that can be indicated by the Internet Header Length field.

93
IPv6 Header Fields
• Based on these rules, RFC 2460 defines the following IPv6 header fields:

1. Version (4 bits)
• 4 bits are used to indicate the version of IP and is set to 6
• Traffic Class (8 bits)
• same function as the Type of Service field in the IPv4 header.
1. Flow Label (20 bits)
• identifies a flow and it is intended to enable the router to identify packets that
should be treated in a similar way without the need for deep lookups within those
packets.
• set by the source and should not be changed by routers along the path to
destination.
• unique & powerful tool to IPv6
• Can be used with differentiated services (DiffServ) as well as integrated services
(IntServ) and Resource ReSerVation Protocol (RSVP2).

IPv6 Packet Format 96


IPv6 Header Fields
4. Payload Length (16 bits)
• With the header length fixed at 40 bytes, it is enough to indicate the
length of the payload to determine the length of the entire packet.
5. Next Header (8 bits)
• Indicates either the first extension header (if present) or the protocol
in the upper layer PDU (such as TCP, UDP, or ICMPv6).
• When indicating an upper layer protocol above the Internet layer, the
same values used in the IPv4 Protocol field are used here.
6. Hop Limit (8 bits)
• In IPv6, the IPv4 TTL was appropriately renamed Hop Limit because it
is a variable that is decremented at each hop, and it does not have a
temporal dimension.

IPv6 Packet Format 97


IPv6 Header Fields

7. Source IPv6 Address (128 bits)


• Stores the IPv6 address of the originating host.
8. Destination IPv6 Address (128 bits)
• Stores the IPv6 address of the current destination host.

IPv6 Packet Format 98


Network Address Translation (NAT)
• To access the Internet, public IP address is needed. But we can use a private IP
address in our private network.
• The idea of NAT is to allow multiple devices to access the Internet through a single
public address. To achieve this, the translation of a private IP address to a public IP
address is required.
• Network Address Translation (NAT) is a process in which one or more local IP
address is translated into one or more Global IP address and vice versa in order to
provide Internet access to the local hosts.
• Also, it does the translation of port numbers i.e. masks the port number of the host
with another port number, in the packet that will be routed to the destination. It then
makes the corresponding entries of IP address and port number in the NAT table.
NAT generally operates on a router or firewall.
• Why NAT? - a rescue methodology when the IPv4 address space was getting
exhausted.
• NAT Explained - Network Address Translation on: - https://youtu.be/FTUV0t6JaDA
Advantages of NAT –

•NAT conserves legally registered IP addresses.

•It provides privacy as the device’s IP address, sending and receiving the traffic, will be hidden.

•Eliminates address renumbering when a network evolves.

Disadvantage of NAT –

•Translation results in switching path delays.

•Certain applications will not function while NAT is enabled.

•Complicates tunneling protocols such as IPsec.

•Also, the router being a network layer device, should not tamper with port numbers(transport layer)
but it has to do so because of NAT.
Classless Inter-Domain Routing (CIDR)
OR Classless addressing.
• In the Classful addressing the no of Hosts within a network always remains
the same depending upon the class of the Network.
• Class A network contains 224 Hosts,
• Class B network contains 216 Hosts,
• Class C network contains 28 Hosts
• Now, let’s suppose an Organization requires 214 hosts, then it must have to
purchase a Class B network. In this case, 49152 Hosts will be wasted. This is
the major drawback of Classful Addressing.
• In order to reduce the wastage of IP addresses a new concept of Classless
Inter-Domain Routing is introduced.
• CIDR Link: https://youtu.be/ncsJ0uJu4n0
• CIDR Representation: It is also a 32-bit address, which includes a
special number which represents the number of bits that are present
in the Block Id.
a.b.c.d/n
Where, n is number of bits that are present in Network Id.
(blockid bits=32-n)
• Example: 20.10.50.100/20
• Here, 20 bits are present in Network Id.
Rules for forming CIDR Blocks
1.All IP addresses must be contiguous.
2.Block size must be the power of 2 (2n).
If the size of the block is the power of 2, then it will be easy to divide the
Network. Finding out the Block Id is very easy if the block size is of the
power of 2.
Example:
If the Block size is 25 then, Host Id will contain 5 bits and Network will
contain 32 – 5 = 27 bits.
3.First IP address of the Block must be evenly divisible by the size of the
block. in simple words, the least significant part should always start with
zeroes in Host Id. Since all the least significant bits of Host Id is zero, then
we can use it as Block Id part.
• Example:
Check whether 100.1.2.32 to 100.1.2.47 is a valid IP address block or not?
Solution:
• All the IP addresses are contiguous.
• Total number of IP addresses in the Block = 16 = 24.
• 1st IP address: 100.1.2.00100000
Since, Host Id will contains last 4 bits and all the least significant 4 bits are
zero. Hence, first IP address is evenly divisible by the size of the block.
• All the three rules are followed by this Block. Hence, it is a valid IP address
block.
Network layer protocols
• ARP
• RARP
• ICMP
• IGMP
ARP and RARP

• Note:
• The Internet is based on IP addresses
• Data link protocols (Ethernet, FDDI, ATM) may have different (MAC) addresses
• The ARP and RARP protocols perform the translation between IP addresses
and MAC layer addresses
• The delivery of a packet to a host or a router requires two levels of
addressing: logical and physical. We need to be able to map a logical
address to its corresponding
• physical address and vice versa. This can be done by using either static or
dynamic mapping.
• We will discuss ARP for broadcast LANs, particularly Ethernet LANs

109
Figure ARP operation

110
ARP Packet Format
Ethernet II header

Destination Source Type


address address 0x8060
ARP Request or ARP Reply Padding CRC

6 6 2 28 10 4

Hardware type (2 bytes) Protocol type (2 bytes)


Hardware address Protocol address
Operation code (2 bytes)
length (1 byte) length (1 byte)
Source hardware address*

Source protocol address*

Target hardware address*

Target protocol address*

* Note: The length of the address fields is determined by the corresponding address length fields
111
• Hardware type (HTYPE)This field specifies the Link Layer protocol type.
Example: Ethernet is 1.
• Protocol type (PTYPE)This field specifies the upper layer protocol for which the
ARP request is intended. For IPv4, this has the value 0x0800.
• Hardware length (HLEN)Length (in octets) of a hardware address. Ethernet
addresses size is 6.
• Protocol length (PLEN)Length (in octets) of addresses used in the upper layer
protocol. (The upper layer protocol specified in PTYPE.) IPv4 address size is 4.

112
Figure Encapsulation of ARP packet

113
Example 1

A host with IP address 130.23.43.20 and physical address


B2:34:55:10:22:10 has a packet to send to another host
with IP address 130.23.43.25 and physical address
A4:6E:F4:59:83:AB. The two hosts are on the same
Ethernet network. Show the ARP request and reply
packets encapsulated in Ethernet frames.

Solution
Figure 5 shows the ARP request and reply packets. Note
that the ARP data field in this case is 28 bytes, and that
the individual addresses do not fit in the 4-byte boundary.
That is why we do not show the regular 4-byte boundaries
for these addresses.
114
Figure Example 1, an ARP request and reply

115
Note

An ARP request is broadcast;


an ARP reply is unicast.

116
Reverse Address Resolution Protocol (RARP)
• Some network hosts, such as a diskless workstation, do not know their
own IP address when they are booted. To determine their own IP address,
they use a mechanism similar to ARP, but now the hardware address of
the host is the known parameter, and the IP address is the queried
parameter.
• The reverse address resolution is performed the same way as the ARP
address resolution. The same packet format is used for the ARP.
• An exception is the operation code field that now takes the following
values−
• 3 for RARP request
• 4 for RARP reply
• The physical header of the frame will now indicate RARP as the higher-
level protocol (8035 hex) instead of ARP (0806 hex) or IP-(0800 hex) in the
Ether type field.
The format of a RARP packet is almost identical to an ARP
packet. The only difference is that the frame type is 0X8035
for a RARP request or reply, and the op-field has a value of 3
for a RARP request and 4 for a RARP reply.
ICMP

The IP protocol has no error-reporting or error-correcting


mechanism. The IP protocol also lacks a mechanism for
host and management queries. The Internet Control
Message Protocol (ICMP) has been designed to
compensate for the above two deficiencies. It is a
companion to the IP protocol.
• IP unreliable hence no error checking and error
control.
• Hence ICMP was designed
• But does not correct errors. Simply reports them to
source.
• Error correction done by the upper layers
Note

ICMP always reports error messages to


the original source.

121
Figure General format of ICMP messages

1 -The first byte specifies the type of ICMP message. For example, type 8 is used for an ICMP request
and type 0 is used for an ICMP reply. We use type 3 for destination unreachable messages.
2 -The second byte called code specifies what kind of ICMP message it is. For example, the destination
unreachable message has 16 different codes. When you see code 0 it means that the destination network
was unreachable while code 1 means that the destination host was unreachable.
3 -The third field are 2 bytes that are used for the checksum to see if the ICMP header is corrupt or not.
What the remaining part of the header looks like depends on the ICMP message type that we are using.

122
Figure ICMP Error-reporting messages

123
Note

Important points about ICMP error messages:


❏ No ICMP error message will be generated in
response to a datagram carrying an ICMP error
message.
❏ No ICMP error message will be generated for a
fragmented datagram that is not the first fragment.
❏ No ICMP error message will be generated for a
datagram having a multicast address.
❏ No ICMP error message will be generated for a
datagram having a special address such as
127.0.0.0 or 0.0.0.0.

124
Figure Contents of data field for the error messages

125
Figure 12 ICMP Query messages

127
Figure 13 Encapsulation of ICMP query messages

128
3 IGMP

The IP protocol can be involved in two types of


communication: unicasting and multicasting. The
Internet Group Management Protocol (IGMP) is one
of the necessary, but not sufficient, protocols that is
involved in multicasting. IGMP is a companion to the IP
protocol.
Figure IGMP message types

130
Figure IGMP message format

Type – •Max Response Time –


0x11 for Membership Query This field is ignored for message types other than
0x12 for IGMPv1 Membership Report membership query. For membership query type, it is the
0x16 for IGMPv2 Membership Report maximum time allowed before sending a response report.
0x22 for IGMPv3 Membership Report The value is in units of 0.1 seconds.
0x17 for Leave Group •Checksum –
It is the one’s complement of the one’s complement of the
sum of IGMP message.
•Group Address –
It is set as 0 when sending a general query. Otherwise, multicast
address for group-specific or source-specific queries.
131
Table IGMP type field

132
Figure IGMP operation

133
Note

In IGMP, a membership report is sent


twice, one after the other.

134
Note

The general query message does not


define a particular group.

135
Routing algorithms
 Classification
 Non adaptive (static)
 Routing decisions computed in advance, off-line and downloaded
 Adaptive (dynamic)
 To changes in
 Topology
 Load
 Get information
 Locally
 From adjacent routers
 From all routers

136
A Link-State Routing Algorithm

Dijkstra’s algorithm Notation:


 net topology, link costs known to all nodes  c(x,y): link cost from node x to y; = ∞ if
 accomplished via “link state broadcast” not direct neighbors
 all nodes have same info  D(v): current value of cost of path from
 computes least cost paths from one node source to dest. v
(‘source”) to all other nodes  p(v): predecessor node along path from
 gives forwarding table for that node
source to v
 iterative: after k iterations, know least cost  N': set of nodes whose least cost path
path to k dest.’s definitively known

Network Layer 4-139


Dijsktra’s Algorithm

1 Initialization:
2 N' = {u}
3 for all nodes v
4 if v adjacent to u
5 then D(v) = c(u,v)
6 else D(v) = ∞
7
8 Loop
9 find w not in N' such that D(w) is a minimum
10 add w to N'
11 update D(v) for all v adjacent to w and not in N' :
12 D(v) = min( D(v), D(w) + c(w,v) )
13 /* new cost to v is either old cost to v or known
14 shortest path cost to w plus cost from w to v */
15 until all nodes in N'

Network Layer 4-140


Dijkstra’s algorithm: example

Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)


0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw 4,y
5 uxyvwz

5
3
v w 5
2
u 2 1 z
3
1 2
x 1
y

Network Layer 4-141


Distance Vector Algorithm (1)

Bellman-Ford Equation (dynamic programming)


Define
dx(y) := cost of least-cost path from x to y

Then
dx(y) = min {c(x,v) + dv(y) }
where min is taken over all neighbors of x

Network Layer 4-143


Bellman-Ford example (2)
5
3
Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
v w 5
2
u 2 1 z B-F equation says:
3
1 2 du(z) = min { c(u,v) + dv(z),
x y
1 c(u,x) + dx(z),
c(u,w) + dw(z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
Node that achieves minimum is next
hop in shortest path ➜ forwarding table
Network Layer 4-144
Distance Vector Algorithm (3)

 Dx(y) = estimate of least cost from x to y


 Distance vector: Dx = [Dx(y): y є N ]
 Node x knows cost to each neighbor v: c(x,v)
 Node x maintains Dx = [Dx(y): y є N ]
 Node x also maintains its neighbors’ distance vectors
 For each neighbor v, x maintains
Dv = [Dv(y): y є N ]

Network Layer 4-145


Distance vector algorithm (4)
Basic idea:
 Each node periodically sends its own distance vector
estimate to neighbors
 When node a node x receives new DV estimate from
neighbor, it updates its own DV using B-F equation:

Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N

 Under minor, natural conditions, the estimate Dx(y)


converge the actual least cost dx(y)

Network Layer 4-146


Distance Vector Algorithm (5)

Iterative, asynchronous: Each node:


each local iteration caused
by:
 local link cost change wait for (change in local link
 DV update message from cost of msg from neighbor)
neighbor
Distributed:
recompute estimates
 each node notifies neighbors
only when its DV changes
 neighbors then notify their if DV to any dest has
neighbors if necessary
changed, notify neighbors

Network Layer 4-147


Distance Vector: link cost changes

Link cost changes: 1


 node detects local link cost change y
4 1
 updates routing info, recalculates
x z
distance vector 50
 if DV changes, notify neighbors

At time t0, y detects the link-cost change, updates its DV,


and informs its neighbors.
“good
news At time t1, z receives the update from y and updates its table.
It computes a new least cost to x and sends its neighbors its DV.
travels
fast” At time t2, y receives z’s update and updates its distance table.
y’s least costs do not change and hence y does not send any
message to z.

Network Layer 4-149


Comparison of LS and DV algorithms

Message complexity Robustness: what happens if


 LS: with n nodes, E links, O(nE) msgs sent router malfunctions?
 DV: exchange between neighbors only LS:
 convergence time varies
 node can advertise incorrect link
cost
Speed of Convergence
 each node computes only its own
 LS: O(n2)
algorithm requires O(nE) msgs
table
 may have oscillations
DV:
 DV: convergence time varies
 DV node can advertise incorrect
 may be routing loops
path cost
 count-to-infinity problem
 each node’s table used by others
 error propagate thru network

Network Layer 4-151


Path Vector Routing

 A path vector protocol does not rely on the cost of reaching a


given destination to determine whether each path available is
loop free or not.
 Instead, path vector protocols rely on analysis of the path to
reach the destination to learn if it is loop free or not.
 It is typically deployed in environments where it is difficult to
guarantee a consistent metric (distance) across the routing
domain.

Network Layer 4-152


Hierarchical Routing

Our routing study thus far - idealization


 all routers identical
 network “flat”
… not true in practice

scale: with 200 million administrative autonomy


destinations:  internet = network of
 can’t store all dest’s in networks
routing tables!  each network admin may want
 routing table exchange to control routing in its own
would swamp links! network

Network Layer 4-153


Hierarchical Routing

 aggregate routers into regions, Gateway router


“autonomous systems” (AS)
 Direct link to router in another AS

 routers in same AS run same


routing protocol
 “intra-AS” routing protocol
 routers in different AS can run
different intra-AS routing protocol

Network Layer 4-154


Interconnected ASes

3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
1d AS1
 Forwarding table is
configured by both intra- and
inter-AS routing algorithm
Intra-AS Inter-AS
Routing Routing  Intra-AS sets entries for internal
algorithm algorithm
dests
Forwarding  Inter-AS & Intra-As sets entries
table
for external dests

Network Layer 4-155


Inter-AS tasks
AS1 needs:
 Suppose router in AS1 1. to learn which dests
receives datagram for are reachable through
which dest is outside of AS2 and which through
AS1 AS3
 Router should forward 2. to propagate this
packet towards on of the
reachability info to all
gateway routers, but
which one? routers in AS1
Job of inter-AS routing!

3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
1d AS1
Network Layer 4-156
Example: Setting forwarding table in
router 1d

 Suppose AS1 learns from the inter-AS protocol that


subnet x is reachable from AS3 (gateway 1c) but not
from AS2.
 Inter-AS protocol propagates reachability info to all
internal routers.
 Router 1d determines from intra-AS routing info that its
interface I is on the least cost path to 1c.
 Puts in forwarding table entry (x,I).

Network Layer 4-157


Example: Choosing among multiple ASes

 Now suppose AS1 learns from the inter-AS protocol


that subnet x is reachable from AS3 and from AS2.
 To configure forwarding table, router 1d must
determine towards which gateway it should forward
packets for dest x.
 This is also the job on inter-AS routing protocol!
 Hot potato routing: send packet towards closest of two
routers.

Use routing info Determine from


Learn from inter-AS Hot potato routing: forwarding table the
from intra-AS
protocol that subnet Choose the gateway interface I that leads
protocol to determine
x is reachable via that has the to least-cost gateway.
costs of least-cost
multiple gateways smallest least cost Enter (x,I) in
paths to each
of the gateways forwarding table

Network Layer 4-158


Intra-AS Routing
 Also known as Interior Gateway Protocols (IGP)
 Most common Intra-AS routing protocols:

 RIP: Routing Information Protocol


 OSPF: Open Shortest Path First

 Inter-AS Routing
 BGP: Border Gateway Protocol

Network Layer 4-159


RIP ( Routing Information Protocol)

 Distance vector algorithm


 Included in BSD-UNIX Distribution in 1982
 Distance metric: # of hops (max = 15 hops)

u destination hopsfromA
v
u 1
A B w v 2
w 2
x 3
x y 3
z C D z 2
y

Network Layer 4-160


RIP advertisements

 Distance vectors: exchanged among neighbors every 30


sec via Response Message (also called advertisement)
 Each advertisement: list of up to 25 destination nets
within AS

Network Layer 4-161


OSPF (Open Shortest Path First)

 “open”: publicly available


 Uses Link State algorithm
 LS packet dissemination
 Topology map at each node
 Route computation using Dijkstra’s algorithm

 OSPF advertisement carries one entry per neighbor


router
 Advertisements disseminated to entire AS (via flooding)
 Carried in OSPF messages directly over IP (rather than TCP or
UDP

Network Layer 4-166


OSPF “advanced” features (not in RIP)

 Security: all OSPF messages authenticated (to prevent


malicious intrusion)
 Multiple same-cost paths allowed (only one path in RIP)
 For each link, multiple cost metrics for different TOS
(e.g., satellite link cost set “low” for best effort; high for
real time)
 Integrated uni- and multicast support:
 Multicast OSPF (MOSPF) uses same topology
data base as OSPF
 Hierarchical OSPF in large domains.

Network Layer 4-167


Hierarchical OSPF

Network Layer 4-168


Hierarchical OSPF

 Two-level hierarchy: local area, backbone.


 Link-state advertisements only in area
 each nodes has detailed area topology; only
know direction (shortest path) to nets in other
areas.
 Area border routers: “summarize” distances to nets
in own area, advertise to other Area Border routers.
 Backbone routers: run OSPF routing limited to
backbone.
 Boundary routers: connect to other AS’s.

Network Layer 4-169


Internet inter-AS routing: BGP

 BGP (Border Gateway Protocol)


 BGP provides each AS a means to:
1. Obtain subnet reachability information from neighboring ASs.
2. Propagate the reachability information to all routers internal to
the AS.
3. Determine “good” routes to subnets based on reachability
information and policy.
 Allows a subnet to advertise its existence to rest of the
Internet: “I am here”

Network Layer 4-170


BGP basics
 Pairs of routers (BGP peers) exchange routing info over semi-
permanent TCP conctns: BGP sessions
 Note that BGP sessions do not correspond to physical links.
 When AS2 advertises a prefix to AS1, AS2 is promising it will
forward any datagrams destined to that prefix towards the prefix.
 AS2 can aggregate prefixes in its advertisement

3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
AS1 1d
eBGP session
iBGP session
Network Layer 4-171
Distributing reachability info
 With eBGP session between 3a and 1c, AS3 sends prefix
reachability info to AS1.
 1c can then use iBGP do distribute this new prefix reach info to
all routers in AS1
 1b can then re-advertise the new reach info to AS2 over the 1b-
to-2a eBGP session
 When router learns about a new prefix, it creates an entry for
the prefix in its forwarding table.

3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
AS1 1d
eBGP session
iBGP session
Network Layer 4-172
Path attributes & BGP routes
 When advertising a prefix, advert includes BGP attributes.
 prefix + attributes = “route”
 Two important attributes:
 AS-PATH: contains the ASs through which the advert for the prefix passed: AS 67 AS 17
 NEXT-HOP: Indicates the specific internal-AS router to next-hop AS. (There may be
multiple links from current AS to next-hop-AS.)
 When gateway router receives route advert, uses import policy to
accept/decline.

Network Layer 4-173


BGP route selection

 Router may learn about more than 1 route to some


prefix. Router must select route.
 Elimination rules:
1. Local preference value attribute: policy decision
2. Shortest AS-PATH
3. Closest NEXT-HOP router: hot potato routing
4. Additional criteria

Network Layer 4-174


MPLS (Multi Protocol Label Switching)
• MPLS (Multi Protocol Label Switching) is a mechanism that switches traffic
based on labels instead of routing traffic.
• It’s typically seen in service provider networks and can transport every
traffic…IP, IPv6, Ethernet, frame-relay, PPP, etc
• It is data forwarding technology that increases the speed and controls the
flow of network traffic.
• With MPLS, data is directed through a path via labels instead of requiring
complex lookups in a routing table at every stop.
• When data enters a traditional IP network, it moves among network nodes
based on long network addresses. Here, each router on which a data
packet lands must make its own decision, based on routing tables, about
the packet’s next stop on the network. MPLS, on the other hand, assigns a
label to each packet to send it along a predetermined path.
MPLS and ISO model
(MPLS is a layer 2.5 protocol)

Applications

TCP UDP
IP
MPLS MPS
PPP FR ATM Ethernet DWDM
Physical

When a layer is added, no modification is needed


on the existing layers.
Label Switching

• What is it?
• Goal: sending a packet from A to B
• We can do it in a broadcast way.
• We can use source routing where the source determines
the path.
• How do we do it on the Internet today?
• Hop-by-hop routing: continue asking who is closer to B at every
stop (hop).
MPLS

• A protocol to establish an end-to-end path from


source to the destination
• A hop-by-hop forwarding mechanism
• Use labels to set up the path
• Require a protocol to set up the labels along the path
• It builds a connection-oriented service on the IP
network
Terminology
• LSR - Routers that support MPLS are called Label Switch Router
• LER - LSR at the edge of the network is called Label Edge Router (a.k.a Edge
LSR)
• Ingress LER is responsible for adding labels to unlabeled IP packets.
• Egress LER is responsible for removing the labels.
• Label Switch Path (LSP) – the path defined by the labels through LSRs
between two LERs.
• Label Forwarding Information Base (LFIB) – a forwarding table (mapping)
between labels to outgoing interfaces.
• Forward Equivalent Class (FEC) – All IP packets follow the same path on the
MPLS network and receive the same treatment at each node.
How does it work?

Add label at the remove label at


ingress LER the egress LER

LSR LSR LER


LER

IP IP #L1 IP #L2 IP #L3 IP

IP Label Label IP
Routing Switching Switching Routing
MPLS Operation

Label Path: R1 => R2 => R3 => R4


Label Forwarding Information Base (LFIB)

Router Incoming Incoming Destination Outgoing Outgoing


Interface Network
Label Interface Label
(FEC)

R1 --- E0 172.16.1.0
S1 6

R2 6 S0 172.16.1.0
S2 11

R3 11 S0 172.16.1.0
S3 7

R4 7 S1 172.26.1.0
E0 --
Q: create LFIB for R4 => R3 => R2 => R1
Routing in Mobile Ad Hoc Networks
(MANETs)
Mobile Ad Hoc Networks (MANET)

 Host movement frequent


 Topology change frequent

B
A A
B

 No cellular infrastructure. Multi-hop wireless links.


 Data must be routed via intermediate nodes.
Why Ad Hoc Networks ?

 Setting up of fixed access points and backbone infrastructure is not always


viable
– Infrastructure may not be present in a disaster area or war zone
– Infrastructure may not be practical for short-range radios; Bluetooth (range ~ 10m)

 Ad hoc networks:
– Do not need backbone infrastructure support
– Are easy to deploy
– Useful when infrastructure is absent, destroyed or impractical
Many Applications

 Personal area networking


– cell phone, laptop, ear phone, wrist watch
 Military environments
– soldiers, tanks, planes
 Civilian environments
– taxi cab network
– meeting rooms
– sports stadiums
– boats, small aircraft
 Emergency operations
– search-and-rescue
– policing and fire fighting
Challenges in Mobile Environments

 Limitations of the Wireless Network


 packet loss due to transmission errors
 variable capacity links
 frequent disconnections/partitions
 limited communication bandwidth
 Broadcast nature of the communications

 Limitations Imposed by Mobility


 dynamically changing topologies/routes
 lack of mobility awareness by system/applications

 Limitations of the Mobile Computer


 short battery lifetime
 limited capacities
Routing in MANET
Routing Protocols
 Proactive protocols
– Traditional distributed shortest-path protocols
– Maintain routes between every host pair at all times
– Based on periodic updates; High routing overhead
– Example: DSDV (destination sequenced distance vector)

 Reactive protocols
– Determine route if and when needed
– Source initiates route discovery
– Example: DSR, AODV

 Hybrid protocols
– Adaptive; Combination of proactive and reactive
– Example : ZRP (zone routing protocol)
Reactive Routing Protocols
Dynamic Source Routing (DSR)

 Reactive
 When node S wants to send a packet to node D, but does not know a route to D,
node S initiates a route discovery

 Source node S floods Route Request (RREQ)

 Each node appends own identifier when forwarding RREQ


Route Discovery in DSR
Y

Z
S E
F
B
C M L
J
A G
H D
K
I N

Represents a node that has received RREQ for D from S


Route Discovery in DSR
Y
Broadcast transmission

[S] Z
S E
F
B
C M L
J
A G
H D
K
I N

Represents transmission of RREQ

[X,Y] Represents list of identifiers appended to RREQ


Route Discovery in DSR
Y

Z
S [S,E]
E
F
B
C M L
J
A [S,C] G
H D
K
I N

• Node H receives packet RREQ from two neighbors:


potential for collision
Route Discovery in DSR
Y

Z
S E
F [S,E,F]
B
C M L
J
A G
H D
[S,C,G] K
I N

• Node C receives RREQ from G and H, but does not forward


it again, because node C has already forwarded RREQ once
Route Discovery in DSR
Y

Z
S E
F [S,E,F,J]
B
C M L
J
A G
H D
K
I [S,C,G,K] N

• Nodes J and K both broadcast RREQ to node D


• Since nodes J and K are hidden from each other, their
transmissions may collide
Route Discovery in DSR
Y

Z
S E
[S,E,F,J,M]
F
B
C M L
J
A G
H D
K
I N

• Node D does not forward RREQ, because node D


is the intended target of the route discovery
Route Discovery in DSR

 Destination D on receiving the first RREQ, sends a Route Reply (RREP)

 RREP is sent on a route obtained by reversing the route appended to received


RREQ

 RREP includes the route from S to D on which RREQ was received by node D
Route Reply in DSR
Y

Z
S RREP [S,E,F,J,D]
E
F
B
C M L
J
A G
H D
K
I N

Represents RREP control message


Dynamic Source Routing (DSR)

 Node S on receiving RREP, caches the route included in the RREP

 When node S sends a data packet to D, the entire route is included in the packet
header
– hence the name source routing

 Intermediate nodes use the source route included in a packet to determine to


whom a packet should be forwarded
Data Delivery in DSR
Y

DATA [S,E,F,J,D] Z
S E
F
B
C M L
J
A G
H D
K
I N

Packet header size grows with route length


DSR Optimization: Route Caching

 Each node caches a new route it learns by any means


 When node S finds route [S,E,F,J,D] to node D, node S also learns route [S,E,F]
to node F
 When node K receives Route Request [S,C,G] destined for node, node K learns
route [K,G,C,S] to node S
 When node F forwards Route Reply RREP [S,E,F,J,D], node F learns route
[F,J,D] to node D
 When node E forwards Data [S,E,F,J,D] it learns route [E,F,J,D] to node D
 A node may also learn a route when it overhears Data
 Problem: Stale /old caches may increase overheads
Dynamic Source Routing: Advantages

 Routes maintained only between nodes who need to communicate


– reduces overhead of route maintenance

 Route caching can further reduce route discovery overhead

 A single route discovery may yield many routes to the destination, due to
intermediate nodes replying from local caches
Dynamic Source Routing: Disadvantages
 Packet header size grows with route length due to source
routing

 Flood of route requests may potentially reach all nodes in


the network

 Potential collisions between route requests propagated by


neighboring nodes
– insertion of random delays before forwarding RREQ

 Increased contention if too many route replies come back


due to nodes replying using their local cache
– Route Reply Storm problem

 Stale caches will lead to increased overhead


Ad Hoc On-Demand Distance Vector Routing (AODV)

 DSR includes source routes in packet headers


 Resulting large headers can sometimes degrade performance
– particularly when data contents of a packet are small

 AODV attempts to improve on DSR by maintaining routing tables at the nodes,


so that data packets do not have to contain routes

 AODV retains the desirable feature of DSR that routes are maintained only
between nodes which need to communicate
AODV

 Route Requests (RREQ) are forwarded in a manner similar to DSR

 When a node re-broadcasts a Route Request, it sets up a reverse path pointing


towards the source
– AODV assumes symmetric (bi-directional) links

 When the intended destination receives a Route Request, it replies by sending a


Route Reply (RREP)

 Route Reply travels along the reverse path set-up when Route Request is
forwarded
Route Requests in AODV
Y

Z
S E
F
B
C M L
J
A G
H D
K
I N

Represents a node that has received RREQ for D from S


Route Requests in AODV
Y
Broadcast transmission

Z
S E
F
B
C M L
J
A G
H D
K
I N

Represents transmission of RREQ


Route Requests in AODV
Y

Z
S E
F
B
C M L
J
A G
H D
K
I N

Represents links on Reverse Path


Reverse Path Setup in AODV
Y

Z
S E
F
B
C M L
J
A G
H D
K
I N

• Node C receives RREQ from G and H, but does not forward


it again, because node C has already forwarded RREQ once
Reverse Path Setup in AODV
Y

Z
S E
F
B
C M L
J
A G
H D
K
I N
Reverse Path Setup in AODV
Y

Z
S E
F
B
C M L
J
A G
H D
K
I N

• Node D does not forward RREQ, because node D


is the intended target of the RREQ
Forward Path Setup in AODV
Y

Z
S E
F
B
C M L
J
A G
H D
K
I N

Forward links are setup when RREP travels along


the reverse path

Represents a link on the forward path


Route Request and Route Reply

 Route Request (RREQ) includes the last known sequence number for the destination

 An intermediate node may also send a Route Reply (RREP) provided that it knows a more
recent path than the one previously known to sender
 Intermediate nodes that forward the RREP, also record the next hop to destination

 A routing table entry maintaining a reverse path is purged after a timeout interval

 A routing table entry maintaining a forward path is purged if not used for a active_route_timeout
interval
AODV: Summary

 Routes need not be included in packet headers

 Nodes maintain routing tables containing entries only for routes that are in
active use
 At most one next-hop per destination maintained at each node
– DSR may maintain several routes for a single destination

 Sequence numbers are used to avoid old/broken routes


 Sequence numbers prevent formation of routing loops

 Unused routes expire even if topology does not change


Mobile Internet Protocol (or
Mobile IP)
Mobile IP

 Mobile IP is a communication protocol


 (created by extending Internet Protocol, IP) that allows the users to move from
one network to another with the same IP address.
 It ensures that the communication will continue without user’s sessions or
connections being dropped.
Terminologies:

 Mobile Node (MN)


 Home Network
 Home Agent (HA)
 Home Address
 Foreign Network
 Foreign Agent (FA)
 Correspondent Node (CN)
 Care of Address (COA)
Working

Key Mechanisms in Mobile IP:


-Agent Discovery
-Agent Registration
-Tunneling
Route Optimization in Mobile IP

 Route Optimization in Mobile IP:


The route optimization adds a conceptual data structure, the binding cache, to
the correspondent node.
 The binding cache contains bindings for mobile node’s home address and its
current care-of-address.
 Every time the home agent receives a IP datagram that is destined to a mobile
node currently away from the home network, it sends a binding update to the
correspondent node to update the information in the correspondent node’s
binding cache.
 After this the correspondent node can directly tunnel packets to the mobile node.

You might also like