You are on page 1of 41

2022-2023

Fall Semester

Computer Networks (1) – L3


Computer Networks Technology – L2
Dr. Ahmed Abdelreheem

Lec_13
Outlines
▪ Module 01: Computer Networks and the Internet

▪ Module 02: Application Layer

▪ Module 03: Transport Layer

▪ Module 04: The Network Layer

▪ Module 05: The Link Layer: Links, Access Networks, and LANs

▪ Module 06: The physical layer

2
IP addresses: how to get one?
Q: how does network get subnet part of IP address?
A: gets allocated portion of its provider ISP’s address space
ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20

ISP can then allocate out its address space in 8 blocks:


Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23
Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23
Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23
... ….. …. ….
Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23
3
Network Layer: 4-3
IP addressing: last words ...
Q: how does an ISP get block of Q: are there enough 32-bit IP
addresses? addresses?
A: ICANN: Internet Corporation for ▪ ICANN allocated last chunk of
Assigned Names and Numbers IPv4 addresses to RRs in 2011
http://www.icann.org/ ▪ NAT (next) helps IPv4 address
• allocates IP addresses, through 5 space exhaustion
regional registries (RRs) (who may
then allocate to local registries) ▪ IPv6 has 128-bit address space
• manages DNS root zone, including
delegation of individual TLD (.com, "Who the hell knew how much address
.edu , …) management space we needed?" Vint Cerf (reflecting
on decision to make IPv4 address 32 bits
long)
4
Network Layer: 4-4
Private Addressing

5
6
NAT: network address translation
NAT: all devices in local network share just one IPv4 address as
far as outside world is concerned
rest of local network (e.g., home
Internet network) 10.0.0/24

10.0.0.1
138.76.29.7 10.0.0.4

10.0.0.2

10.0.0.3

all datagrams leaving local network have datagrams with source or destination in
same source NAT IP address: 138.76.29.7, this network have 10.0.0/24 address for
7 but different source port numbers source, destination (as usual)
Network Layer: 4-7
NAT: network address translation
▪ all devices in local network have 32-bit addresses in a “private” IP
address space (10/8, 172.16/12, 192.168/16 prefixes) that can only
be used in local network
▪ advantages:
▪ just one IP address needed from provider ISP for all devices
▪ can change addresses of host in local network without notifying
outside world
▪ can change ISP without changing addresses of devices in local
network
▪ security: devices inside local net not directly addressable, visible
by outside world
8
Network Layer: 4-8
NAT: network address translation
implementation: NAT router must (transparently):
▪ outgoing datagrams: replace (source IP address, port #) of every
outgoing datagram to (NAT IP address, new port #)
• remote clients/servers will respond using (NAT IP address, new port
#) as destination address
▪ remember (in NAT translation table) every (source IP address, port #)
to (NAT IP address, new port #) translation pair
▪ incoming datagrams: replace (NAT IP address, new port #) in
destination fields of every incoming datagram with corresponding
(source IP address, port #) stored in NAT table
9
Network Layer: 4-9
NAT: network address translation
NAT translation table
2: NAT router changes 1: host 10.0.0.1 sends
WAN side addr LAN side addr datagram to
datagram source address
138.76.29.7, 5001 10.0.0.1, 3345 128.119.40.186, 80
from 10.0.0.1, 3345 to
138.76.29.7, 5001, …… ……
updates table
S: 10.0.0.1, 3345
D: 128.119.40.186, 80
10.0.0.1
1
S: 138.76.29.7, 5001
2 D: 128.119.40.186, 80 10.0.0.4
10.0.0.2
138.76.29.7 S: 128.119.40.186, 80
D: 10.0.0.1, 3345
4
S: 128.119.40.186, 80 10.0.0.3
D: 138.76.29.7, 5001 3
3: reply arrives, destination
address: 138.76.29.7, 5001

10
Network Layer: 4-10
NAT: network address translation
▪ NAT has been controversial:
• routers “should” only process up to layer 3
• address “shortage” should be solved by IPv6
• violates end-to-end argument (port # manipulation by network-layer device)
• NAT traversal: what if client wants to connect to server behind NAT?
▪ but NAT is here to stay:
• extensively used in home and institutional nets, 4G/5G cellular nets

11
Network Layer: 4-11
12
Routing Protocol
• Routing - Process of finding a path from a source to every destination
in the network.
• Goal - determine “good” path (sequence of routers) thru network from
source to dest.

• Algorithm - Routing protocols use algorithms for facilitating routing


information and for best path determination.

13
Routing 5

3
B C
2 5
Graph abstraction for
A 2 1 F
routing algorithms: 3
1
• graph nodes are D E
2
routers 1

• graph edges are


physical links
• link cost: delay, $ cost,  “good” path:
or congestion level  typically means minimum
cost path
 other definitions
possible
14
Routing Protocol
Design goals
• Optimality - compute the best route
• Simplicity/low overhead - efficient with a minimum software and utilization overhead

• Robustness/stability- perform correctly in the face of unusual


Circumstances
• Rapid convergence- responds quickly when the network
changes
• Flexibility- accurate adapt to a variety of network

15
Routing Protocol
• Routing protocol : protocol to exchange of information between routers about the current state of the network
• Routing protocol jobs
1. create routing table entries
2. keep routing table up-to-date
3. compute the best choice for the next hop router

Metrics used in IP routing protocols


• Hop count: A simple metric that counts the number of routers a packet must traverse.
• Bandwidth: Influences path selection by preferring the path with the highest bandwidth.
• Load: Considers the traffic utilization of a certain link.
• Delay: Considers the time a packet takes to traverse a path.
• Reliability: Assesses the probability of a link failure, calculated from the interface error count or previous link
failures.
• Cost: A value determined either by the IOS or by the network administrator to indicate preference for a route. Cost
can represent a metric, a combination of metrics, or a policy.

16
Routing Algorithm Types

• Static V.S. Dynamic


• Source routing V.S. Hop-by-hop
• Centralize V.S. Distributed
• Distance vector V.S. Link state

17
Routing Algorithm: Distance Vector
➢ Distance means routing metric
➢ Vector means destination
➢ Flood routing table only to its neighbors
➢ RIP (Routing Information Protocol) is an example
➢ Each router periodically sends a copy of its routing table to neighbors
➢ send <network X, hopcount Y>

18
Routing Information Protocol
• RIP Version 1 (RIP-1) has been around for a long time—longer than 15 years for use with IP networks. It has
many shortcomings compared to some of the relatively newer IP routing protocols, but it does work and is
an easy tool to use for comparison with the other routing protocols.

19
20
Distance Vector Routing Update

21
Routing Information Protocol

22
Routing Information Protocol

23
Routing Information Protocol

24
Hop Count
• The hop count is the number of networks that a
packet encounters to reach its final destination.
• After 15 hops, the packet is discarded

25
Initialization
• When a router is added to a network, it initializes a routing
table for itself, using its configuration file.
• The table contains only the directly attached networks and
hop counts, which are initialized to 1.
• The next-hop field is empty.

26
26
Sharing
• The whole idea of distance vector routing is the sharing of information between
neighbors
• Although router A does not know about router C, router B does. So if router B shares
its routing table with A, node A can also know how to reach node C

In distance vector routing, each node shares its


routing table with its immediate neighbors
periodically and when there is a change.

27
Updating

• When a router receives a 2-column table from a neighbor, it needs to


update its routing table. Updating takes 3 steps:
1. The receiving router needs to add one hop count to each value in the hop count
column
2. The receiving router needs to add the name of the sending router to each row as
the 3rd column if the receiving router uses information from any row. The sending
router is the next node in the route

28
Updating
3- The receiving router needs to compare each row of its old table with the
corresponding row of the modified version of the received table.

29
Updating Algorithm

30
31
When to Share

• The table is sent both periodically and when there is a change in the table
• Periodic Update. A router sends its routing table, normally every 30 seconds, in
a periodic update.
• Triggered Update. A router sends its 2-column routing table to its neighbors any
time there is a change in its routing table. The change can result from the
following.
1. A router receive a table from a neighbor resulting in changes in its own table after updating
2. A router detects some failure in the neighboring links which results in a distance change to
infinity

32
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

33
Timer in RIP

• RIP uses 3 timers. The periodic timer controls the sending of messages,
the expiration timer governs the validity of a route, and the garbage
collection timer advertises the failure of a route

34
Periodic Timer

• The periodic timer controls the advertising of regular update messages


• The working model uses a random number between 25 and 30 s
• This is to prevent any possible synchronization and therefore overload on
an network if routers update simultaneously

35
Expiration Timer

• The expiration timer governs the validity of a route


• When a router receives update information for a route, the expiration
timer is set to 180 s for that particular route
• Every time a new update for the route is received, the timer is reset
• If the timer is expired, the hop count of the route is set to 16, which
means the destination is unreachable

36
Garbage Collection Timer

• When the information about a route becomes invalid, the router does not
immediately purge that route from its table
• Instead, it continues to advertise the route with a metric value of 16
• At the same time, the garbage collection timer is set to 120 s for that
route
• When the count reaches zero, the route is purged from the table

37
Example

• A routing table has 20 entries. It does not receive information about five
routes for 200 s. How many timers are running at this time?

• Solution
The 21 timers are listed below:
Periodic timer: 1
Expiration timer: 20 − 5 = 15
Garbage collection timer: 5

38
RIP v1 Drawbacks

• RIP version 1 does not recognize subnets.


• This feature was added in RIP version 2.
• Because RIP only uses hop count as a metric, packets may be forced to take
a slower route with less hops over a faster route with more hops.
• Other routing protocols use a combination of different metrics to calculate a route.

39
RIPv2

• RIPv2 is an extends RIPv1:


• Subnet masks are carried in the route information
• Authentication of routing messages
• Exploits IP multicasting

• Extensions of RIPv2 are carried in unused fields of RIPv1 messages

40

You might also like