0% found this document useful (0 votes)
13 views114 pages

Unit - 3

Subject: Computer Network security notes

Uploaded by

Pradnya
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
0% found this document useful (0 votes)
13 views114 pages

Unit - 3

Subject: Computer Network security notes

Uploaded by

Pradnya
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/ 114

Chapter-3

IP Addressing and Routing

1
Review Topics
• Internet Protocol, IP Packet Format, Addressing: Physical
Addresses, Logical Addresses
• Port Addresses, Specific Addresses
• IP Addresses – Network Part and Host Part
• Networks Masks, Network Addresses and
• Broadcast Addresses, Address Classes, Loop back address
• Routing: types of Routing protocol, Border Gateway Protocol
(BGP), Routing Information Protocol (RIP),Open Shortest
Path First (OSPF) Protocol
• IP Routing Concept
• Routing Tables, Stream and Packets
• TCP Does? TCP – a reliable pipe
• TCP Connection – Multiple Conversations, Port Nos.
2
Network Layer: Internet Protocol (IP)
• Need for Network Layer: To solve the problem of delivery through several
links, the network layer (or the internetwork layer) was designed. The network
layer is responsible for host-to-host delivery and for routing the packets
through the routers or switches.

3
Network Layer: Internet Protocol (IP)
• Network Layer at Source, Router and Destination:

• Network layer at the source is responsible for creating a packet from the data coming from
above layer. The header of the packet contains, other information and the IP addresses of
source and destination. Also checks its routing table to find the routing information (such
as the outgoing interface of the packet or the physical address of the next node). If the
packet is too large, the packet is fragmented.
• Network layer at the router is responsible for routing the packet. When a packet arrives, the
router consults its routing table and finds the interface from which the packet must be sent.
The packet, after some changes in the header, with the routing information is passed to the
data link layer again.
• Network layer at the destination is responsible for address verification; it makes sure that
the destination address on the packet is the same as the address of the host. If the packet is a
fragment, the network layer waits until all fragme nts have arrived, and then reassembles
them and delivers to the transport layer.
4
Network Layer: Internet Protocol (IP)
• Internet as a Datagram Network
• Switching at the network layer in the Internet uses the datagram
approach for packet switching.
• In connectionless / datagram service, the network layer protocol treats each
packet independently, with each packet having no relationship to any other
packet.
• The packets of same message may or may not travel through same path
to reach at their destination.
• The reason for this decision (datagram approach) is that the Internet is
made of so many heterogeneous networks that it is almost impossible to
create a connection (logical) from the source to destination without
knowing the nature of the networks in advance.
• Hence The Internet Protocol version 4 (IPv4) is the delivery
mechanism used by the TCP/IP protocols in the Internet.

5
Network Layer: Internet Protocol (IP)
• IPv4
• IPv4 is an unreliable and connectionless datagram protocol – it is a best-effort
delivery service. The term best-effort means that IPv4 provides no error
control or flow control (except for error detection in the header).
• Position of IP v4 in TCP/IP protocol suite

6
Network Layer: Internet Protocol (IP)
• IPv4 Datagram / Packet format

• Version (4 bits): Indicates version number.


• HLEN (Header Length - 4 bits): defines the length of header in 4 bytes (32 bit)
words. The minimum value is 5, for minimum header length of 20 octets.
Maximum value is 15, for maximum header length of 60 octets.
• Type of service (8 bits): Specifies 1st 3 bits – P (000-111), D, T, R, C (1001) and
8th bit is not used.
7
Network Layer: Internet Protocol (IP)
• IPv4 Datagram format
• Total length (16 bits): defines total datagram length in octets(including header).
• Identification (16 bits): An integer that identifies the current IPpacket.
• Flags (3 bits): 1st bit is not used. 2nd bit is called as Don’t fragment bit - prohibits
fragmentation when it is set. 3rd bit is called as More bit is used for
fragmentation and reassembly.
• Fragment Offset (13 bits): indicates place of fragment in the original IP datagram.
• Time to Live (8 bits): specifies how long, in seconds, a datagram is allowed to
remain in the internet. TTL is somewhat similar to hop count.
• Protocol (8 bits): indicates the next higher layer protocol such as TCP, UDP or
SCTP to receive the data field at destination.
• Header Checksum (16 bits): error detecting code applied to the header.
• Source Address (32 bits): it is source host address.
• Destination Address (32 bits): it is destination host address.
• Options (variable): indicates the options requested by the sending user.
• Padding (variable): it ensure the datagram header is a multiple of 32 bits.
• Data (variable): it must be an integer multiple of 8 bits in length.
• Note: The maximum length of datagram (data field + header) is 65,535 octets.
8
Network Layer: Internet Protocol (IP)
• IPv4 Datagram - Service Quality Options (TOS)
• Precedence (P): it is a measure of datagram’s relative importance, 8 levels of
precedence are used.
• Reliability (R): one of two levels may be specified: normal or high.
• Delay (D): One of two levels may be specified: normal or low.
• Throughput (T): One of two levels may be specified: normal or high.
• Cost (C): One of two levels may be specified: normal or minimum.
• IPv4 Datagram – Options parameters
• Security: allows security label to be attached to a datagram.
• Source routing: a list of router addresses that specifies route to be followed. It may
be strict (only identified routers may be visited) or loose (other intermediate
routers may be visited).
• Route Recording: A field is allocated to record the sequence of routers visited by
the datagram.
• Stream identification: This service provides special handling for volatile periodic
traffic (voice).
• Time stamping: The source IP entity and some or all intermediate routers add a
time stamp (precision to milliseconds) to the data unit as it goes by.
9
Addressing
• Four levels of addresses are used in an internet employing the TCP/IP protocols:
physical (MAC) addresses, logical (IP) addresses, port addresses, and specific
addresses.
• Each address is related to a specific layer in the TCP/IParchitecture.

10
Addressing
• PhysicalAddresses
• In following figure the two nodes are connected by a link (bus topology LAN). As
the figure shows, the computer with physical address 10 is the sender, and the
computer with physical address 87 is the receiver.

• Most local-area networks use a 48-bit (6-byte) physical address written as 12


hexadecimal digits; every byte (2 hexadecimal digits) is separated by a colon, as
shown below:

07:01:02:01:2C:4B
A 6-byte (12 hexadecimal digits) physical address.
11
Addressing
• LogicalAddresses
• Following figure shows a part of an internet with two routers connecting three
LANs. Each device (computer or router) has a pair of addresses (logical and
physical) for each connection.
• For example: A/10 (192.168.14.1/07:01:02:01:2C:4B) and P/95 (10.10.10.1/
06:03:5A:3C:02:4D)

12
Addressing
• Port Addresses: Following figure shows two computers communicating via an
Internet. Sending computer is running 3 processes with port addresses a, b, and c.
Receiving computer is running 2 processes with port addresses j and k.
• For example Process HHTP with port address - a (80) in the sending computer
communicating with Process HTTP with port address - j (3128) in the receiving
computer. A 16-bit port address represented as one single number.
• Note that although physical addresses change from hop to hop, logical and port
addresses remain the same from the source to destination.

13
Addressing
• SpecificAddresses:
• Some applications have user-friendly addresses that are designed for that specific
address.
• Examples include the e-mail address (for example, [email protected]) defines
the recipient of an e-mail. and
• The Universal Resource Locator (URL) (for example, www.google.com) is used
to find a document on the World Wide Web.
• Host Computers, Routers and Protocol Layers
• Host computer (or sometimes "Host")
• Any computer system that connects to an internet and runs
applications.
• Uses all layers of TCP/IP model.
• Router
• Connect networks to form internet.
• Do not use protocols from all layers of TCP/IP.
• In particular, does not use Application layer and Transport layer.

14
IP: Internet Protocol Addresses
• MAC Addresses form a flat or physical addressing system – you can not
determine the location on the internet of a host using this system.
• IP addresses form a hierarchical or logical addressing system – they
help you to find the location of a host on the internet.
• Internet is an abstraction created in software which can use addresses,
packet format and delivery techniques independent of the physical
hardware. Each host in the internet must have an Unique IPAddress.
• Users, application programs and software operating in the higher layers
of the protocol stack use these addresses.
• In IP protocol each host is assigned an unique 32 bit address (4 bytes).
• For example: 192.168.14.50.
• Any packet destined for a host on the internet will contain the Source as
well as Destination IP address.
• An IPv4 address is 32 bits long, IPv4 addresses are an unique and
universal.
• The address space of IPv4 is 232 or 4,294,967,296.

15
IP: Internet Protocol Addresses

16
IP: Internet Protocol Addresses
• IP AddressHierarchy
• Addresses are broken into a Network-ID and a Host-ID for routing efficiency.
• The Network-ID is uniquely assigned to an individual network.
• The Host-ID is uniquely assigned to a host within a given network.

1
1
Network Network 2
1 R 2
3
3
5
• IP AddressGuarantee
• The IP address hierarchy guarantees two important properties.
• Each computer has a unique address
• The full address contains both a Network-ID and a Host-ID assigned to guarantee
uniqueness.
• Although Network-ID must be assigned globally, Host-IDs can be assigned
locally without global coordination.

17
IP: Internet Protocol Addresses
• How many bits for Network-ID and a Host-ID?
• How should the 32 bit address be divided?
• In other words how many bits for Network-ID, how many for Host-ID?
• Example 1:
• 16 bits for each
• 65536 max networks and 65536 max hosts/network
• Example 2:
• 24 bits for Network-ID and 8 bits for Host-ID
• 8,388,608 max networks and 256 max hosts/network
• Other possibilities?
• Example 3:
• 8 bits for Network-ID and 24 bits for Host-ID
• 256 max network and 8,388,608 max hosts/network
• More Flexible System: Create system with different classes of address.
Each class has different size for the Network-ID and the Host-ID.
• (Up to) the first 4 bits determine the class. Five classes are defined.
18
IP: Internet Protocol Addresses
• Five classes of IP address: In classful addressing, the address space is divided
into five classes: A, B, C, D, and E.
• The original IP addressing scheme divides host addresses into three primary
classes (Unicast addresses). The class of an IP address determines the boundary
between the Network-ID and Host-ID.
• Unicast: An identifier for a single interface. A packet sent to an unicast address is
delivered to the interface identified by that address.
• Multicast: An identifier for a set of interfaces (belongs to different nodes). A
packet sent to a multicast address is delivered to all interfaces identified by that
address. Class A
0 Net-ID(7) Host-ID(24)
Class B
1 0 Net-ID(14) Host-ID(16)
Class C
110 Net-ID(21) Host-ID(8)
Class D
1110 MulticastAddress(28)
Class E
1111 Reserved for future use(28)
19
IP: Internet Protocol Addresses
• Computing the Class
First 4 bits of Address Table index (in decimal) Class of Address
0000 0 A
0001 1 A
0010 2 A
0011 3 A
0100 4 A
0101 5 A
0110 6 A
0111 7 A
1000 8 B
1001 9 B
1010 10 B
1011 11 B
1100 12 C
1101 13 C
1110 14 D
1111 15 E
20
IP: Internet Protocol Addresses
• Dotted Decimal Notation
• Conventionally 32 bit IP addresses are expressed in dotted decimalnotation.
• Each byte is expressed as a decimal number (0-255). The bytes are separated by
decimal points. Addresses range from 0.0.0.0 to 255.255.255.255.

• Division of Address Space


Address Bits in Max. Number of Bits in Max. Number of Host
Class Net-ID Networks Host-ID per Network
A 7 128 24 16777216
B 14 16384 16 65536
C 21 2097152 8 256
21
IP: Internet Protocol Addresses
• Authority of Address
• For networks connected to the global internet, an organization obtains IP address
from the communication company that provides internet connection – ISPs.
• The ISPs coordinates with a central organization, the Internet Corporation for
Assigned Names and Numbers (ICANN), to ensure that each Network-ID is
unique through out the entire Internet.
• A Classful IPAddressing Examples

Net-ID 128.10 R Net-ID 128.211

128.10.0.1 128.10.0.2 R 128.211.6.115 128.211.28.4

Net-ID 192.5.48
Net-ID 10 R

10.0.0.37 10.0.0.49 192.5.48.3 192.5.48.85


22
IP: Internet Protocol Addresses
• Subnet Masks
• We use a binary mathematical operation called AND to discover the
Network ID from an IP address.
• AND takes every bit of the IP address and Subnet mask, returns a 1
where both the Subnet mask and IP address bits are both 1, and a 0
otherwise.
• Therefore, the IP address 10101010.10100100.00001101.00011100
ANDed with the subnet mask 11111111.11111111.00000000.00000000
would return the Network ID 10101010.10100100.00000000.00000000
• In Dotted decimal if IP address 192.168.14.1 ANDed with subnet mask
255.255.255.0 would return the Network ID 192.168.14
• In another example if IP address 10.10.10.10 ANDed with subnet mask
255.0.0.0 would return the Network ID 10

23
IP: Internet Protocol Addresses
• Default Subnet Masks for Classful addressing
• Each Class IP address uses a default number of bits to represent the
Network ID.
• If 8 bits are used for the Network ID of a Class A address, what is the
default subnet mask?
• To find the default subnet mask of a Class A address, put 1’s in the first 8
bits of the subnet mask.
• Class A’s default subnet mask is 11111111.00000000.00000000.00000000
• In dotted decimal form, this is 255.0.0.0
• For class B default subnet mask is 255.255.0.0
• For class C default subnet mask is 255.255.255.0

24
IP: Internet Protocol Addresses
• Classless IP addresses
• All networks have to choose one of the three classes (depending on the
size of network).
• Many addresses are wasted or not used.
• To overcome this problem classless IP address is used.
• Consider the network consist of 9 hosts, only 4 bits of Host-ID are needed
to represent all possible host values.
• Use of class C is waste of addresses.
• Classless addressing solves the problem by allowing an ISP to assign a
Network-ID that is 28 bits long (network can have up to 14 hosts only).
• For example: Network-ID – 28 bit and Host-ID – 4 bit
• 192.168.14.240 - 255
• 241 to 254 - actual addresses used for nodes
• 192.168.14.240 – Network address
• 192.168.14.255 – Broadcast address
• 11111111. 11111111. 11111111.11110000 – Subnet Mask (255.255.255.240)
25
IP: Internet Protocol Addresses
• Special IP addresses
• Network Address
• Directed Broadcast Address
• Limited BroadcastAddress
• This Computer Address
• Loop back Address
• Berkley Broadcast Address Form
• Network Address: Useful to have an address which represents a network.
• Formed by adding a 0 in Host-ID part.
• Example:
• 128.10  128.10.0.0
• 10  10.0.0.0
• 192.5.48  192.5.48.0
• A network address should never appear as a destination in a packet.

26
IP: Internet Protocol Addresses
• Special IP addresses
• Directed Broadcast Address
• Often convenient to send a message to all hosts on a single network.
• Directed broadcast address formed by adding a Host-ID containing all 1
bits.
• Once the direct broadcast message arrives in the destination network it is
sent to all host on the network via
• The local networks hardware broadcast facility or if none present.
• Individual messages sent to each host.
• Limited Broadcast Address
• Term limited broadcast refers to a broadcast on a local physical network.
• Typically used on startup by a computer that doesn't yet know the network
number.
• Message must contain all 1 bits (Network-ID and Host-ID).
• Message remains on the local network.

27
IP: Internet Protocol Addresses
• Special IP addresses
• This Computer Address
• A computer needs to know its IP address to send or receive internet
packets.
• TCP/IP contains protocols which allow a computer to obtain its IP address
automatically when it boots.
• These startup protocols use IP to communicate.
• Sending an IP packet requires a source address.
• Address 0.0.0.0 means “this computer”.
• Loop Back Address
• During testing it is often convenient to have two applications which will
eventually communicate, run on the same computer.
• A message can travel down the stack from one application and back up the
stack to the other application.
• IP reserves class A Network-ID 127 for this purpose (the Host-ID doesn't
matter). By convention 127.0.0.1 is most often used.
28
IP: Internet Protocol Addresses
• Special IP addresses
• Berkley Broadcast AddressForm
• UC Berkley developed and distributed an early version of TCP/IP as part of BSD
UNIX.
• Instead of a directed broadcast address Host-ID of all 1 bits they used a Host-
ID of all 0 bits. This is known as a Berkley Broadcast.
• Many early computer manufacturers derived their software from the Berkley
Implementation.
• Special IP AddressSummary
Net-ID Host-ID Type of Address Purpose
All-0's All-0's This computer Used during boot-strap
Network All-0's Network Identifies a network
Network all-1's Directed broadcast Broadcast on specified net
All-1's All-1's Limited broadcast Broadcast on local net
127 Any Loop back Testing
Network All-0's Directed broadcast Berkley broadcast
29
Routers and IP Addressing
• Each host has an address but each router has two (or more) addresses!
• Why?
• A router has connections to multiple physicalnetworks.
• Each IP address contains a Network-ID that specifies a physical network.
• An IP address does not really identify a specific computer but rather a
connection between a computer and a network.
• A computer with multiple network connections (e.g. a router) must be assigned an
IP address for each connection.
• Example:

30
Network Layer: Delivery, Forwarding and Routing
• Delivery: refers to the way a packet is handled by the underlying networks under
the control of network layer.
• Forwarding: refers to the way a packet is delivered to the next station.
• Routing: refers to the way routing tables are created to help in forwarding.
• Routing protocols: these are used to continuously update the routing tables that
are used for forwarding and routing.
• Delivery:
• Direct Delivery: the final destination of the packet is a host connected to the same
physical network as the deliverer.
• It occurs when source and destination of the packet are located on the same
network.
• It occurs when the delivery between the last router and the destination host.
• Indirect Delivery: in this, the packet goes from router to router until it reaches the
one connected to the same physical network as its final destination.
• This delivery always involves one direct delivery but zero or more indirect
deliveries.

31
Network Layer: Delivery, Forwarding and Routing
• Delivery: Direct Delivery and Indirect Delivery

32
Network Layer: Delivery, Forwarding and Routing
• Forwarding means to place the packet in its route to its destination. Forwarding
requires a host or a router to have a routing table. When a host has a packet to send
or when a router has received a packet to be forwarded, it looks at this table to find
the route to the final destination.
• Forwarding: Route method versus Next Hop method

33
Network Layer: Delivery, Forwarding and Routing
• Forwarding: Host-specific versus Network-specific method

34
Network Layer: Delivery, Forwarding and Routing
• Forwarding: Default method
• You can set up a default route on a router.
• If no routing information known about a destination Network-ID, a default route
can be used to automatically send information down to a specific route.
• Hopefully, another router will know the correct route.

35
Network Layer: Delivery, Forwarding and Routing
• Routing Table
• A router has a routing table with an entry for each destination, or a combinations of
destinations, to route IP packets. It can be either static or dynamic.
• Static routing table: it consist of information entered manually. The administrator
enters the route for each destination into the table.
• It cannot be updated automatically, when there is change in the internet.
• It can be used in a small internet that does not change very often.
• Dynamic routing table: is updated periodically by using one of the dynamic
protocols such as RIP, OSPF or BGP.
• Whenever there is change in the internet (shutdown of a router or breaking of
link), dynamic routing protocols updates all the tables in the routers
automatically.
• Dynamic updates is must for efficient delivery of IPPackets.

36
Network Layer: Delivery, Forwarding and Routing
• Routing Table format

37
Network Layer: Delivery, Forwarding and Routing
• Routing Table format
• Mask: it defines the mask applied for the entry.
• Destination Address/ Network Address: it defines the network address to which
the packet is finally delivered.
• Next Hop address: it defines the address of the next hop (router) to which the
packet is delivered.
• Flags: it defines up to five flags, that signify either presence or absence.
1. U (up): it indicates the router is up and running. If this field is not present
means the router is down, packet cannot be forwarded and is discarded.
2. G (gateway): it means that the destination is in another network. The packet
is delivered to the next hop-router for delivery.
3. H (host-specific): it indicates that the entry in the network address field is a
host specific.
4. D (added by redirection): it indicates that routing information for this
destination has been added to the host routing table by redirection message
from ICMP.
5. M (modified by redirection): it indicates that routing information for this
destination has been modified by redirection message from ICMP.
38
Network Layer: Delivery, Forwarding and Routing
• Routing Table format
• Reference count: it gives the number of users of this route at the moment.
• Utilities (use): there are several utilities that can be used to find the routing
information and the content of a routing table. For example: netstat, ifconfig etc.
• Interface: it shows the name of the interface.
• Dynamic Routing Protocols: Functions
• Dynamically share information between routers.
• Automatically update routing table when topology changes.
• Determine best path to a destination.

39
Network Layer: Delivery, Forwarding and Routing
• Dynamic Routing Protocols: Purpose
• Discover remote networks.
• Maintaining up-to-date routing information.
• Choosing the best path to destination networks.
• Ability to find a new best path if the current path is no longer available.
• Dynamic Routing Protocols: Classification

40
Network Layer: Delivery, Forwarding and Routing
• Dynamic Routing Protocols: Classification
• Intra – Domain / Interior Gateway Routing Protocol (IGP)
• Today, an internet can be so large that one routing protocol cannot handle
the task of updating the routing tables of all routers. For this reason, an
internet is divided into number of autonomous systems.
• An Autonomous System (AS) is a group of networks and routers under
the authority of a single administration.
• Routing inside an autonomous system is called intra-domain routing.
• IGP used for routing inside an autonomous system & used to route within
the individual networks themselves – Examples are: RIP and OSPF.
• Inter – Domain / Exterior Gateway Routing Protocol (EGP)
• Routing between autonomous systems is called inter-domain routing.
• EGP used for routing between autonomous systems – Example: BGP.

41
Network Layer: Delivery, Forwarding and Routing
• Dynamic Routing Protocols: Classification – IGP &EGP

42
Network Layer: Delivery, Forwarding and Routing
• Dynamic Routing Protocols: Classification
• Routing Information Protocol (RIP)
• Used as an intra – domain / Interior Gateway Routing Protocol (IGP).
• It is distance vector route discovery protocol.
• Each router advertises its distance vector (list of destination networks and
their distances from the broadcasting router in terms of hops) every 30
seconds (or whenever its routing table changes) to all of its neighbors.
• Maximum hop count is 15, hence has incomplete view of network
topology, does not work well in large and complicated inter-networks.
• Uses hope count as a metric.
• Open Shortest Path First (OSPF)
• Used as an intra – domain / Interior Gateway Routing Protocol (IGP)
• It is link state route discovery protocol. Has complete view of network
topology. Updates are not periodic.
• It exhibits better performance than RIP in large inter-network.
• Uses Cost (hope count) and Bandwidth as a metric.
43
Network Layer: Delivery, Forwarding and Routing
• Dynamic Routing Protocols: Classification
• Border Gateway Protocol (BGP)
• Used as an inter – domain / Exterior Gateway Routing Protocol (EGP).
• Uses path vector routing. It first appeared in 1989 and has gone through
four versions.
• The difference between the distance vector routing and path vector
routing can be compared to the difference between a national map and
an international map. A national map can tell us the road to each city and
the distance to be traveled if we choose a particular route; an international
map can tell us which cities exist in each country and which countries
should be passed before reaching that city.
• Sharing: any AS shares its table with immediate neighbors (ASs).
• Updating: Adding the nodes that are not in its routing table i.e. adding its
own AS and the AS that sent the table.
• The routing table shows the path completely.

44
Network Layer: Delivery, Forwarding and Routing
• Dynamic Routing Protocols: Classification
• Border Gateway Protocol (BGP)

WAN

WAN

45
Network Layer: Delivery, Forwarding and Routing
• MTU and Fragmentation
• For any given network there is a Maximum Transmission Unit or MTU.
• If a datagram arrives at a network an exceeds the MTU, the protocol software will
break the Datagram up into smaller pieces called fragments.
• The format of a fragment is the same except for bits which are set to indicate a
fragment.

46
Network Layer: Delivery, Forwarding and Routing
• MTUs for some networks

• Reassembly
• Fragments are never reassembled until the final destination.
• Why?
• Reduce amount of state information in routers. When packets arrive at a
router they can simply be forwarded.
• Allows routes to change dynamically. Intermediate reassembly would be
problematic if all fragments didn't arrive.
47
Routing Protocols: Distance Vector,
Link State, Path Vector, Routing in
Internet: RIP ,OSPF, BGP.
49

1 INTRA- AND INTERDOMAIN ROUTING

• An internet is divided into autonomous systems. An


autonomous system (AS) is a group of networks &
routers under the authority of a single administration.

• Routing inside an autonomous system is referred to


as intra-domain routing.

•Routing between autonomous systems is referred to


as inter-domain routing.
50

Figure 14.1 Autonomous systems


51

Figure 2 Popular routing protocols


52
Note that 10/1/2021

Routing Information Protocol (RIP) is an implementation of the


distance vector protocol.

Open Shortest Path First (OSPF) is an implementation of the link


state protocol.

Border Gateway Protocol (BGP) is an implementation of the path


vector protocol
53

10/1/2021
Routing architecture

What is difference between packet forwarding and routing?

Forwarding consists of taking a packet, looking at its


destination address, consulting a table, and sending the packet
in a direction determined by that table.

Routing is the process by which forwarding tables are built.


54
What is routing table & forwarding table?10/1/2021

The routing table, is the table that is built up by the routing


algorithms as a precursor to building the forwarding table.

For example, the routing table tells us that network


number 10 is to be reached by a next hop router with the
IP address 171.69.245.10.

Network Number Next Hop

10 171.69.245.10
55
Details on Routing 10/1/2021
56

Forwarding table

While the forwarding table contains the information about


exactly how to forward a packet to that next hop: Send it
out interface number 0 with a MAC address of
8:0:2b:e4:b:1:2.

Network Number Interface Interface MAC


Address

10 if0 8:0:2b:e4:b:1:2
57

Network as a Graph

The nodes of the graph, labeled A through F, may be either hosts,


switches, routers, or networks.

The edges of the graph correspond to the network links.

Each edge has an associated cost, which gives some indication of


the desirability of sending traffic over that link.

The basic problem of routing is to find the lowest-cost path


between any two nodes.
58

Diagram:- Network represented as a graph


Distance Vector Routing

Each node constructs a one-dimensional array


containing the “distances” or “costs” to all other nodes
(as it relates to its knowledge) and distributes it to its
immediate neighbors.

Key thing -- each node knows the cost of links to its


neighbors.

If no link exists between two nodes, the cost of a direct


link between the nodes is “infinity”.
60

1
1

1 1
1

1 1

Diagram 2:- Distance-vector routing: an example network.


An Example

B 1 A B C D E F G
1
1 C
1
A

A 0 1 1 ∞ 1 1 ∞
D
1
1 1
B 1 0 1 ∞ ∞ ∞ ∞
E

1
C 1 1 0 1 ∞ ∞ ∞
F G

D ∞ ∞ 1 0 ∞ ∞ 1
Table 1 shows Initial distances stored
at each node (global view). E 1 ∞ ∞ ∞ 0 ∞ ∞
F 1 ∞ ∞ ∞ ∞ 0 1
G ∞ ∞ ∞ 1 ∞ 1 0
62
Continue

Initially, each node sets a cost of 1 to its directly connected


neighbors and ∞ to all other nodes.

Thus, A initially believes that it can reach B in one hop and that D is
unreachable.

The routing table stored at A reflects this set of beliefs and includes
the name of the next hop that A would use to reach any reachable
node.
Routing Tables

B
Cost Next
Hop
C
A
D

E B 1 B
F G C 1 C
With this information, routing D ∞ -
table at A is -->
E 1 E
F 1 F
G ∞ -

Table 2 Initial routing table at node A.


Evolution of the table.

The next step in distance-vector routing Cost Next


is that every node sends a message to
Hop
its directly connected neighbors
containing its personal list of distances. B 1 B
F --> A with G is at a distance 1
C --> A with D at distance 1.
C 1 C
D 2 C
B

C
E 1 E
F 1 F
A
D

E
G 2 F
F G
Table 3 Final routing table at node A.
Final Distance Matrix

B A B C D E F G
C
A

A 0 1 1 2 1 1 2
D

B 1 0 1 2 2 2 3
E

C 1 1 0 1 2 2 2
F G

D 2 2 1 0 3 2 1
E 1 2 2 3 0 2 3
F 1 2 2 2 2 0 1
G 2 3 2 1 3 1 0
66

Figure 2 Popular routing protocols


67

Routing Information Protocol

Routing Information Protocol (RIP) is a protocol that routers can use to


exchange network topology information.

It is characterized as an interior gateway protocol, and is typically used in


small to medium-sized networks.

A router running RIP sends the contents of its routing table to each of its
adjacent routers every 30 seconds.
An Example of RIP

Routers advertise the cost of reaching 1 4


networks.
In this example, C’s update to A
would indicate that C can reach A B
Networks 2 and 3 with cost 0, 2 5
Networks 5 and 6 with cost 1 and
Network 4 with cost 2.
C D
3 6
Routing Information Protocol
(RIP)
1. In an autonomous, we are dealing with routers and
networks (links). The routers have routing tables,
networks don’t.
2. The destination in a routing table is a network, which
means the first column defines a network address.
3. The metric used by RIP is the number of links that have
to be used to reach the destination which is called hop
count.
4. Infinity is defined as 16
5. The next node column defines the address of the router
to which the packet is to be sent to reach its destination
Continue..

Desti.Network Hop Count Next Node


2 0 -
3 0 -
4 2 D
5 1 D

Router C6 is directly connected


1 to networksD2 and 3, which means that
there are no next-hop entries for these two networks.
Routing Information Protocol (RIP)
(cont.)
RIP Message Format
RIP Message Format (cont.)

Command. This 8-bit field specifies the type of


message: request (1) or response (2)
Version. This 8-bit defines the version. In the
textbook, we use version 1
Family. This 16-bit field defines the family of the
protocol used. For TCP/IP the value is 2.
Network address. RIP has allocated 14 bytes for
this field to be applicable to any protocol.
Distance. This 32-bit field defines the hop count
from the advertising router to the destination
network
Request and Response

Request. A request message is sent by a router


that has just come up or by a router that has some
time-out entries. A request can ask about specific
entries or all entries.

Response. A solicited response is sent only in


answer to a request. It contains information about
the destination specified in the corresponding
request. An unsolicited response is sent
periodically, every 30 s or when there is a change in
the routing table
Link State Routing

Link state routing has a different philosophy from that of distance


vector routing.

In link state routing, if each node in the domain has the entire
topology of the domain the list of nodes and links, how they are
connected including the type, cost (metric), and condition of the
links (up or down)-the node can use Dijkstra's algorithm to build a
routing table.
Concept of link state routing
Link state knowledge
Dijkstra algorithm
Example of formation of shortest path tree
Routing table for node A
Shortest Path Algorithm (1)

The first five steps used in computing the shortest path from A to D. The
arrows indicate the working node
PATH VECTOR ROUTING 83

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..
84

Figure Initial routing tables in path vector routing


85

Figure Stabilized tables for four autonomous systems


86

OSPF

The Open Shortest Path First (OSPF) protocol


is an intradomain routing protocol based on
link state routing. Its domain is also an
autonomous system.

It is used to allow routers to dynamically learn


routes from other routers and to advertise
routes to other routers. Advertisements
containing routes are referred to as Link State
Advertisements (LSAs)
87

Features of OSPF

OSPF detects changes in the topology, such as link


failures, very quickly and converges on a new loop-
free routing structures within seconds.
It computes the shortest path tree for each route using
a method based on Dijkstra's algorithm, a shortest
path first algorithm
The link-state information is maintained on each
router as a link-state database (LSDB) which is a
tree-image of the entire network topology. Identical
copies of the LSDB are periodically updated through
flooding on all OSPF routers.
88

Continue..

It supports a variety of Distance metrics including physical


distance, delay and so on.
It can be adopted in any of topology quickly and automatically
Load Balancing ,so that 2nd best route should also be used
89

Continue..

An OSPF network may be structured, or subdivided, into routing


areas to simplify administration and optimize traffic and
resource utilization.
Areas are identified by 32-bit numbers, expressed either simply
in decimal, or often in octet-based dot-decimal notation, familiar
from IPv4 address notation.
90
91
Description..

Version #: A one-octet field that defines the current version of the OSPF
protocol used.
Type: A one-octet field that defines the OSPF packet type. The five
packet types defined for OSPF are Hello, Database Description, Link
State Request, Link State Update, and Link State Ack.
Packet Length: A two-octet field defining the length of the entire OSPF
packet.
Router ID: A four-octet field defining the Router’s IP address of the
packet’s source.
92

Continue..

Area ID: A 32-bit address identifying the area (subnet) to which the
packet belongs.

Checksum: A two-octet field containing the remainder of a Cyclic


Redundancy Check (CRC) operation. The range of the CRC operation
excludes the Authentication field.

AuType: A two-octet field identifying the authentication scheme used for


the packet. The authentication types currently defined are None, Simple
Password, and message digest algorithm 5 (MD5).

Authentication: An eight-octet field for use by the authentication


procedure.
93

OSPF msg type

The five types of OSPF messages.


BGP 94

Border Gateway Protocol (BGP) is an interdomain routing


protocol using path vector routing. It first appeared in 1989 and
has gone through four versions.

The replacement for Exterior Gateway Protocol is the Border


Gateway Protocol (BGP), which is in its fourth version (BGP-4).
BGP sessions
The exchange of routing information between two routers using
BGP takes place in a session.

A session is a connection that is established between two BGP


routers only for sake of exchanging routing information.

To create reliable environment, BGP uses the services of TCP.

When a TCP connection is created for BGP, it can last for a long
time, until something unusual happens.

95
External & Internal BGP sessions

The E-BGP session is used to exchange information between


two speaker nodes belonging to two different autonomous
systems.

The I-BGP session, on the other hand, is used to exchange


routing information between two routers inside an autonomous
system.
96
Figure Internal and external BGP sessions
97
98
BGP

When configuring BGP, the administrator of each AS picks at


least one node to be a “BGP speaker,” which is essentially a
spokesperson for the entire AS.

That BGP speaker establishes BGP sessions to other BGP


speakers in other ASs.

These sessions are used to exchange reach-ability information


among ASs.

The border gateways are the routers through which packets enter
and leave the AS.
99
Cont..

BGP advertises complete paths as an enumerated list of ASs to


reach a particular network.

To see how this works, consider the example network in Figure


below.

A BGP speaker for the AS of provider A (AS 2) would be able


to advertise reach-ability information for each of the network
numbers assigned to customers P and Q.
Example of a network running BGP

100
TCP/IP Protocol Suite
Cont..

Thus, it would say, in effect, The networks 128.96, 192.4.153,


192.4.32, and 192.4.3 can be reached directly from AS 2.

The networks 128.96, 192.4.153, 192.4.32, and 192.4.3 can be


reached along the path AS 1, AS 2.

Similarly The networks 192.12.69, 192.4.54, and 192.4.23 can be


reached along the path AS 1, AS 3.

An important job of BGP is to prevent the establishment of


looping paths.

101
102

Note:

BGP uses the services of TCP


on port 179.
MultiMedia Systems CSE 228

Mobile IP
What is Mobile IP?

Mobile IP stands for Mobile Internet Protocol


A wireless connection to the Internet
Designed to support host mobility
Stay connected regardless of location without changing IP
address
Definitions

Mobile Node
A node/device that changes its point of attachment to the Internet

Home Agent
A router in the home network that communicates with the mobile node

Foreign Agent
A router in a foreign network that delivers information between mobile node
and its home agent

Care-of-Address
Mobile Node’s current IP address

Correspondent Node
Node/device that is communicating with the mobile node (i.e. web server)
How does Mobile IP work?

• Each mobile node has two IP addresses


- Permanent home address
- Care-of Address
• Home Agent maintains a mobility binding table
How does Mobile IP work? (Cont’d)

Foreign Agent contains a visitor list


How does Mobile IP work? (Cont’d)

What will happen when a packet is sent to the mobile


node that is not attached to its home network?

Home agent forwards the packet to the care-of address of the


mobile node using the binding table
Encapsulation
- Home agent constructs new IP header with care-of
address
- Original IP address in payload
How does Mobile IP work? (Cont’d)

Foreign agent restores the original IP address from the payload


Foreign agent consults the visitor list for mobile node
Packet is then forward to the mobile node through the media
address
How does Mobile IP work? (Cont’d)

What will happen when mobile node tries to send a


packet?

Packets are sent to the foreign agent

Foreign agent sends the packets using normal IP routing


Agent Discovery

How does the mobility binding table and the visitor list get
updated?

Agent periodically broadcast its present by sending Agent


advertisement message
Mobile node sends Agent Solicitation message
Registration

What will happen when the mobile node wants to register with the foreign
agent?

Mobile node sends a registration request message to the foreign agent


Foreign agent then sends a registration request message to the home agent
Home agent updates the mobility binding table and send an acknowledgement
back to the foreign agent
Foreign agent then updates the visitor list and send an acknowledgement back to
the mobile node
Registration (Cont’d)
Summary

Mobile IP has no geographical limitation


No need to change current IP address format or router
implementation
Mobile IP enables mobile connection to network
The future is wireless!
References

Charles Perkins. Mobile Networking Through Mobile IP.


http://www.computer.org/internet/v2n1/perkins.htm
Chen Yi-an. A Survey Paper on Mobile IP. http://www.cis.ohio-
state.edu/~jain/cis788-95/mobile_ip
Debalina Ghosh. Mobile IP: Connecting the World.
http://www.acm.org/crossroads/xrds7-2/mobileip.html

You might also like