Lecture#19-26 Network Layer
Lecture#19-26 Network Layer
Lecture#19-26
Solution
Solution
Solution
Solution
Solution
Solution
See Figure 1
The mask is
11111111 11111111 11111111 11000000
or
255.255.255.192.
The number of subnets is 1024.
The number of addresses in each subnet is 26
(6 is the number of 0s) or 64.
See Figure 2
3/27/2023 Network Layer 43
Figure 2
Example 10[5]
Solution
We need 16 blocks. For 16 blocks we need to change four
1s to 0s in the default mask. So the mask is
11111111 11111111 11110000 00000000
or
255.255.240.0
Solution
The supernet has 21 1s. The default mask has 24 1s. Since
the difference is 3, there are 23 or 8 blocks in this supernet.
The blocks are 205.16.32.0 to 205.16.39.0. The first
address is 205.16.32.0. The last address is 205.16.39.255.
Solution
The beginning address is 205.16.37.24. To find the last address we
keep the first 29 bits and change the last 3 bits to 1s.
Beginning:11001111 00010000 00100101 00011000
Ending : 11001111 00010000 00100101 00011111
There are only 8 addresses in this block.
Solution
The prefix length is 27, which means that we must keep
the first 27 bits as is and change the remaining bits (5) to
0s. The 5 bits affect only the last byte. The last byte is
01010010. Changing the last 5 bits to 0s, we get 01000000
or 64. The network address is 167.199.170.64/27.
Solution
Specified in terms
Unique packet id “do not fragment” “more fragments” of “no of 8 bytes”
Helps to limit the no. of Protocol used to generate the 16 bit checksum,
hops or time spent in the payload (TCP, UDP etc.) covers header only
network
A B E F
Physical view:
IPv6 IPv6 IPv4 IPv4 IPv6 IPv6
A B C D E F
Physical view:
IPv6 IPv6 IPv4 IPv4 IPv6 IPv6
data data
A-to-B: E-to-F:
B-to-C: B-to-C:
IPv6 IPv6
IPv6 inside IPv6 inside
IPv4 IPv4
3/27/2023 Network Layer 4-79
Routing: the problem
H1 H4
H5
H3 Router1
• Performance metric :
– Number of hops
– Measured delay
– Mean queue length
– Avg traffic
– Bandwidth
– Transmission delay
v 3 w
2 5
u 2 1 z
3
1 2
x y
1
3/27/2023 Network Layer 4-86
Dijkstra’s Algorithm(2)
Resulting shortest-path tree from u:
v w
u z
x y
• Distance-vector routing
• Link-state routing
• Others
– Hierarchical routing
• Standards
– OSPF
– BGP
Basic idea:
• Each node periodically sends its own distance vector estimate
to neighbors v
• When a node x receives new DV estimate from neighbor, it
updates its own DV using Bellman-Ford equation:
At node J
Message complexity
– LS: with n nodes, E links, O(nE) msgs sent
– DV: exchange between neighbors only
Speed of Convergence
– LS: O(n2) algorithm requires O(nE) msgs
– DV: convergence time varies
• may be routing loops
• count-to-infinity problem
• Now suppose AS1 learns from the inter-AS protocol that subnet x
is reachable from AS3 and from AS2.
• To configure forwarding table, router 1d must determine towards
which gateway it should forward packets for destination x.
• This is also the job on inter-AS routing protocol!
3c
3a 2c
3b 2a
AS3 2b
1c
AS2
1a 1b
1d AS1
Network Layer 4-100
Internet Routing [6]
Example: Choosing among multiple ASes
• Now suppose AS1 learns from the inter-AS protocol that subnet
x is reachable from AS3 and from AS2.
• To configure forwarding table, router 1d must determine
towards which gateway it should forward packets for
destination x.
• This is also the job on inter-AS routing protocol!
• Hot potato routing: send packet towards closest of two routers.
u destination hops
v
u 1
A B w v 2
w 2
x 3
x y 3
C D z 2
z
y
A’s Table
3/27/2023 Network Layer 4-103
RIP advertisements
w x y
A D B
Routing table in D
w x y
A D B
C
Destination Network Next Router Num. of hops to dest.
w A 2
y B 2
z BA 75
x -- 1
…. …. ....
Routing table in D
3/27/2023 4-106
Network Layer
RIP: Link Failure and Recovery
If no advertisement heard after 180 sec --> neighbor/link declared
dead
– routes via neighbor invalidated
– new advertisements sent to neighbors
– neighbors in turn send out new advertisements (if
tables changed)
– link failure info quickly propagates to entire net
– Message in reverse direction (poison reverse) is used
to prevent ping-pong loops (infinite distance = 16
hops)
routed routed
Transprt Transprt
(UDP) (UDP)
network forwarding forwarding network
(IP) table table (IP)
link link
physical physical
3c
3a 2c
3b 2a
AS3 2b
1c
AS2
1a 1b
AS1 1d
eBGP session
iBGP session
3/27/2023 Network Layer 4-114
Distributing Reachability Info[6]
• With eBGP session between 3a and 1c, AS3 sends prefix
reachability info to AS1.
• 1c can then use iBGP to distribute this new prefix reach info to all
routers in AS1
• 1b can then re-advertise the new reach info to AS2 over the 1b-
to-2a eBGP session
• When router learns about a new prefix, it creates an entry for the
prefix in its forwarding table.
3c
3a 2c
3b 2a
AS3 2b
1c
AS2
1a 1b
AS1 1d
eBGP session
iBGP session
3/27/2023 Network Layer 4-115
Path attributes & BGP routes
• When advertising a prefix, advert includes BGP attributes.
– prefix + attributes = “route”
• Two important attributes:
– AS-PATH: contains the ASs through which the advert for the prefix
passed: AS 67 AS 17
– NEXT-HOP: Indicates the specific internal-AS router to next-hop AS.
(There may be multiple links from current AS to next-hop-AS.)
• When gateway router receives route advert, uses import
policy to accept/decline.
R3 R4 R3 R4
source in-network
duplication duplication
B B
c c
D D
F E F E
G G
(a) Broadcast initiated at A (b) Broadcast initiated at D
Approaches:
• source-based tree: one tree per source
– shortest path trees
– reverse path forwarding
• group-shared tree: group uses one tree
– minimal spanning ( Work out this only)
– center-based trees
Operation of DHCP.