Professional Documents
Culture Documents
Fall Semester
Lec_13
Outlines
▪ Module 01: Computer Networks and the Internet
▪ Module 05: The Link Layer: Links, Access Networks, and LANs
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
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.
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
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
16
Routing Algorithm Types
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
27
Updating
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
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
35
Expiration Timer
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
39
RIPv2
40