CN Unit4
CN Unit4
Circuit Switching
Datagram Packet
Switching
Packet Switching
Virtual Packet
Switching
Message Switching
Circuit Switching
When two nodes communicate with each other over a
dedicated communication path, it is called circuit switching.
There 'is a need of pre-specified route from which data will
travels and no other data is permitted.
In circuit switching, to transfer the data, circuit must be
established so that the data transfer can take place.
Circuits can be permanent or temporary. Applications which
use circuit switching may have to go through three phases:
Establish a circuit
Transfer the data
Disconnect the circuit
Circuit Switching
Circuit switching was designed for voice applications.
Telephone is the best suitable example of circuit switching.
Before a user can make a call, a virtual path between caller
and callee is established over the network
Circuit Switched Networks
Message Switching
This technique was somewhere in middle of circuit switching
and packet switching. In message switching, the whole
message is treated as a data unit and is switching /
transferred in its entirety.
A switch working on message switching, first receives the
whole message and buffers it until there are resources
available to transfer it to the next hop.
If the next hop is not having enough resource to
accommodate large size message, the message is stored and
switch waits.
Message Switching
Message Switching drawbacks
12
Datagram
Each packet is treated independently, with no reference to
packets that have gone before.
Each node chooses the next node on a packet’s path.
Packets can take any possible route.
Packets may arrive at the receiver out of order.
Packets may go missing.
It is up to the receiver to re-order packets and recover from
missing packets.
Example: Internet
13
Datagram Approach
14
Virtual Circuit
In virtual circuit, a preplanned route is established before any
packets are sent, then all packets follow the same route.
Each packet contains a virtual circuit identifier instead
of destination address, and each node on the preestablished
route knows where to forward such packets.
The node need not make a routing decision for each packet.
Example: X.25, Frame Relay, ATM
15
Virtual
Circuit Approach
16
Comparison of Virtual-Circuit and Datagram
Subnets
5-4
Outline
Switching techniques,
IP Protocol,
IPv4 and IPv6 addressing schemes,
Subnetting,
NAT, CIDR,
ICMP,
Routing Protocols: Distance Vector, Link State, Path Vector,
Routing in Internet: RIP ,OSPF, BGP,
Congestion control and QoS,
MPLS,
Mobile IP,
Routing in MANET : AODV, DSR
IPv4 datagram format (IPV4 Header)
IPv4 datagram format (IPV4 Header)
20.22
Protocol values
Some of the IPv4 options.
5-54
Outline
Switching techniques,
IP Protocol,
IPv4 and IPv6 addressing schemes,
Subnetting,
NAT, CIDR,
ICMP,
Routing Protocols: Distance Vector, Link State, Path Vector,
Routing in Internet: RIP ,OSPF, BGP,
Congestion control and QoS,
MPLS,
Mobile IP,
Routing in MANET : AODV, DSR
IPv4 Addressing- Introduction
An IP address is a 32-bit address that uniquely
and universally defines the connection of a host
or a router to the Internet.
26
Note:
28
Example 1
Change the following IP addresses from binary notation to dotted-decimal
notation.
a. 10000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 11100111 11011011 10001011 01101111
d. 11111001 10011011 11111011 00001111
Solution
We replace each group of 8 bits with its equivalent decimal number and add
dots for separation:
a. 129.11.11.239 b. 193.131.27.255
c. 231.219.139.111 d. 249.155.251.15
29
Example 2
Solution
We replace each decimal number with its binary equivalent:
a. 01101111 00111000 00101101 01001110
b. 11011101 00100010 00000111 01010010
c. 11110001 00001000 00111000 00001100
d. 01001011 00101101 00100010 01001110
30
IP Addresses formats and ranges.
Finding the class in binary notation
Example
Solution
Solution
a. The first byte is 227 (between 224 and 239); the class is D.
b. The first byte is 193 (between 192 and 223); the class is C.
c. The first byte is 14 (between 0 and 127); the class is A.
d. The first byte is 252 (between 240 and 255); the class is E.
e. The first byte is 134 (between 128 and 191); the class is B.
Netid and hostid
Example
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.
Example
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.
Example
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.
Masking concept
Default masks
Note:
Solution
The default mask is 255.0.0.0,
which means that only the first byte is preserved
and the other 3 bytes are set to 0s.
The network address is 23.0.0.0.
Example
Solution
The default mask is 255.255.0.0,
which means that the first 2 bytes are preserved
and the other 2 bytes are set to 0s.
The network address is 132.6.0.0.
Example
Solution
The default mask is 255.255.255.0, which means
that the first 3 bytes are preserved and the last
byte is set to 0. The network address is
201.180.56.0.
Special IP addresses
.
IPv6 ADDRESSES
Solution
We apply the AND operation on the address and the subnet mask.
Example 1: A service provider has given you the Class C network range
209.50.1.0. Your company must break the network into 20 separate
subnets.
Solution
Step 1) Determine the number of subnets and convert to binary
-In this example, the binary representation of 20 = 00010100.
Step 2) Reserve required bits in subnet mask and find incremental value
- The binary value of 20 subnets tells us that we need at least 5 network bits to
satisfy this requirement
- Our original subnet mask is 255.255.255.0 (Class C subnet) - The full binary
representation of the subnet mask is as follows:
255.255.255.0 = 11111111.11111111.11111111.00000000
- We must “convert” 5 of the client bits (0) to network bits (1) in order to satisfy
the requirements:
New Mask = 11111111.11111111.11111111.11111000
-If we convert the mask back to decimal, we now have the subnet mask that
will be used on all the new
networks – 255.255.255.248 –
Our increment bit is the last possible network bit, converted back to a binary
number:
If you convert this bit to a decimal number, it becomes the number “8” that is
every subnet is having 8 addresses allotted to it (from 0 to 7, then 8 to 15 etc)
You can now fill in your end ranges, which is the last possible IP address
before you start the next range
209.50.1.0 – 209.50.1.7
209.50.1.8 – 209.50.1.15
209.50.1.16 – 209.50.1.23 …etc
Remember the first and last address from each range (network /
broadcast IP) are unusable
Example 1: A service provider has given you the Class C network range
209.50.1.0. Your company must break the network into as many subnets as
possible as long as there are at least 50 clients per network.
Solution
Step 1) Determine the number of clients and convert to binary
-In this example, the binary representation of 50 = 00110010
-Step 2) Reserve required bits in subnet mask and find incremental value
- The binary value of 50 clients tells us that we need at least 6 client bits to satisfy
this requirement
- Our original subnet mask is 255.255.255.0 (Class C subnet) - The full binary
representation of the subnet mask is as follows:
255.255.255.0 = 11111111.11111111.11111111.00000000
-We must ensure 6 of the client bits (0) remain client bits (save the clients!) in
order to satisfy the requirements. All other bits can become network bits:
-New Mask = 11111111.11111111.11111111.11 000000
- note the 6 client bits that we have saved
-If we convert the mask back to decimal, we now have the subnet mask that
will be used on all the new networks –
255.255.255.192
Our increment bit is the last possible network bit, converted back to a binary
number:
If you convert this bit to a decimal number, it becomes the number “64” (i.e
from 0 to 63, 64 to 127 etc)
209.50.1.0 – 209.50.1.63
209.50.1.64 – 209.50.1.127
209.50.1.128 – 209.50.1.191
209.50.1.192 – 209.50.1.255
Remember the first and last address from each range (network /
broadcast IP) are unusable
Example - You are given the following IP address and subnet mask:
192.168.1.58 255.255.255.240 Identify the original range of addresses
(the subnet) that this IP address belongs to
Solution
Break the subnet mask back into binary
255.255.255.240 = 11111111.11111111.11111111.11110000
- Now, fill in the end ranges to find the answer to the scenario:
192.168.1.0 – 192.168.1.15
192.168.1.16 – 192.168.1.31
192.168.1.32 – 192.168.1.47
192.168.1.48 – 192.168.1.63
(IP address 192.168.1.58 belongs to this range)
Example: 142.4.7.3/27
Here /27 means from total 31bit address first 27 bits are
for Network and remaining i.e. 32-27=5 bits are for host
Prefix lengths
The addresses in color are the default masks for classes A, B, and C.
Thus, classful addressing is a special case of classless addressing.
Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32−28 = 4 rightmost bits to 0, we get
11001101 00010000 00100101 0010000
or
205.16.37.32.
19.84
Note
19.85
Example 19.7
Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32 − 28=4 rightmost bits to 1, we get
11001101 00010000 00100101 00101111
or
205.16.37.47
19.86
Note
19.87
Example 19.8
Solution
The value of n is 28, which means that number
of addresses is 2 32−28 or 16.
19.88
Example 19.9
Another way to find the first address, the last address, and
the number of addresses is to represent the mask as a 32-bit
binary (or 8-digit hexadecimal) number. This is
particularly useful when we are writing a program to find
these pieces of information. In Example 19.5 the /28 can be
represented as
11111111 11111111 11111111 11110000
(twenty-eight 1s and four 0s).
Find
a. The first address
b. The last address
c. The number of addresses.
19.89
Example 19.10
Solution
.
Group 1
For this group, each customer needs 256 addresses. This
means that 8 (log2 256) bits are needed to define each host.
The prefix length is then 32 − 8 = 24. The addresses are
19.91
Example 19.10 (continued)
Group 2
For this group, each customer needs 128 addresses. This
means that 7 (log2 128) bits are needed to define each host.
The prefix length is then 32 − 7 = 25. The addresses are
19.92
Example 19.10 (continued)
Group 3
For this group, each customer needs 64 addresses. This
means that 6 (log264) bits are needed to each host. The
prefix length is then 32 − 6 = 26. The addresses are
19.94
Addresses for private networks
NAT – Network Address Translation
Placement and operation of a NAT box.
A NAT implementation
19.97
Addresses in a NAT
19.98
NAT address translation
19.99
Outline
Switching techniques,
IP Protocol,
IPv4 and IPv6 addressing schemes,
Subnetting,
NAT, CIDR,
ICMP,
Routing Protocols: Distance Vector, Link State, Path Vector,
Routing in Internet: RIP ,OSPF, BGP,
Congestion control and QoS,
MPLS,
Mobile IP,
Routing in MANET : AODV, DSR
ICMP V4 -Introduction
The IP protocol has no error-reporting or error
correcting mechanism.
What happens if something goes wrong? What
happens if a router must discard a datagram because it
cannot find a router to the final destination, or
Because the time-to-live field has a zero value?
These are examples of situations where an error has
occurred and the IP protocol has no built-in mechanism
to notify the original host.
The solution is ICMP protocol
ICMP V4 -MESSAGES
ICMP messages are divided into two broad categories:
1. error-reporting messages
2. query messages.
The error-reporting messages report problems that a
router or a host (destination) may encounter when it
processes an IP packet.
The query messages, help a host or a network manager get
specific information from a router or another host. Also,
hosts can discover and learn about routers on their network
and routers can help a node redirect its messages.
General format of ICMP messages or
ICMP header
Basic ICMP Header
Headers are 32 bits in length; all contain same
three fields
◦ type - 8 bit message type code
Thirteen message type are defined
◦ code - 8 bit;
• indicating why message is being sent
◦ checksum - standard internet checksum
for purpose of calculation the checksum field is set to zero
Error-reporting messages
Query Messages
Query Messages
108
Error-reporting messages
109
Informational Messages
110
Neighbor-Discovery Messages
111
Outline
Switching techniques,
IP Protocol,
IPv4 and IPv6 addressing schemes,
Subnetting,
NAT, CIDR,
ICMP,
Routing Protocols: Distance Vector, Link State, Path Vector,
Routing in Internet: RIP ,OSPF, BGP,
Congestion control and QoS,
MPLS,
Mobile IP,
Routing in MANET : AODV, DSR
INTER-AND INTRA-DOMAIN ROUTING
Example:
Assume each node as the cities.
Lines as the roads connecting them.
Distance Vector Routing-Initialization
1
2
2
Distance Vector Routing-Sharing
Idea is to share the information between neighbors.
The node A does not know the distance about E, but node C
does.
If node C share it routing table with A, node A can also know
how to reach node E.
On the other hand, node C does not know how to reach node
D, but node A does.
If node A share its routing table with C, then node C can also
know how to reach node D.
Node A and C are immediate neighbors, can improve their
routing tables if they help each other.
Distance Vector Routing-Sharing
How much of the table must be shared with each neighbor?
The third column of the table(next hop) is not useful for the
neighbor.
When the neighbor receives a table, this column needs to be
replaced with the sender’s name.
If any of the rows can be used, the next node column filled with
sender of the table.
Therefore, a node can send only the first two column of its table to
any neighbor.
Updating in distance vector routing
example: C to A
From C From A
Since B doesn't know that the path from C to A is through itself (B), it
updates its table with the new value "B to A = 2 + 1".
Later on, B forwards the update to C and due to the fact that A is
reachable through B (From C point of view), C decides to update its
table to "C to A = 3 + 1".
The hop-count is the number of networks that a packet encounters to reach its destination.
Path costs are based on number of hops.
In distance vector routing, each router periodically shares its table with its
neighbour.
Each router keeps a routing table that has one entry for each destination network . The
1 entry consists of Destination Network Address, Hop-Count and Next-Router.
3
2
An Example of RIP
Request
• A request message is sent by a router
that has just come up
Response
• A response can be within 30s or when
there is a change in the routing table
RIP Timers
Periodic timer
• Routing tables are exchanged every 30
seconds using the RIP advertisement.
Expiration timer
• If a router does not hear from its
neighbor once every 180 seconds, the
neighbor is deemed unreachable.
LINK STATE ROUTING
(a) A subnet. (b) The link state packets for this subnet.
Send this packet to all other routers
and compute the shortest path
From this database each router calculates a shortest path tree with
itself the root.
This shortest path tree in turn yields a routing table for the
protocol.
OSPF- Routing protocol packets
When BGP runs between two peers in the same autonomous system
(AS), it is referred to as Internal BGP (iBGP or Interior Border
Gateway Protocol).
Notification
• Used for error notification
• TCP connection is closed immediately after notification
BGP – Example
AS_PATH
• The list of ASs through which the destination can be
reached
NEXT-HOP
• The next router to which the data packet should be sent
Outline
Switching techniques,
IP Protocol,
IPv4 and IPv6 addressing schemes,
Subnetting,
NAT, CIDR,
ICMP,
Routing Protocols: Distance Vector, Link State, Path Vector,
Routing in Internet: RIP ,OSPF, BGP,
ARP and RARP
MPLS,
Mobile IP,
Routing in MANET : AODV, DSR
ARP and RARP
ARP (Address Resolution Protocol)
ARP associates an IP address with its physical address. On a typical physical
network, such as a LAN, each device on a link is identified by a physical or
station address that is usually imprinted on the NIC.
160
ARP packet
Note
RARP finds the logical address for a machine that only knows its physical
address. RARP requests are broadcast, RARP replies are unicast.
163
RARP operation
RARP packet
Outline
Switching techniques,
IP Protocol,
IPv4 and IPv6 addressing schemes,
Subnetting,
NAT, CIDR,
ICMP,
Routing Protocols: Distance Vector, Link State, Path Vector,
Routing in Internet: RIP ,OSPF, BGP,
ARP and RARP
MPLS,
Mobile IP,
Routing in MANET : AODV, DSR
Motivation
• MPLS Characteristics
o Mechanisms to manage traffic flows of various
granularities (Flow Management)
o Is independent of Layer-2 and Layer-3 protocols
o Maps IP-addresses to fixed length labels
o Supports ATM, Frame-Relay and Ethernet
Label
• Advantages
• Disad.
Agent Discovery
HA’s and FA’s broadcast their presence on each network to which they
are attached
MN’s listen for advertisement and then initiate registration
Registration
When MN is away, it registers its COA with its HA, via FA
Registration control messages sent via UDP to well known port
Encapsulation/decapsulation – just like standard IP only with COA
Mobile IP Operation
A MN listens for agent advertisement and then initiates registration
If responding agent is the HA, then mobile IP is not necessary
After receiving the registration request from a MN, the HA acknowledges
and registration is complete
Registration happens as often as MN changes networks
HA intercepts all packets destined for MN
This is simple unless sending application is on or near the same network as the MN
HA masquerades as MN
There is a specific lifetime for service before a MN must re-register
There is also a de-registration process with HA if an MN returns home
Outline
Switching techniques,
IP Protocol,
IPv4 and IPv6 addressing schemes,
Subnetting,
NAT, CIDR,
ICMP,
Routing Protocols: Distance Vector, Link State, Path Vector,
Routing in Internet: RIP ,OSPF, BGP,
Congestion control and QoS,
MPLS,
Mobile IP,
Routing in MANET : AODV, DSR
Routing in MANET
Unicast Routing Protocols
Many protocols have been proposed
protocols •
•
Based on periodic updates; High routing overhead
Example: DSDV (destination sequenced distance vector)
protocols •
•
Consume bandwidth to keep routes up-to-date
Maintain routes which may never be used
Reactive •
•
Lower overhead since routes are determined on demand
Significant delay in route determination
protocols •
•
Employ flooding (global search)
Control traffic may be bursty
Z
S E
F
B
C M L
J
A G
H D
K
I N
[S] Z
S E
F
B
C M L
J
A G
H D
K
I N
Z
S [S,E]
E
F
B
C M L
J
A [S,C] G
H D
K
I N
Z
S E
F [S,E,F]
B
C M L
J
A G
H D
[S,C,G] K
I N
Z
S E
F [S,E,F,J]
B
C M L
J
A G
H D
K
I [S,C,G,K] N
Z
S E
[S,E,F,J,M]
F
B
C M L
J
A G
H D
K
I N
Z
S RREP [S,E,F,J,D]
E
F
B
C M L
J
A G
H D
K
I N
DATA [S,E,F,J,D] Z
S E
F
B
C M L
J
A G
H D
K
I N
Z
S E
F
B
C M L
J
A G
H D
K
I N
Z
S E
F
B
C M L
J
A G
H D
K
I N
Z
S E
F
B
C M L
J
A G
H D
K
I N
Z
S E
F
B
C M L
J
A G
H D
K
I N
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
Z
S E
F
B
C M L
J
A G
H D
K
I N
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
When the next hop link in a routing table entry breaks, all active neighbors are
informed
Link failures are propagated by means of Route Error (RERR) messages, which
also update destination sequence numbers
Route Error
When node X is unable to forward packet P (from node S to node D) on link
(X,Y), it generates a RERR message
When node S receives the RERR, it initiates a new route discovery for D using
destination sequence number at least as large as N
When node D receives the route request with destination sequence number N,
node D will set its sequence number to N, unless it is already larger than N
AODV: Summary
Routes need not be included in packet headers