0% found this document useful (0 votes)
18 views95 pages

Unit 4 (3150710 - Computer Networks)

Uploaded by

nayanas.kv241993
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views95 pages

Unit 4 (3150710 - Computer Networks)

Uploaded by

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

3150710 – Computer Networks

Unit - 4

Network Layer
I N T RO D U C T I O N : N E T WO R K L AY E R

applicatio
ntransport

d
networ
kata link
 To deliver segment from
physical
networ
sending to receiving
host/ router.
networ
d
kata d
kata
networ link
link
physic
d
kata
al physic  On sending side,
link
physic networ alnetwor
al dkata kata
d encapsulates
it segments
link
physic
al
link
physic into datagrams.
networ
al
networ
 On receiving side,
d
kata
dkata
link
physic
n twor
link delivers segments it
al e k
data
link
physic
physic
al transport layer. to
al applicatio  Network layer
networ
d
kata networ
ntranspo
rt in every host and router.
protocols
link
physic networ
data  Router examines header
networ kata
d
kata
d al link
physic k
physical
link
physic
al
al link
fields in all IP
datagrams passing
through it.
K E Y F U N C T I O N O F N E T WO R K L AY E R
 Role of the network layer is simple - to move packets
from a sending host to a receiving host.
 Two important network layer functions can
be identified:
1. Forwarding
⚫ When a packet arrives at a router’s input link, the router
must move the packet to the appropriate output link.
2. Routing
⚫ It’s a process of selecting best paths in a network.
⚫ The network layer must determine the route or path taken
by packets as they flow from a sender to a receiver.
⚫ The algorithms that calculate these paths are referred to
as routing algorithms.
R O U T I N G A N D F O RWA R D I N G

routing routing algorithm


algorithm end-end-path
determines through

local forwarding network forwarding table


table value output
header local forwarding at this
determines
link 0100 3 router
0101 2
0111 2
1001 1

value in
arriving
packet’s 1
011
header 1
3 2
N E T WO R K S E RV I C E M O D E L
 Services provided by network layer for individual
datagrams.
 Guaranteed delivery

⚫ This service guarantees that the will


packet eventually arrive at its destination.
 Guaranteed delivery with bounded
delay
⚫ This service not only guarantees delivery of the
packet, but delivery within a specified host-to-host
delay bound.
N E T WO R K S E RV I C E M O D E L – C O N T …
 Services provided by network layer for a flow of
datagrams.
 In-order packet delivery

⚫ This service guarantees that packets arrive at the


destination in the order that they were sent.
 Guaranteed minimal bandwidth
⚫ This network-layer service emulates the behaviour of
a transmission link of a specified bit rate (for
example, 1 Mbps) between sending and receiving
hosts.
⚫ As long as the sending host transmits bits at a rate
below the specified bit rate, then no packet is lost.
N E T WO R K S E RV I C E M O D E L – C O N T …
 Guaranteed maximum jitter
⚫ This service guarantees that the amount of time
between the transmission of two successive packets
at the sender is equal to the amount of time between
their receipt at the receiver.
 Security services
⚫ Using a secret session key known only by a source
and destination host, the network layer in the source
host could encrypt the payloads of all datagrams
being sent to the destination host.
⚫ The network layer in the destination host would then
be responsible for decrypting the payloads.
C O N N E C T I O N -O R I E N T E D V S . C O N N E C T I O N
LESS

Transport Layer Network Layer

process to- process services host-to-host services

U D P, a connectionless service connectionless service at the


network layer are called datagram
networks.

does not have any handshaking


preliminaries.

TCP, a connection-oriented service. connection service at the network


layer are called virtual-circuit
(VC) networks;
handshaking between the source and
destination hosts
8
V I RT UA L C I RC U I T S W I T C H I N G
 A V C consists of
1. A path between the source and destination hosts
2. V C numbers, one number for each link along the
path
3. Entries in the forwarding table in each router
along the path
 A packet belonging to a virtual circuit will carry a
V C number in its header.
 V C number can be changed on each link

⚫ New V C number comes from forwarding table


V C F O RWA R D I N G T A B L E
12 22 32
1 3
2
V C number
interface
forwarding table in number
router:
Incoming interface Incoming V C # Outgoing interface Outgoing V C

1 12 3 22
2 63 1 18
3 7 2 17
1 97 3 87
… … … …

V C routers maintain connection state information


V I RT UA L C I RC U I T S E T U P
There are three identifiable phases in a virtual
circuit:
1. V C setup

2. Data transfer

3. V C teardown

applicatio applicatio
6. receive
ntranspor 5. data flow ntranspor
data
tnetwork begins tnetwork
data link 4. call 3. accept
data link
connected call
physical physical
1. initiate call 2. incoming
call
D ATAG R A M N E T WO R K
 In connectionless service, packets are injected
into the subnet individually and routed
independently of each other.
 No advance setup is needed. The packets are
frequently called datagrams and the subnet is
called a datagram subnet.
 Only directly-connected lines can be used.

applicatio applicatio
ntranspor ntranspor
tnetwork 1. send tnetwork
2. receive
data link datagrams datagrams data link
physical physical
D ATAG R A M N E T WO R K VS. V I RT UA L C I R C U I T N E T WO R K

Datagram Virtual Circuit

Connection Setup None Required


Addressing Packet contains full source Each virtual circuit
and destination address number entered to table on
setup, used
for routing.
State Information None other than router Route established at setup, all
table containing destination packets follow same route.
network
Effect of Router Only on packets lost during All virtual circuits passing
Failure crash through failed router
terminated.
Congestion Difficult since all packets Simple by pre-allocating enough
Control routed independently buffers to each virtual circuit at
router resource setup, since maximum number
requirements of circuits fixed.
can
vary.
D ATAG R A M S W I T C H I N G V S . V I RT UA L C I RC U I T

Datagram Switching Virtual Circuit


Connectionless Connection Oriented
No Reservation Reservation
(Bandwidth, CPU Memory, Buffer)
May or May Use different Path Same Path
Out of Order Same Order
High Overhead Less Overhead
Packet Lost High Packet Lost Less
Used in Internet Used in X.35, Frame, Relay, ATM
Less Costly Costly
Not Reliable Highly Reliable
R O U T E R A RC H I T E C T U R E
 Routers have four components:
1. Input ports
2. Switching fabric
3. Output ports
4. Routing processor
I N P U T P O RT F U N C T I O N S

lookup,
link forwardi
line layer ng switc
terminati protoco h
on l fabri
(receiv queuein
c
e) g
 It performs the physical layer function of terminating an incoming
physical link at a router.
 It performs link-layer functions needed to interoperate with the
link layer at the other side of the incoming link; this is represented
by the middle boxes in the input and output ports.
 A lookup function is performed at the input port;
⚫ this will occur in the rightmost box of the input port.
 Goal: Complete input port processing at line speed
 Queuing: If datagrams arrive faster than forwarding rate into
switch fabric
I N P U T P O RT F U N C T I O N S – C O N T …
 The forwarding table is consulted to determine
the router output port to which an arriving
packet will be forwarded via the switching fabric.
 Control packets (for example, packets carrying

routing protocol information) are forwarded from


an input port to the routing processor.
SWITCHING FABRICS
 It connects the router’s input ports to its output
ports.
 It is completely contained within the router -
a network inside of a network router.
 Switching rate: A rate at which packets can
be transfer from inputs to outputs.
 Also measured as multiple of input/output
line rate.
 Three types of switching fabrics:

memor
y

memor bu crossba
y s r
S W I T C H I N G VIA M E M O RY

input output
port port
memory
(e.g., (e.g.,
Etherne Etherne
t) t)
system bus

 Like traditional computers, with switching between input


and output ports being done under direct control of the C P U
(routing processor).
 Packet signalled a routing processor via an interrupt then
copied from the input port into processor memory.
 traditional computers with switching under direct control of
CPU
 packet copied to system’s memory
 speed limited by memory bandwidth (2 bus crossings
per datagram)
S W I T C H I N G VIA M E M O RY – C O N T …
 Routing processor extracted the destination
address from the header, from forwarding table,
and copied the packet to the output port’s buffers.
 If the memory bandwidth is such that B packets

per second can be written into, or read from, then


the overall forwarding throughput must be less
than B/2.
 Two packets cannot be forwarded at the same

time, even if they have different destination


ports.
 Only one memory read/write over the shared

system bus can be done at a time.


S W I T C H I N G VIA B U S
 An input port transfers a packet to the
output port over a shared bus, without
intervention by the routing processor.
 The packet is received by all output ports,

but only the port that matches the label will


keep the packet.
 The label is then removed at the output bu
port, and only used within the switch to s
cross the bus.
 Switching speed of the router is limited to
the bus speed.
 datagram from input port memory
to output port memory via a shared bus
 bus contention: switching speed limited by
bus bandwidth
S W I T C H I N G VIA A N I N T E RC O N N E C T I O N N E T WO R K
 Crossbar switch consists 2N buses.
 N input ports to N output ports.

 Its overcome the bandwidth limitation of

shared bus; used to interconnect


processors in a multiprocessor computer
architecture.
 Cross-point connection can be opened or

closed at any time by the switch fabric


controller.
 Crossbar networks are capable of
forwarding multiple packets in parallel.
O U T P U T P O RT

datagra
switc m link
h buffer layer line
fabri protoc terminati
c queuein ol on
g (send)

 It buffers packets received from the switching fabric


and transmits these packets on the outgoing link.
 Packets can be lost due to congestions lacks of buffers.
 When a link is bidirectional, an output port will
typically be paired with the input port for that link on
the same line card.
 buffering required when datagrams arrive from fabric
faster than the transmission rate
 scheduling discipline chooses among queued
datagrams for transmission
ROUTING PROCESSOR

 The processor executes the routing


routing maintains routing tables and attached
protocols,
link state information and computes the
forwarding table for the router.
 It also performs the network management

functions.
I N T E R N E T N E T WO R K L AY E R

transport layer: TCP, UDP

routing protocols IP protocol


• path selection • addressing
conventions
networ • RIP, OSPF, BGP • datagram format
k • packet handling
conventions
layer
forwarding
table

ICMP protocol
• error reporting
• router
“signaling”

link layer

physical layer
IP V 4 D ATAG R A M F O R M AT
IP protocol 32
version numb total
bits datagram
er header
length ver head. type lengt length
( h fragme (bytes)
of flg
bytes len nt for
time uppe s heade
) offset fragmentati
“type” r
to service checksu
r
live laye on/
of data 16-bit32 bit source IP m reassembly
r
address
identifier
max 32 bit destination IP
number address
remaining options (if e.g.
hops any) timestamp,
how much overhead? data record route
(decremented
 20 bytes of
at TCP
each (variable taken,
 20 bytes ofrouter)
length, specify list
IP
typically a TCP of routers to
 = 40 bytes
upper+layer visit.
application or UDP
protocol to segment)
layer
deliver payload
overhead to
F R AG M E N TAT I O N
E X A M P LE
 An IP datagram of size 1000 bytes arrives at a router. The router has to
forward this packet on a link whose M T U (maximum transmission unit) is 100
bytes. Assume that the size of the IP header is 20 bytes. The number of
fragments that the IP datagram will be divided into for transmission is :
Note : This question was asked as Numerical Answer Type.
(A) 10
(B) 50
(C) 12
(D) 13

Explanation: M T U = 100 bytes


Size of IP header = 20 bytes
So, size of data that can be transmitted in one fragment = 100 – 20 = 80 bytes
Size of data to be transmitted = Size of datagram – size of header = 1000 – 20 =
980 bytes
Now, we have a datagram of size 1000 bytes.
So, we need ceil(980/80) = 13 fragments.
Thus, there will be 13 fragments of the datagram.
IP A D D R E S S
 IP addresses are useful in identifying a specific
host in a network.
 IP addresses are 32 bit numbers which are

divided into 4 octets. Each octet represents 8 bit


binary number.
 Below is an example of an IP address:

10101100 00010000 11111110


00000001

172 16 254

I P addresses are divided into 2 parts:


Network I D & Host I D
<NID> <HID> = I P Address
Figure 19.1 Dotted-decimal notation and binary notation for an IPv4
address
00000001 00001011 00001011 11101111
11000001 10000011 00011011 11111111

14.23.120.8  Class A
252.5.15.111 

33
C L A S S I F I C AT I O N O F IP A D D R E S S E S
Class: A
(C L A S S F U L A D D R E S S I N G )
0
7 Bit 24 Bit
Fix Network ID Host ID
Class: B
10
Fix 14 Bit 16 Bit
Network ID Host ID
Class: C
11 0
Fix 21 Bit 8 Bit
Network ID Host ID
Class: D
11 10
F ix
Class: E Multicast address
11 11
F ix Reserved address
Example

Find the error, if any, in the following IPv4 addresses.


Note
The address space of IPv4 is
232
or 4,294,967,296.
C L A S S A: (0.0.0.0 TO 127.255.255.255)
0
7 Bit 24 Bit
Network Host ID
ID
 Only 126 addresses are used for network address.
 All 0’s and 1’s in Network-ID are dedicated for special

IP address. So, total number of IP address in class A


can be represented:
0.0.0.0 Special I P Address
00000001.0.0.1
1.0.0.2
1.0.0.3
. 224 – 2 are Host IP
.
.
126.255.255.254
127.255.255.255 Special IP Address – Loopback
BLOCKS IN CLASS A
C L A S S B: (128.0.0.0 TO 191.255.255.255)
10
Fix
14 Bit Network ID 16 Bit Host ID

 No special network address here. All are usable.

128.0.0.0 Special IP Address


10000001.0.0.1
130.0.0.2
130.0.0.3
. 216 – 2 are Host IP
.
.
190.255.255.254
10111111.255.255.255 Special IP Address –
Loopback
BLOCKS IN CLASS B
C L A S S C: (192.0.0.0 TO 223.255.255.255)

11 0
Fix

21 Bit Network ID 8 Bit Host ID

192.0.0.0 Special I P Address


11000001.0.0.1
194.0.0.2
194.0.0.3
. 28 – 2 are Host IP
.
.
222.255.255.254
11011111.255.255.255 Special IP Address –
Loopback
BLOCKS IN CLASS C
C L A S S D: (224.0.0.0 TO 239.255.255.255)

 Very first four bits of the first octet in Class D IP


addresses are set to 1110, giving a range of:

 C lass D has IP address rage from 224.0.0.0


to
239.255.255.255.
 Class D is reserved for Multicasting.
 In multicasting data is not destined for a
particular host, that is why there is no need to
extract host address from the IP address, and
Class D does not have any subnet mask.
C L A S S E: (240.0.0.0 TO 255.255.255.255)
 This IP Class is reserved for
experimental purposes only for R & D or Study.
 IP addresses in this class ranges from
240.0.0.0 to 255.255.255.254.
 Like Class D, this class too is not equipped with

any subnet mask.


NETWORK ADDRESSES

 The network address is the first address.


 The network address defines the network to
the rest of the Internet.
 Given the network address, we can find the
class of the address, the block, and the range
of the addresses in the block
 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.
T Y P E O F A D D R E S S E S I N IP V 4 N E T WO R K
 Network address - The address by which we refer to
the network.
⚫ E.g.: 10.0.0.0
 Broadcast address - A special address used to send
data to all hosts in the network.
⚫ The broadcast address uses the highest address
in the network range.
⚫ E.g.: 10.0.0.255
 Host addresses - The addresses assigned to the
end devices in the network.
⚫ E.g.: 10.0.0.1
MASK
• A mask is a 32-bit binary number.
• The mask is ANDeD with IP address to
get
• The block address (Network address)
• Mask And IP address = Block Address
D E FAU LT M A S K

 Class A default mask is 255.0.0.0


 Class B default mask is 255.255.0.0

 Class C Default mask 255.255.255.0


Figure 19.2 Finding the classes in binary and dotted-decimal
notation

19.49
IP A D D R E S S I N G S U M M ARY
Leadi
Size
of netwo
Size
Number Addresses
Default sub
net CIDR
of rest Total Start
Class ng rk of per addresses E n d address mask in dot notati
bit address
bits number networks network in class -decimal on
field
bit field notation

16,777,2 2,147,483,6 127.255.255.2


Class A 0 8 24 128 (27) 0.0.0.0 255.0.0.0 /8
16 (224) 48 (231) 55

16,384 65,536 1,073,741,8 128.0.0. 191.255.255.2


Class B 10 16 16 255.255.0.0 /16
(214) (216) 24 (230) 0 55

2,097,15 536,870,91 192.0.0. 223.255.255.2 255.255.255.


Class C 110 24 8 256 (28) /24
2 (221) 2 (229) 0 55 0

Class D not not


not not not 268,435,45 224.0.0. 239.255.255.2
(multica 1110 define not defined define
defined defined defined 6 (228) 0 55
st) d d

Class E not not


not not not 268,435,45 240.0.0. 255.255.255.2
(reserve 1111 define not defined define
defined defined defined 6 (228) 0 55
d) d d
IP A D D R E S S I N G - E X A M P L E
223.1.1.1

 I P address: It is 32-bit 223.1.2.1


223.1.1.
identifier for host, 2
router interface 223.1.1. 223.1.2.
4 9
 Interface: It is a
connection 223.1.3.2
7 223.1.2.
between
host/router and physical 223. 2
link. 1.1.
3
⚫ A router’s typically have
223.1.3. 223.1.3.
multiple interfaces 1 2
⚫ A host typically has one
or two interfaces
 IP addresses
223.1.1.1 = 11011111 00000001 00000001
associated with each 00000001
interface.
223 1 1
S UBNET 223.1.1.0/24
223.1.2.0/24
223.1.1.
 Subnet: high order bits 1
defines subnet
223.1.1. 223.1.2.
 Host: low order bits defines 2 223.1.1.4 223.1.2.9
1
host
223.1.2.
 To determine the subnets, 223.1.1. 223.1.3.2 2
detach each interface from 3 7
its host or router. subne
t
 Creating islands of isolated 223.1.3.
223.1.3.
networks, with interfaces 1 2
terminating the end points
of the isolated networks.
223.1.3.0/24
 Each of these isolated
networks is called a subnet. Network consisting of 3
subnets
SUBNETTING
 If an organization was granted a large block in
class A or b, it could divide the address into
several contiguous groups and assign each group
to smaller network(called subnets).
 Divide the big network into small networks

Exam

Curricular Academic

Placement
SUBNETTING 2^n=2^2=4
n=2

200.10.20. _ _ _ _ _ _ _ _ s1 s2

200.10.20.00
s4 s3
200.10.20.01000000(64)
200.10.20.01111111(127)
200.10.20.10
200.10.20.11

255.255.255.11000000(192) WWW

200.10.20.0
TYPE OF ADDRESSES – C O N T …
C L A S S L E S S I N T E R -D O M A I N R O U T I N G (CIDR)
 C I D R is a slash notation of subnet mask. C I D R tells
us number of on bits in a network address.
subn hos
et t
11001000 00010111
part par
00010000
t
00000000
200.23.16.0/23
 A single IP address can be used to designate many
unique IP addresses with C IDR .
 A C I D R IP address looks like a normal IP address
except that it ends with a slash followed by a number,
called the IP network prefix.
 C I D R addresses reduce the size of routing tables and
make more IP addresses available within
organizations.
SUBNETTING
 Subnetting places when we extend the
default subnet mask.
take
 We cannot perform subnetting with default
subnet mask and every classes
subnet mask. have default
 Now find the host bits borrowed to create subnets
and convert them in decimal.
 For example find the subnet mask of
address 188.25.45.48/20 ?
1. Class B, Default Subnet mask: 255.255.0.0
2. Borrowed 4 bit from host part so mask is now:
11111111 11111111 11110000 00000000
255 255 240
0
H OW MANY S UBNETS FROM GIVEN
S U B N E T M AS K ?
 To calculate the number of subnets provided by
given subnet mask we use 2 N , where N = number
of bits borrowed from host bits to create subnets.
 For example in 192.168.1.0/27, N is 3.

 By looking at address we can determined that

this address is belong to class C and default


subnet mask 255.255.255.0 [/24 in CIDR].
 In given address we borrowed 27 - 24 = 3 host

bits to create subnets.


 Now 23 = 8, so our answer is 8.
W HAT A R E T H E VA L I D S U B N E T S ?
 Calculating valid subnet is two steps process.
 First calculate total subnet by using formula 2 N .

 In second step find the block size and count from

zero in block until subnet mask value.


 For example calculate the valid subnets
for 192.168.1.0/26
1. Borrowed host bits are 2 [26-24]
2. Total subnets are 22 = 4
3. Subnet mask would be 255.255.255.192
4. Block size would be 256-192 = 64
5. Start counting from zero at blocks of 64,
so our valid subnets would be
0,64,128,192
W HAT A R E T H E TOTAL H O ST S ?
 Total hosts are the hosts available per subnet
 To calculate total hosts use formula 2 H = Total

hosts
 H is the number of host bits

 For example in address 192.168.1.0/26

 We have 32 - 26

1. [Total bits in IP address - Bits consumed


by network address] = 6
2. Total hosts per subnet would be 26 = 64
N E T WO R K P R E F I X E S
 For Class C , Default subnet mask of class C is
255.255.255.0
 C I D R notation of class C is /24, which means 24

bits from IP address are already consumed by


network portion.
 We have 8 host bits remain.

 Subnetting moves from left to right. So Class C

subnet masks can only be the following:


CIDR Decimal Binary
/25 128 10000000
/26 192 11000000
/27 224 11100000
/28 240 11110000
/29 248 11111000
/30 252 11111100
N E T WO R K P R E F I X E S - E X A M P L E
 /25
⚫ C I D R /25 has subnet mask 255.255.255.128 and 128
is 10000000 in binary.
⚫ We used one host bit in network address.
 N = 1 [Number of host bit]
 H = 7 [Remaining host bits]

 Total subnets ( 2 N ) : 21 = 2

 Block size (256 - subnet mask) :- 256 - 128 = 128

 Valid subnets ( Count blocks from 0) :- 0, 128

 Total hosts (2H) :- 27 = 128

 Valid hosts per subnet ( Total host - 2 ) :- 128 - 2

= 126
D Y NA M I C H O S T C O N F I G U R AT I O N P RO T O C O L - D H C P
 Dynamic Host Configuration Protocol is
protocol
a for assigning dynamic IP addresses to
devices on a network.
DHCP
223.1.1.0/24
server
223.1.1. 223.1.2.
1 1

223.1.1. arriving DHCP


2 223.1.1. 223.1.2.
4 9
client needs
address in this
223.1.3.2
223.1.2. network
223.1.1. 2
3 7
223.1.2.0/24

223.1.3. 223.1.3.
1 2

223.1.3.0/24
DHCP – CONT…
 With dynamic addressing, a device can have a
different IP address every time it connects to the
network.
 In some systems, the device's IP address can even

change while it is still connected.


 It allows reuse of addresses (only hold address

while connected “on”).


 It also support mobile users who want to join

network.
D H C P C L I E N T S E RV E R I N T E R AC T I O N
DHCP server: DHCP discover arrivin
223.1.2.5 g
src : 0.0.0.0, 68
Broadcast:
dest.:is there
clien
a DHCP server out
255.255.255.255,67 t
yiaddr:
there? 0.0.0.0
transaction ID: 654
DHCP offer
src: 223.1.2.5, 67
Broadcast:
dest: I’m a
DHCP server!
255.255.255.255, 68
yiaddrr: 223.1.2.4
Here’s an IP
transaction ID: 654
DHCP request address yousecs
lifetime: 3600 can
src: 0.0.0.0, 68
use
dest::
Broadcast: OK.
255.255.255.255, 67
I’ll take
yiaddrr: 223.1.2.4
that IP address!
transaction ID: 655
lifetime: 3600 secs
DHCP ACK
src: 223.1.2.5, 67
dest:
Broadcast: OK.
255.255.255.255, 68
You’ve got that
yiaddrr: 223.1.2.4 IP
address!
transaction ID: 655
lifetime: 3600 secs
N E T WO R K A D D R E S S T R A N S L AT I O N
 NAT is a method that is used to translate
Private IP addresses to Public IP addresses.
rest local network
of (e.g., home
Intern network) 10.0.0.
et 1
10.0.0/24
10.0.0.4 10.0.0.
2
138.76.29
.7
10.0.0.
3

all datagrams leaving local


network have same datagrams with source or
single source NAT IP destination in this network
address: have 10.0.0/24 address for
138.76.29.7,different source, destination (as usual)
source port numbers
NAT – C O N T …
 Local network uses just one IP address as far as
outside world is concerned.
 This means that only a single, unique IP address

is required to represent an entire group of


computers.
 The technique was originally used for ease of

rerouting traffic in IP networks without


readdressing every host.
 The concept of NAT as developed to solve two

problems:
⚫ Solve shortage of IPv4 IP addresses
⚫ To Hide the Network Address
NAT T E R M I N O L O GY
 Inside Local Address: The name of the inside
source address before translation. This would be a
Private IP.
 Inside Global Address: The name of the inside host
after translation. This would be the Public IP.
 Outside Local Address: The name of the
destination host before translation.
 Outside Global Address: The name of the
destination host after translation.
 Where:
⚫ Global Addresses → Public
⚫ Local Addresses → Private
⚫ Inside Hosts → Within Local Network
⚫ Outside Hosts → Outside Local Network
NAT – C O N T …

NAT translation table 1: host 10.0.0.1


2: NAT router WAN side addr LAN side addr sends datagram
changes to
datagram 138.76.29.7, 10.0.0.1,
source addr 5001 3345 128.119.40.186,
from 10.0.0.1, …… …… 80
3345 to S: 10.0.0.1, 3345
138.76.29.7, D: 128.119.40.186,
5001, 80 10.0.0.
updates table 1 1
S: 138.76.29.7,
2 5001 10.0.0.
D: 128.119.40.186, 4 10.0.0.
80 2
138.76.29. S: 128.119.40.186,
80
4
7
S: 128.119.40.186,
80 3 D: 10.0.0.1, 3345
10.0.0.
4: NAT router
3: D: 138.76.29.7,
reply
5001
arrives changes 3
dest. address: dest addr from
datagram
138.76.29.7, 138.76.29.7, 5001 to 10.0.0.1,
5001 3345
A D VA N TA G E S NAT
 It hide the real IP address of your internal network
from public network and act as a firewall
 It allow unlimited number of private addresses
to access the single internet connection.
 Hence, it allows multiple devices to access
single internet connection.
 It help to save money to buying multiple
internet connection for multiple devices.
I N T E R N E T C O N T R O L M E S S A G E P RO T O C O L - I C M P
 When something unexpected occurs, the event is
reported by the I C M P, which is also used to test the
Internet.
 About a dozen types of I C M P messages are defined.
The most important are listed below. Each I C M P
message type is encapsulated in an IP packet.
Message Type Description
Destination unreachable Packet could not be delivered
Time exceeded Time to live field hit 0
Parameter problem Invalid header field
Source quench Choke packet
Redirect Teach a router about geography
Echo Ask a machine if it is alive
Echo reply Yes, I am alive
Timestamp request Same as Echo request, but with timestamp
Timestamp reply Same as Echo reply, but with timestamp
IP V 6 D ATAG R A M F O R M AT
D I F F E R E N C E B E T W E E N IP V 4 & IP V 6

IPv4 IPv6
 32 bit length  128 bit length
 Fragmentation is by  Fragmentation is done only by sender
done sender
and
 fNoorwparcdkientgflroowutiedresntificati 
Packet flow identification is available
on
within the IPv6 header using the Flow
 Checksum field in header  LNaobcehlefcei klsdum field in header

 Options fields are available in  No option fields, but


header Extension headers are available
 Address Resolution Protocol  Address Resolution Protocol (ARP) is
(ARP)is available to map IPv4 replaced with Neighbor Discovery
addresses to M A C addresses Protocol
 Broadcast are  Broadcast messages are not available
messages
 aSvtatiliac bIlPe addresses or  Auto-configuration of
D H C P is addresses is
L I N K S TAT E R O U T I N G A L G O R I T H M
 Also known as Dijkstra’s Algorithm.
 It computes the least-cost path from one
node
(source node) to all other nodes in the network.
 Its iterative and after the k t h least-cost paths are
known to k destination nodes.
 Notation:
⚫ c(x,y): link cost from node x to y; = ∞ if not
direct neighbours
⚫ D(v):current value of cost of path from
source to destination v
⚫ p(v): predecessor node along path from source to v
⚫ N ': set of nodes whose least cost path
definitively known
D I J KS T R A ’ S A L G O R I T H M
1 Initialization:
2 N' = {u}
3 for all nodes v
4 if v adjacent to u
5 then D(v) = c(u,v)
6else D(v) = ∞ 7
8 Loop
9 find w not in
N' such that
D(w) is a
minimum
10 add w to N'
11update 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 '
D I J KS T R A ’ S A L G O R I T H M – E XA M P LE :1

Step N' D(v)


p(v)
D(w) D(x) D(y)
p(w) p(x) p(y) p(z)
0 u D(z)
7,u 3,u 5,u ∞ ∞
1 uw 6,w 5,u 11,w ∞
2 uwx 6,w 11,w 14,x
3 uwxv 10,v 14,x
x
4 uwxvy 12,y 9
5 uwxvy
z 5 7
4
8
3 w z
u y
2
3
7 4
v
D I J KS T R A ’ S A L G O R I T H M – E XA M P LE :2
Ste N' D(v),p(v) D(w),p(w D(x),p(x) D(y),p(y) D(z),p(z)
p )
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

v 3 w
2 5
u 2 1 z
3
1 2
x 1
y
D I J KS T R A ’ S A L G O R I T H M – E XA M P LE :2

resulting shortest-path tree from u:

v
u z
w
x y

resulting forwarding table in u:


destinati lin
on k
v
(u,v)
x. (u,x
)
y. (u,x
)
R1

8
4

R4 R5
R2
7

3 R3 4

Visited R1 R2 R3 R4 R5
R1 0 4 🙙 8 🙙
R1,R2 7 8 🙙
R1,R2,R3 Min(11,8)= 🙙
8
R1,R2,R3, Min(18,15)
R4 =15
D I S TA N C E V E C T O R A L G O R I T H M
 Distance-vector (DV) algorithm is iterative,
asynchronous, and distributed.
 It is distributed in that each node receives some
information from one or more of its directly
attached neighbours, performs a calculation, and
then distributes the results of its calculation back
to its neighbours.
 It is iterative. so, process continues on until no
more information is exchanged between
neighbours.
 The algorithm is asynchronous. It does not
require all of the nodes to operate with each
other.
D I S TA N C E V E C T O R A L G O R I T H M – C O N T …
 Let dx(y) be the cost of the least-cost path
from node x to node y.
 Then least costs are related by the
celebrated Bellman-Ford equation:
dx(y) = cost of least-cost path from x to y then
dx(y) = min {c(x,v) + dv(y) }
v

cost from neighbor v to


destination y
cost to neighbor v

min taken over all neighbors v of x

4-
81
D I S TA N C E V E C T O R A L G O R I T H M – C O N T …
each node:

wait for (change in local


link cost or message from
neighbor)

recompute estimates

if D V to any destination has


changed, notify neighbors
D I S TA N C E V E C T O R A L G O R I T H M - E X A M P L E
node x cost to cost to
x y x y
table z z Dx(y) = min{c(x,y) + Dy(y), c(x,z) +
x 0 2 7 x
0 2 Dz(y)}

from
from

y ∞∞ = min{2+0 , 7+1} = 2
y 3
∞ 2 0 1 Dx(z) = min{c(x,y) +
node y
z ∞ ∞ to
cost z 7 1 0
table x y Dy(z), c(x,z) +

z Dz(z)}
x
∞ ∞
2 0 = min{2+1 , 7+0} =
fro
m

1
y ∞ 3
y
∞∞ 2 1
Table for Router X
node z ∞cost to
x y D est. D ist. N ext
x z
table z 7
x ∞∞ X. 0 X

from

y ∞∞
Y. 2 Y

∞ Z. 7 Z tim
z 7 1 0 e
D I S TA N C E V E C T O R A L G O R I T H M -
noEdeXxAMcoP cost to cost to
x y
stLtoE
table x y z x y
z z
x 0 2 7 x x 0 2 3
0 2

from
from

from
y ∞∞ y 2 0 y
y 3 2 1
∞ 2 0 1 1
node y
x z
z ∞ ∞ to
cost z 7 cost
1 to0 z 7
table x y x y 3cost
1 to0
∞ x y
z z z
x 0 2 7 x 0 2
x ∞ ∞
from

∞ 2 0 3

from
fro

y 2 0 1
m

1
y y 2 0
∞∞ z 7 1
1 cost to
node zz ∞cost to 0 cost to
x y x y z x3 y1
table z
x ∞∞ x z0 2 x0 z0 2 3
from

7
from

∞ y 2 0 1
from

y ∞∞ y 2 0 z 3 1 0
∞ 1 time
z 7 1 0
Table for R5
1) Only neighbor
Dest. Dist. Next R1
2) Only Distance Vector
Table for R1
R1 🙘 -
Dest. Dist. Next
R2 3 R2
R1 0 R1
R3 🙘 - 1
3 R2 1 R2
R4 4 R4 R5 R2 R3 🙘 -
R5 0 R5
R4 🙘 -

R5 🙘 -
Dist Dist
1 At R1 R1 New RT
1 4 6 R2 Dist.
0
Dest. Dist. Next
0 6 Dist
🙘 R1 0 R1
1
6
3 R2 1 R2
0
🙘 R4 2 6 R3 7 R2
R3 🙘 R4 🙘 -
3
3
R5 4 R2
DIFFERENCE: L S AND DV ROUTING ALGORITHM

Distance Vector Protocol Link State Protocol


Entire routing table is sent as an Updates are incremental & entire routing
update table is not sent as update
Distance vector protocol Updates are triggered not periodic
send periodic update at every 30 or
90
Usepcdonatde are broadcasted Updates are multicasted

Updates are sent to directly Update are sent to entire network & to
connected neighbour only just directly connected neighbour
Routers don't have end to end Routers have visibility of entire network of
visibility of entire network. that area only.
It is prone to routing loops No routing loops
H I E R A RC H I C A L R O U T I N G
 As networks grow in size, the router routing
tables grow proportionally.
 Router memory, C P U time and more bandwidth

consumed to send status reports about them.


 When hierarchical routing is used, the routers

are divided into what called regions.


 Each router knowing all the details about how to

route packets to destinations within its own


region.
 But knowing nothing about the internal
structure of other regions.
H I E R A RC H I C A L R O U T I N G - E X A M P L E
B ROA D C A S T R O U T I N G
 Host need to send messages to many or all
other hosts.
 For example
⚫ A service distributing weather reports
⚫ Stock market updates
⚫ Live radio programs
 InShort, Sending a packet to all
destinations
simultaneously is called broadcasting.
 First broadcasting method that simply send a distinct
packet to each destination.
 S o, it waste of bandwidth, but it also requires
the source to have a complete list of all destinations.
 In practice this may be the only possibility, but it is
the least desirable of the methods.
B ROA D C A S T R O U T I N G – C O N T …
 Flooding is Second method. Although flooding is
for ordinary point-to-point communication, for
broadcasting it might rate serious consideration,
especially if none of the methods are applicable.
 The problem with flooding as a broadcast
technique is the same problem it has as a point-
to-point routing algorithm.
 It generates too many packets and consumes too
much bandwidth.
 A third algorithm is Multi Destination Routing.
 If this method is used, each packet contains
either a list of destinations or a bit map
indicating the desired destinations.
B ROA D C A S T R O U T I N G – C O N T …
 When a packet arrives at a router, the router checks
all the destinations to determine the set of output
lines that will be needed.
 The router generates a new copy of the packet for
each output line to be used and includes in each
packet only those destinations that are to use the line.
 A fourth broadcast algorithm makes explicit use of
the sink tree for the router initiating the broadcast-or
any other convenient spanning tree for that matter.
 A spanning tree is a subset of the subnet that
includes all the routers but contains no loops.
 If each router knows which of its lines belong to the
spanning tree, it can copy an incoming broadcast
packet onto all the spanning tree lines except the one
it arrived on.
M U LT I C A S T R O U T I N G
 Sending a message to a group is called multicasting,
and its routing algorithm is called multicast routing.
 Multicasting requires group management. Need to
create and destroy groups, and to allow processes to
join and leave groups.
 To do multicast routing, each router computes a
spanning tree covering all other routers.
 For example, in Figure (a) we have two groups, 1 and
2.
 Some routers are attached to hosts that belong to one
or both of these groups, as indicated in the figure.
M U LT I C A S T R O U T I N G – C O N T …
 A spanning tree for the leftmost router is shown in
Figure (b).
 When a process sends a multicast packet to a group,
the first router examines its spanning tree and
prunes it, removing all lines that do not lead to hosts
that are members of the group.
 In our example, Figure (c) shows the pruned spanning
tree for group 1.
 Figure(d) shows the pruned spanning tree for group 2.
Multicast packets are forwarded only along the
appropriate spanning tree.
C O M PA R I S O N B E T W E E N RIP O S P F A N D
BGP RIP OSPF BGP
RIP is intra domain O S P F is also intra It is inter domain
routing protocol used domain routing routing protocol
with in protocol used with in used between
the autonomous the autonomous the
system system autonomous system
RIP is used for Small O S P F is used in large The B G P protocol is
networks autonomous system used for very large-
with maximum with no limitation scale networks
number of hops 16
RIP uses Distance O S P F uses Link State B G P uses Path Vector
Vector
RIP send entire O S P F send multicast B G P send Open
routing update to all Hello packet to the packet to
directly neighbours, to create the neighbours to
connected interface session create session
THANK YOU

You might also like