Professional Documents
Culture Documents
Network Layer
McGraw-Hill 1
©The McGraw-Hill Companies, Inc., 2000
Outline
McGraw-Hill 2
©The McGraw-Hill Companies, Inc., 2000
An IP address is a
32-bit address.
The IP addresses are
unique.
75 95 1D EA
0x75951DEA
Solution
Solution
Solution
Solution
Solution
Solution
Solution
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 5.9
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Figure 5-9
Example 4
SUPERNETTING
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
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Example 7
Solution
Variable-length blocks
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
Design the subblocks and give the slash notation for each subblock.
Find out how many addresses are still available after these allocations.
McGraw-Hill 91
©The McGraw-Hill Companies, Inc., 2000
IP packet format
Specified in terms
Unique packet id “do not fragment” “more fragments” of “no of 8 bytes”
McGraw-Hill 92
©The McGraw-Hill Companies, Inc., 2000
IP packet format
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
McGraw-Hill 93
©The McGraw-Hill Companies, Inc., 2000
NAT – Network Address Translation
McGraw-Hill 94
©The McGraw-Hill Companies, Inc., 2000
IP Fragmentation
• The Identification field, and Fragment offset field along
with Don't Fragment and More Fragment flags in the IP
protocol header are used for fragmentation and
reassembly of IP datagram's.
• In a case where a router receives a protocol data unit
(PDU) larger than the next hop's MTU(Maximum
Transfer Unit).
• It has two options if the transport is IPv4. Drop the PDU
and send an Internet Control Message Protocol(ICMP)
message which indicates the condition Packet too Big.
• or to fragment the IP packet and send it over the link with
a smaller MTU.
McGraw-Hill 95
©The McGraw-Hill Companies, Inc., 2000
Routing: the problem
H1 H4
H5
H3 Router1
McGraw-Hill 96
©The McGraw-Hill Companies, Inc., 2000
Routing
• Performance metric :
– Number of hops
– Measured delay
– Mean queue length
– Avg traffic
– Bandwidth
– Transmission delay
McGraw-Hill 97
©The McGraw-Hill Companies, Inc., 2000
Routing protocols: classification
• Static routes
– Computed off-line
– based on certain topology, traffic, Routing
performance metric algorithms
– Not change, unless there is a
major network overhaul
• Adaptive routing
– Routes adapt to changes in
static adaptive others
topology, traffic
– On-line based on current
measurements Centralized (based Decentralized (on
– Based on complete or partial on all info) incomplete info)
knowledge
– Distributed computation vs.
centralized computation
• Other algorithms
– Flooding
– Broadcasting
McGraw-Hill 98
©The McGraw-Hill Companies, Inc., 2000
Figure 6-7
McGraw-Hill 99
©The McGraw-Hill Companies, Inc., 2000
Shortest Path Routing Algorithm
McGraw-Hill 4-100
©The McGraw-Hill Companies, Inc., 2000
Dijsktra’s Algorithm
1 Initialization:
2 N' = {u}
3 for all nodes v
4 if v adjacent to u
5 then D(v) = c(u,v)
6 else D(v) = ∞
7
8 Loop
9 find w not in N' such that D(w) is a minimum
10 add w to N'
11 update D(v) for all v adjacent to w and not in N' :
12 D(v) = min( D(v), D(w) + c(w,v) )
13 /* new cost to v is either old cost to v or known
14 shortest path cost to w plus cost from w to v */
15 until all nodes in N'
McGraw-Hill 4-101
©The McGraw-Hill Companies, Inc., 2000
Shortest path Routing:
(Dijkstra’s algorithm)
Step N' D(v),p(v)D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw 4,y
5 uxyvwz
5
v 3 w 5
2
u 2 3 1 z
1 x 2
y
1
McGraw-Hill 4-102
©The McGraw-Hill Companies, Inc., 2000
Dijkstra’s algorithm: example (2)
Resulting shortest-path tree from u:
v w
u z
x y
McGraw-Hill 4-104
©The McGraw-Hill Companies, Inc., 2000
Bellman-Ford example (2)
5
Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
v 3 w
2 5
u 2 z B-F equation says:
3 1
1 2 du(z) = min { c(u,v) + dv(z),
x y
1 c(u,x) + dx(z),
c(u,w) + dw(z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
Node that achieves minimum is next
hop in shortest path ➜ forwarding table
McGraw-Hill 4-105
©The McGraw-Hill Companies, Inc., 2000
Distance Vector Algorithm (3)
McGraw-Hill 4-106
©The McGraw-Hill Companies, Inc., 2000
Distance vector algorithm (4)
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 B-F equation:
McGraw-Hill 4-107
©The McGraw-Hill Companies, Inc., 2000
Distance Vector Algorithm (5)
McGraw-Hill 4-109
©The McGraw-Hill Companies, Inc., 2000
Distance-vector routing: Example
• Each router maintains a routing table, with estimated “distance” to each
destination (and updates it periodically)
• Each router periodically exchanges this table with its neighbors
At node J
McGraw-Hill 110
©The McGraw-Hill Companies, Inc., 2000
Distance-vector routing: Example
McGraw-Hill 111
©The McGraw-Hill Companies, Inc., 2000
Distance-vector routing
• Several problems with Distance Vector routing:
– Poor estimate of delays along each link
– Count-to-infinity problem:
• Good news spreads fast
• Bad news travels slow, very slow
McGraw-Hill 112
©The McGraw-Hill Companies, Inc., 2000
Comparison of LS and DV algorithms
McGraw-Hill 4-113
©The McGraw-Hill Companies, Inc., 2000
DVR vs Link State Routing
• Distance Vector Routing:
• - Tell neighbors about distance of all the destination
• - Node’s computation depends on neighbors
• - Each router maintains distance vector, (dist , cost) tuple per
• destination
• - Periodically send copy of distance vector to all neighbors
McGraw-Hill 114
©The McGraw-Hill Companies, Inc., 2000
Broadcast Routing
• Deliver packets from source to all other nodes
• Source duplication is inefficient:
duplicate
duplicate
R1 creation/transmission R1
duplicate
R2 R2
R3 R4 R3 R4
source in-network
duplication duplication
Source duplication: how does source determine
recipient addresses?
McGraw-Hill 4-115
©The McGraw-Hill Companies, Inc., 2000
In-network duplication
• Flooding: when node receives brdcst pckt, sends
copy to all neighbors
– Problems: cycles & broadcast storm
• Controlled flooding: node only brdcsts pkt if it
hasn’t brdcst same packet before
– Node keeps track of pckt ids already brdcsted
– Or reverse path forwarding (RPF): only forward pckt
if it arrived on shortest path between node and source
• Spanning tree
– No redundant packets received by any node
McGraw-Hill 4-116
©The McGraw-Hill Companies, Inc., 2000
Reverse Path Forwarding
S: source LEGEND
R1
R4
R2
router
R5
R3 datagram will be
R6 R7 forwarded
datagram will not be
forwarded
• result is a source-specific reverse SPT
– may be a bad choice with asymmetric links
B B
C C
D D
F E F E
G G
McGraw-Hill 4-119
©The McGraw-Hill Companies, Inc., 2000
Multicast Routing: Problem Statement
• Goal: find a tree (or trees) connecting routers
having local mcast group members
– tree: not all paths between routers used
– source-based: different tree from each sender to rcvrs
– shared-tree: same tree used by all group members
McGraw-Hill 121
©The McGraw-Hill Companies, Inc., 2000
Internet control protocols
• Several protocols:
– ARP, RARP (these are discussed later)
– ICMP
• Several messages, including “echo” and “echo-reply” used to “ping”
hosts
• These are encapsulated inside an IP packet
McGraw-Hill 122
©The McGraw-Hill Companies, Inc., 2000
ARP protocol
• ARP protocol: “address resolution protocol”
– IP address Data-link (or physical) address
– This is distinct from”domain-name” IP address problem
McGraw-Hill 123
©The McGraw-Hill Companies, Inc., 2000
ARP protocol
• ARP protocol:
– ARP-REQ ARP-REPLY packets
• ARP-REQ is broadcast over local subnet only
– Destination IP address Ethernet address is cached by
source, once a reply is received
– The destination also caches similar info about the source
McGraw-Hill 124
©The McGraw-Hill Companies, Inc., 2000
ARP protocol
• Consider H1 to H4 communication
– H1 issues an ARP-REQ, to which CS router responds with its E3
address
– CS router issues an ARP-REQ on FDDI ring, to which EE router
responds with its F3 address
– EE router issues an ARP-REQ on the Ethernet, to which H4
responds with its E6 address
McGraw-Hill 125
©The McGraw-Hill Companies, Inc., 2000
RARP protocol
• ARP gives IP-addr Physical-addr
• RARP solves the problem of “what is my IP address”?
– A problem that occurs in disk-less workstations, that have no disk resident
OS
• RARP-REQ issued by client, while RARP-REPLY is sent by RARP
server
• Need a RARP server for each network separated by a router
• Need to have entries for each IP-addr IP address
• Both problems solved using DHCP protocol
McGraw-Hill 126
©The McGraw-Hill Companies, Inc., 2000
Dynamic Host Configuration
Protocol
Operation of DHCP.
McGraw-Hill 127
©The McGraw-Hill Companies, Inc., 2000
Thanks
McGraw-Hill 128
©The McGraw-Hill Companies, Inc., 2000