Sunteți pe pagina 1din 97

TCP/IP

&
ROUTING PROTOCOLS

V.Maheswaran Nair
Sub Divisional Engineer
BSNL,Trivandrum.
TCP/IP
(Transmission Control Protocol/
Internet Protocol)
TCP/IP

TCP/IP Protocols provide the ability to


connect machines regardless of the underlying
network cabling & the Operating Systems in
use.
 TCP/IP is a piece of networking
software for the Internet and networks
worldwide.
TCP/IP protocol suite contain two
main things:
 Network Applications
 HTTP (Hyper Text Transfer Protocol) WWW Services
 FTP (File Transfer Protocol) for transferring file
 SMTP Simple Mail Transfer Protocol) for E Mail
 DNS (Domain Name System) etc…

TCP is Used
Networking protocols
 Moving packet of data from
Source to Destination

Internet Protocols (IP) and Routing Protocols are used.


 TCP is responsible for:

 Data concurrency
 Packet Sequencing
 Delivery guarantee
 Error Control

 Retransmission
Internet address

MAC address Port address


(Node to Node)
(Application)

IP address 16 bit

(Source to Decimal Notation

Destination)
MAC address

48 bit (6 Bytes)
Hexa Decimal Notation

AB 0F 25 B6 C5 D2

Vendor ID Serial No
IP Address
 Each Internet address
consists of 4 bytes (32-bits),
defining two parts:

 Netid
 Hostid

 These parts are of varying


lengths depending upon the
class of the address.
Dotted Decimal Notation
 To make the 32-bit address
form more compact and easier
to read, Internet addresses are
usually written in decimal form
with decimal points separating
the bytes.
10000000 00001011 00000011 00011111

128.11.3.31
Classes
 There are five different IP
Address Classes: A, B, C, D & E.

 These are designed to cover


the needs of different types of
organizations.
Each address is a pair (Netid and Hostid)
where the Netid identifies a network and
the Hostid identifies a host on that
network.
NIB

Net Id Host Id
Internet Address Classes

Byte 1 Byte 2 Byte 3 Byte 4

A 0 NETID HOSTID

B 10 NETID HOSTID

C 110 NETID HOSTID

D 1110 MULTICAST ADDRESS

E 1111 FOR FUTURE USE


IP Address Classes
 Class A Address : N.H.H.H
 Class B Address : N.N.H.H

 Class C Address : N.N.N.H


IP address - Classes
•IP addressing supports five different address classes - A,
B,C,D,E
•CLASS A,B,C are available for commercial uses.
•The left most bits indicate the network class.
Network Host
Class A 0xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx

Network Host
Class B 10xxxxxx
10 xxxxxxxx xxxxxxxx xxxxxxxx

Network Host
Class C 110xxxxx
110 xxxxxxxx xxxxxxxx xxxxxxxx
Identifying a class of address
Address Identifier Network Id Host Id

A 0 7 bits Network Bits 24 bits Host Id

B 10 14 bits Network Bits 16 bits Host Id

C 110 21 bits Network Bits 8 bits Host Id

D 1110 Multicast address (224.0.0.0-239.255.255.255)

E 1111 Reserved for future use


IP Address Bit Patterns

8 Bits 8 Bits 8 Bits 8 Bits

Class-A: 00000000 01111111 0-127

Class-B: 10000000 10111111 128-191

Class-C: 11000000 11011111 192-223

Class-D: 11100000 11101111 224-239

Class-E: 11110000 11111111 240-255


Address space utilisation
12 12
1000008 0111111
7 100%
00 1

B-25%

1011111 0
19 1
1 1 0 A-50%
19
2
110000 0 1
C-12.5% 00
1101111 1
1 0
22
D-6.25% 3 22 1
1110000 4 23 0 0000000
E-6.25% 0 1110111 9 24 0
1 0 25 0
11110000
1111111
5
1
Class A

A 0 NETID HOSTID


 Class
The
A lot ‘A’
First addresses
Octet
left-most
of addressesbit are
defines
must
 Remaining seven bits defineare thezero
be
wasted
designed

to
inEach
netid.
define
this for
network
Theoretically,
There
Two special
are
class
the organizations
as theoretically
actually
addresses
we
class
it is can
as126 have
highly
‘A’. that
can
(hostid
27
different networks.
may
have
=
all128have
up
networks
0s and toa2huge
24
networks.
improbable only
hostid
that number
because
all
an 1s) areofused
= 16,777,216
two of
organization
computers
hosts.
the
for
hasspecial
addresses
so many attached
purposes. to theirfor
are reserved
computers.
networks.
special purposes.
Class B

B 10 NETID HOSTID

 Class
 The two‘B’left-most
addresses are
bits are 10
 A
Two
We
Eachlot of
Octets
can addresses
network
have define
2 are
the
theoretically
14
= wasted
netid
16,384 can
designed

to The
Last next
define for
16-bits
the midsize
14-bits
are
class used
define
as to
‘B’. define

andTwo
in this
two
networks
have upspecial
class
octets
toin 2 addresses
1also as
6 define
class= it the
65,536
‘B’. (hostid
is hosts
highly(or
organizations
different
the hostid. networks.that may have a
all 0s and
improbable
hostid.
routers). hostid
that all
an 1s) are used
organization
large number of computers
for
hasspecial
so many purposes.
computers.
attached to their networks.
Class C

C 110 NETID HOSTID

 Class C addresses are



 Three
The Octets
three define
leftmost the
bits netid
are
 A
Twoclass
designed next‘C’
21-bits
addresses
for
Theoretically, network
small
we define
(all can
0s have
and all
organizations
can have

and Eight
one bits
octet are used
define to
the define
hostid.
110
21
1s)
that to
different
2 are
havedefine
=2,097,152 the
networks.
reserved class
networks.
for as
special
a small number of “C’.
2the
8
=256 hosts.
hostid.
addresses. attached to their
computers
networks.
Class D

D 1110 MULTICAST ADDRESS

 Class D address is designed



 There is
Remaining no netid or
28-bits hostid;
define
The
for first four bits are 1110 to
multicasting.
whole address
multicast is used
addresses. for
define the class as ‘D’.
multicasting.
Class E

E 1111 FOR FUTURE USE

 Class E is reserved by the


 The
Therefirst
Internet four
is no
for bitsuse.
netid
future arehostid.
or 1111 to
define the class as ‘E’.
FROM TO

A 0.0.0.0 127.255.255.255

128.0.0.0 191.255.255.255
B

192.0.0.0 223.255.255.255
C

224.0.0.0 239.255.255.255
D

240.0.0.0 255.255.255.255
E
Number of networks and hosts in each Class

Class No. of networks No. of hosts

A 27 – 2 = 126 224 – 2 = 16,777,214

B 214 = 16,384 216 – 2 = 65,534

C 221 = 2,097,152 28 – 2 = 254

D Not Applicable Not Applicable

E Not Applicable Not Applicable


TCP/IP and OSI

 OSIis made of seven layers.


 TCP/IP protocol is made of five layers.
APPLICATION
PRESENTATION APPLICATION

SESSION
OSI Model TRANSPORT TRANSPORT
TCP/IP Model

NETWORK NETWORK
DATA LINK DATA LINK

PHYSICAL PHYSICAL
TCP/IP Protocol Suite
FTP TFTP
A DHCP SMTP SNMP
TELNET DNS
HTTP

T TCP UDP

N ICMP IGMP IP ARP RARP

D Ethernet, Token Ring, FDDI, HDLC, FR, PPP, ATM


Protocols defined by the underlying networks

P
Data Encapsulation
Application Data

Port add (TCP) Data


TPT Layer
(TCP/UDP) TCP Segment
Port add (UDP) Data

UDP Message

NW Layer Source IP TCP-UDP Data Dest IP


(IP)
IP Datagram

Data Link Source MAC IP Header TCP-UDP Data Dest MAC


(MAC) Frame

Physical Bits 10000010101001


TCP Details
 Provides application programs access to the
network using a reliable connection-oriented
transport layer service
 TCP sends and receives data reliably using
sequence numbers and acknowledgements
 TCP is a byte oriented protocol i.e. every byte in
each packet is assigned a sequence number
 Data stream handed over to TCP is called an
unstructured stream
 TCP divides this data stream into segments for
transmission to remote network
TCP Header..
Octet +0 Octet +1 Octet +2 Octet +3
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
DESTINATION PORT
SOURCE PORT

SEQUENCE NUMBER

ACKNOWLEDGEMENT NUMBER

HEAD U A P R S FI WINDOW SIZE


LEN R C S S Y N
G K H T N
URGENT POINTER
CHECKSUM

OPTIONS AND PADDING


TCP Header…
 Source & Destination Port (16 Bits)
 Port numbers are used to identify a unique application in a
machine
 65536 (0-65535) port numbers can be defined
 Theoretically it is possible to run 65535 simultaneous
applications in a host
 The first 1024 ports, port numbers 0-1023 known as well
known port numbers, are assigned and are reserved for
standard applications and are controlled by IANA
 The remaining ports, 1024-65535, are dynamic and can
be used freely by applications
 Source port is randomly generated by the source machine
Well known port numbers
PORT DESCRIPTION
20 File Transfer-Data
21 File Transfer-Control
23 Telnet
25 SMTP
53 Domain Name Server
69 Trivial File Transfer
80 WWW
123 Network Time Protocol
179 Border Gateway Protocol
TCP Header…
 Sequence Number (32 Bits)
 Helps in establishing TCP connections, along with SYN bit, called
as Three Way Handshake
 Helps in maintaining account of amount of data being transferred
 Identifies where the encapsulated data fits within a data stream
from the sender
 Sequence number is incremented, in the system, every 4
microsecond
 Acknowledgement Number (32 Bits)
 Helps in maintaining account of amount of data being transferred
 Identifies the sequence number expected from the other end of
data transmission unit
Seq/Ack numbers relation
 DuringTCP Connection Establishment/
Three way handshake
 Acknowledgement Number Sent = Sequence
Number Received+1
 During Data Transfer
 Acknowledgement Number Sent = Sequence
Number Received + Data Received in Bytes
Three-Way-Handshake
Sender 0 1 Receiver

SN-95426
2 AN-00000 SN-16780 3
1 0 000B AN- 95427
1 1 000B
SN-95427
AN-16781
4
0 1 000B

0-Closed; 1-Listen; 2-SYN-Sent; 3-SYN-Received; 4-Established


Data Transfer SN-95426
0 1
Sender AN-00000 SN-16780 Receiver
2 1 0 000B AN- 95427
3
1 1 000B
SN-95427
4
AN-16781 SN-16781
5
0 1 000B AN- 95428
0 1 100B
SN-95428
5 AN-16881 SN-16881
AN- 95628 5
0 1 200B
0 1 150B

SN-95628
5 AN-17031 SN-17031

0 1 250B AN- 95878 5


0 1 300B

0-Closed; 1-Listen; 2-SYN-Sent; 3-SYN-Received; 4-Established; 5-Data Transfer


Closing a TCP Connection
SN - 95880
6 AN -17334
Sender Receiver
0 1 1 0B
SN - 17334
AN - 95881
0 1 0 0B

WAIT
SN - 17334
AN - 95881 6

SN - 95881 0 1 1 0B

AN -17334

0 0 1 0 0B 0

6-Finish; 0- Closed
TCP Header….
 Header Length (4 Bits)
 Sometimes called Data Offset
 Indicates the length of header in 32-bit words
 Identifies the beginning of data
 Typical value is 5 unless there are options
 Flags (6 Bits)
 Urgent (URG)
 Acknowledgement (ACK)
 Push (PSH)
 Reset (RST)
 Synchronisation (SYN)
 Finish (FIN)
TCP Header…..
 Window Size (16 Bits)
 Indicates the size of the sliding window
 Specifies the number of octets, starting with the
octet indicated by the acknowledgement number,
that the sender of the segment will accept from its
peer at the other end of the connection before the
peer must stop transmitting and wait for an
acknowledgement
 A default window size is 4096 bytes
 Used for flow control by using Sliding window
mechanism
Flow Control
 Sender retains a copy of transmitted data until it
receives an acknowledgment from the remote
network.
 If no acknowledgment is received, within a specified
time, the data is retransmitted by using adaptive
retransmission algorithm.
 TCP records the time of the transmission and sequence
number of the segment.
 TCP again records the time of the acknowledgement
received.
 Using this delta, TCP builds a sample round-trip delay time
and uses this to build an average time for a packet to be
sent and to receive an acknowledgement
 TCP will time out after a number of unsuccessful
retransmissions
Sliding Window-Flow Control
Moves to right when Sent and ack
ack is received.
Sent but not ack
Moves to right when
data is sent. Can be sent

Moves to right or left to fix Can’t be sent


the size of the window.

Window Size
TCP Header…..
 Checksum(16 Bits)
 Used for error detection
 Covers both header and the encapsulated data
 Urgent Pointer(16 Bits)
 Used only when urgent flag is set
 Points to the last octet of urgent data
 Options
 One of the important options is MSS (Maximum Segment
Size)
 Informs the receiver of the largest segment the sender is
willing to accept, without causing fragmentation
TCP Header……
 Padding
 Consists of 1-3 octets, each equal to zero, to
force the length of TCP header to be in multiples
of four octets.
User Datagram Protocol
 Provides unreliable connectionless service
 Transfers data without establishing a session
 Used for services that have an inbuilt
reliability
 Does not use end to end error checking and
correction
 Does not order the packets; may loose or
duplicate a packet
 Runs faster than TCP due to less overheads
UDP Header..

Octet +0 Octet +1 Octet +2 Octet +3


0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
SOURCE PORT DESTINATION PORT
MESSAGE LENGTH CHECKSUM
UDP Header...
 Source Port (16 Bits)
 Identifies the sending process.
 Destination Port (16 Bits)
 Identifies the receiving process.
 Some fixed, pre-assigned port numbers used for services on
the Internet.
 7 for UDP; 69 for TFTP

 Message length (16 Bits)


 Indicates the size of the UDP header and its data in bytes.
 Minimum size is 8, if carries no data.
 Checksum (16 Bits)
 Covers the UDP header and UDP data.
 Optional; If not used, set to all zeros.
Internet Protocol.
 Provides best-effort or connectionless delivery
service.
 No error checking or tracking
 If reliability is important, IP must be paired with a
reliable protocol like TCP
 Transmits blocks of data called datagrams each of
which is transported separately
 Responsible for IP addressing
 Datagrams may travel along different routes and
may arrive out of sequence or duplicated.
IP Header..
Octet +0 Octet +1 Octet +2 Octet +3
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
VER HLEN TOS TOTAL LENGTH
IDENTIFICATION DM FRAGMENT OFFSET
F F
PROTOCOL HEADER CHECKSUM
TIME TO LIVE

SOURCE ADDRESS OF HOST

DESTINATION ADDRESS OF HOST

PADDING
OPTIONS
IP Header…
 Version (4 Bits)
 Identifies the IP version to which the packet belongs
 Header Length (4 Bits)
 Indicates the length of IP header in 32 bit words.
 Minimum length is 20 octets.
 Options may increase the size up to a maximum of 24 octets.
 Type of Service (8 Bits)
 Used for specifying special handling of packet.
 Has two sub-fields:
 Precedence
 TOS
IP Header….
P P P D T R C 0 Reserved:
Always set to ‘0’

Precedence Delay Reliability


000-Routine 0-Normal 0-Normal
001-Priority 1-Minimise 1-Maximise
010-Immediate
011-Flash
100-Flash Override
101-CRITIC/ECP Throughput Cost
110-Internetwork Control 0-Normal 0-Normal
111-Network Control 1-Maximise 1-Minimise

0 0 0 0 0 0 0 0 = No TOS
IP Header…..
 Total Length (16 Bits)
 Specifies total length of the packet, including header, in
octets
 Largest decimal number =216= 65535, the maximum
possible size of an IP packet is 65535 octets
 Total length - header length = Packet’s data payload
 Identification (16 Bits)
 Each datagram is identified by a identification number set
by the source.
 Normally incremented by 1 for each datagram sent.
IP Header……
 Flags (3 Bits)
 First bit is not used.
 Second bit is Don’t Fragment (DF) bit
 Third bit if More Fragment (MF) bit
 Maximum Transmit Unit (MTU) is the size of the
largest packet, including IP Header, that can be
transmitted or received through a data link
 Default MTU is 576 bytes, which can be handled by
any network without fragmentation
IP Header……
 Fragment Offset (13 Bits)
 The fragmentation occurs at the routers, if the
original packet length exceeds the MTU of a data
link
 Used only in the cases when a datagram is
fragmented on its way
 Specifies the offset, in units of eight octets, from
the beginning of header to the beginning of the
fragment
 Each fragment is marked, by router, with the
same identifier number
Fragmentation..
MTU-1500 MTU-1500
172.16.2.0 MTU-576 172.16.3.0

1500 B
IP TCP Data
512 B 512 B 476 B
IP IP TCP Data IP Data IP Data
DF=0; MF=1; Offset=0 DF=0; MF=1; Offset=64 DF=0; MF=0; Offset=128

IP TCP Data Data Data

IP TCP Data
Fragmentation
 Only the receiver host reassembles the datagram
 The destination machine starts a reassembly timer
for about 60-120 seconds.
 If not all fragments were received, then hosts
discard the packets and sends a time exceeded
ICMP message to the source machine
 If a single fragment is lost during a transmission, the
entire packet must be resent
IP Header……
 Time to live-TTL (8 Bits)
 Assigns a life to an IP datagram
 Protocol (8 Bits)
 Specifies the protocol that runs on the top of IP.
 TCP-6; EGP-8; UDP-17; OSPF-89
 Header Checksum (16 Bits)
 Error detection field for IP header
 As each router decrements the TTL, the
checksum is calculated by each router
IP Header…….
 Source Address of Host (32 Bits)
 IP Address of the Originating Machine
 Destination Address of Host (32 Bits)
 IP Address of the Destination Machine
 Options
 Security:
 Specifies how secret the datagram is
 Strict Source Routing(SSR):
 Gives the complete path to be followed
 Loose Source Routing(LSR):
 Gives the list of routers not to be missed
IP Header……..
 Record Route:
 Makes each router to append its IP address.
 Time Stamp:
 Makes each router to append its IP address and time
stamp.
 Padding
 Ensures that the header ends on a 32 bit
boundary by adding zeros after the option field.
Well known port numbers

PORT DESCRIPTION
20 File Transfer-Data
21 File Transfer-Control
23 Telnet
25 SMTP
53 Domain Name Server
69 Trivial File Transfer
80 WWW
123 Network Time Protocol
179 Border Gateway Protocol
Domain Name System (DNS)
DNS Server What is the IP Address of
www.Yahoo.com
What is the IP Address of
www.Yahoo.com
DNS Server

Internet www.yahoo.com , IP address


is 210.212.90.15
User traffic

www.yahoo.com , IP address
is 210.212.90.15
yahoo.com
ROUTING PROTOCOLS
Routing Protocol

 Itis a language a router speaks with other


routers
Functions of RP
 Forwarding,

 Sharing

 Updating

information about the reachability and


status of the network
Static Routing

 Routes to destinations are set up manually


 Route may be up or down but static routes
will remain in the routing tables and traffic
would still be sent towards the route
 Not suitable for large networks

 Also known as Non-adaptive routing


Dynamic Routing
 Routes are learnt via an internal or external
routing protocols
 Network reachability is dependent on the
existence and state of the network
 Routing decisions change to reflect the
changes in topology
 Also known as Adaptive routing
Routing Table
A Data base to be maintained by
each router.
 Created by using algorithms.
 It contains
Network address
Interface address for reaching the
next router (Hope)
Metric
Types of R P

Routes

Static
Distance Vector
Protocols

Dynamic RIP,IGRP

Link State Protocols

OSPF,IS-IS
Path Determination
Router-A
Network Next Hop
Router
A B
192.168.7.
192.168.1.0 Direct
192.168.2. 192.168.1.
0
0 0
192.168.2.0 Direct
192.168.3.0 Direct 192.168.3. C 192.168.6.
192.168.4.0 B,C 0 0

192.168.5.0 B,C 192.168.4. 192.168.5.


0 0
192.168.6.0 B,C
192.168.7.0 B,C
•Networks192.168.4.0 to 192.168.7.0 can be
reached via either router B or C, which path is
preferable?
•Metrics are needed to rank the alternatives.
Routing Protocols contd..
 Distance Vector Routing Protocols
eg. RIP V1 (Routing Information protocol)
RIP V2
 Link State Routing Protocols
eg. OSPF (Open Shortest Path First)
IS-IS (Intermediate System-Intermediate
System)
Metrics
 Hop Count -- Distance Vector

 Cost (BW) – Link State


Routing Updates
20.0.0.10 23.0.0.15
20.0.0.0
A 21.0.0.0
B 22.0.0.0
C 23.0.0.0

.2 .1 .2 .1 .2 .1

Routing Table-A Routing Table-B Routing Table-C


NW VIA HOP NW VIA HOP NW VIA HOP
20.0.0.0 ---------- 0 21.0.0.0 ---------- 0 22.0.0.0 ---------- 0
21.0.0.0 ---------- 0 22.0.0.0 ---------- 0 23.0.0.0 ---------- 0
22.0.0.0 21.0.0.2 1 20.0.0.0 21.0.0.1 1 21.0.0.0 22.0.0.1 1
23.0.0.0 22.0.0.2 1
23.0.0.0 21.0.0.2 2 20.0.0.0 22.0.0.1 2

 After exchanging 2 periodic updates, the network


is converged.
Routing Updates
20.0.0.0
A 21.0.0.0
B 22.0.0.0
C 23.0.0.0

.2 .1 .2 .1 .2 .1

Routing Routing Routing


Table-A Table-B Table-C
NW VIA HOP NW VIA HOP NW VIA HOP
20.0.0.0 D 0 20.0.0.0 21.0.0.1 1 20.0.0.0 22.0.0.1 2
21.0.0.0 D 0 21.0.0.0 D 0 21.0.0.0 22.0.0.1 1
22.0.0.0 21.0.0.2 1 22.0.0.0 D 0 22.0.0.0 D 0
23.0.0.0 21.0.0.2 UR
2 23.0.0.0 22.0.0.2 UR
1 23.0.0.0 D
C 0
UR

 Router-C in its next scheduled update, flags the


network as unreachable and passes the
information along.
Routing Updates
20.0.0.0
A 21.0.0.0
B 22.0.0.0
C 23.0.0.0

.2 .1 .2 .1 .2 .1

Routing Routing Routing


Table-A Table-B Table-C
NW VIA HOP NW VIA HOP NW VIA HOP
20.0.0.0 D 0 20.0.0.0 21.0.0.1 1 20.0.0.0 22.0.0.1 2
21.0.0.0 D 0 21.0.0.0 D 0 21.0.0.0 22.0.0.1 1
22.0.0.0 21.0.0.2 1 22.0.0.0 D 0 22.0.0.0 D 0
23.0.0.0 21.0.0.2 2 23.0.0.0 22.0.0.2 1 23.0.0.0 D 0

 Routers-A & B still have entries in the route table about


23.0.0.0.
 The information is no longer valid but there is no router to
inform them of this fact, thus creating a black-hole in the
network.
Route Invalidation Timer
20.0.0.0
A 21.0.0.0
B 22.0.0.0
C 23.0.0.0

.2 .1 .2 .1 .2 .1

Routing Routing Routing


Table-A Table-B Table-C
NW VIA HOP TIME NW VIA HOP TIME NW VIA HOP TIME
20.0.0.0 C 0 RIT 20.0.0.0 21.0.0.1 1 RIT 20.0.0.0 22.0.0.1 2 RIT
21.0.0.0 C 0 RIT 21.0.0.0 C 0 RIT 21.0.0.0 22.0.0.1 1 RIT
22.0.0.0 21.0.0.2 1 RIT 22.0.0.0 C 0 RIT 22.0.0.0 C 0 RIT
2 RIT
23.0.0.0 21.0.0.2 UR 0 1 RIT
23.0.0.0 22.0.0.2 UR 0 23.0.0.0 C 0 RIT

 Another Timer, Garbage Collection or Flush Timer,


60 Seconds longer than RIT, is set.
 On the expiry of which the route entry will be flushed
from the routing table.
RIP Timers
 Update Timer
 30 Seconds
 Route Invalidation Timer
 180 Seconds (6 Times the Update Timer)
 Garbage Collection Timer
 240 seconds (60 Seconds longer than RIT)
LINK STATE ROUTING (OSPF)

 Sharing knowledge about the


neighbourhood.
 Sharing with every other router in the
area.
 Sharing when there is a change.
OSPF operation….
 OSPF-
Routers send Hello packets out
OSPF-enabled interfaces

 Tworouters sharing a common link, after


exchanging Hello packets, become
neighbors
OSPF operation…
 Link State Advertisements (LSAs) i.e. router’s
links and their state, are exchanged between
adjacent routers
 Each router receiving an LSA from a neighbor
records the LSA in Link State Database and
sends a copy of the LSA to all of its other
neighbors
 LSAs are exchanged, until all the routers build
identical Link State Databases i.e. the link state
databases have been synchronized
OSPF operation….
 Each router uses SPF algorithm to calculate a
shortest path to every known destination, with
itself as root
 Each router builds its router table from its SPF
Tree
 After this, in a stable internetwork, all activities
stop except
 Hello packets are exchanged, after regular intervals of
10 seconds (Hello Interval) between neighbors, as
keepalives
 LSAs are exchanged every 30 minutes
Metrics
Speed Cost

>= 100Mbps 1

Ethernet/802.3 10

E1(2.048Mbps) 48

64Kbps 1562

Metric=108/Interface Speed in bits per


sec.
e.g. 100000000/2048000=48.828125
Fully adjacent router network
RA-RB-4 RB-RA-4
RA-RC-20 RB-RD-3
RA-RD-5 RA-RB-4
RB-RA-4 C RA-RC-20 D
4 4
RB-RD-3 A B RA-RD-5
RC-RA-20 RB-RA-4 2 5 3 RD-RA-5 RC-RA-20
RC-RD-2 RB-RD-3 0 RD-RB-3 RC-RD-2
2 5 3
RD-RA-5 RD-RA-5 0 RD-RC-2 RB-RA-4
RD-RB-3 RD-RB-3 C 2 2 D RC-RA-20 RB-RD-3
RD-RC-2 RD-RC-2 RC-RD-2 RA-RB-4
RA-RB-4 RA-RC-20
A RA-RC-20 tn+2 B RA-RD-5
RA-RD-5 tn+1 RD-RA-5
RC-RA-20 RD-RB-3
RC-RD-2 tn
RD-RC-2
Shortest Path Tree of Router-A

4 4 4
A B A B
20 5 3 5

2 5 3
0
C 2 2
D C D
2
PATH VECTOR ROUTING

Path vector routing is similar to distance


vector routing. There is at least one node,
called the speaker node, in each AS that
creates a routing table and advertises it to
speaker nodes in the neighboring ASs..
Boarder Gateway
Protocol
Between Two AS
Autonomous System
 Definition

An autonomous system is a network


under a common administration
Autonomous systems
Autonomous systems

AS-0

BG IGP BG
AS-1
P P
AS-2

BG
IGP P IGP
Note:

In distance vector routing, each node


shares the knowledge about the entire
AS with its immediate neighbors
periodically .
Initial routing tables in path vector
routing
Popular routing protocols
Stabilized tables for four autonomous systems
Administrative Distances
 Diversity of metrics poses problems in routers
running more than one routing protocol.
 Router may learn a route to the same
destination from each of the protocols
 Administrative distances are the route
sources to determine most preferred source
 Administrative distance is a measure of
believability
Administrative Distances
 Theadministrative distance of various protocols is
as below:
 Connected Interface - 0
 Static Route -1
 OSPF - 110
 IS-IS - 115
 RIP - 120
 Unknown - 255
 The lower the administrative distance, the more
believable the protocol
Flow Chart of a Packet
Packet Received
NO
If route available, YES
Header & NO Received ARP
search MAC in ARP Reply
Checksum Valid cache
YES
NO NO Send ARP
Decrement TTL; Send ICMP MAC Address request and wait
TTL>=0 error message Found for a response
YES YES
Route table lookup Discard original
on Dest. Add. Packet
Build new packet Received ARP
NO with MAC address reply, insert
NO Default route and route through MAC and IP
Route Found
available port found in address into
YES YES routing table ARP table