Chapter 4 - Internet Layer
Chapter 4 - Internet Layer
Chapter 4 - Internet Layer
Internet Layer
Reading 5.1. and 5.6 in Computer Networks,
Tanenbaum
The lecture uses materials provided by Keio University, Japan
1
Contents
l Internet Protocol
l IP address and IP packet format
l ICMP- Protocol for control message
2
Introduction about IP
Concepts
Store and forward principles
Characteristic of IP
3
Network layer and Internet protocol
l Role of network layer: Transferring data between distant nodes
l Two main functionalities of Network layer
l Routing: Determine the path for transferring data from the source
to the destination nodes à Role of routing protocol.
l Forwarding: Transferring data from an incoming port to an
outgoing port of a node (router) according to the path defined
above è Role of routed protocol: Internet Protocol (IP)
application
application
TCP/UDP
TCP/UDP
IP
1. Send data IP
data link 2. Receive data
data link
physical
physical
4
Network layer and Internet Protocol (IP)
5
IP principles
l Network elements
Switch
l host = end system;
l subnetwork = a collection of hosts that are
connected by layer-2 devices
l Hosts of a subnetwork have similar
addresses: a common prefix Router
l Routers: intermediate nodes interconnect
subnetworks
l Packet forwarding Switch
Router Switch
l Within a subnetwork: hosts communicate
directly through layer-2 device (switch)
l Between subnetworks: one or several
routers forward packets based on the
destination network address.
Switch
A subnetwork
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
6
Routing and forwarding
Routing protocol
Routing
protocol identifies the shortest
path to a network
Forwarding table
dest address outgoing port Forwarding table
Net 1/net.mask 1 identifies an outgoing
Net 2/net.mask 2 port to send data toward
Net 3/net.mask 1 a destination network
twork
bne
su
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
7
IP address
IP address classes
CIDR – Classless Inter-Domain routing
Subnet and netmask
Special IP addresses
8
IP address (IPv4)
• IP address: A 32-bit
number identifying 223.1.1.1
A subnetwork
10
Dot notation
Example:
203.178.136.63 o
259.12.49.192 x
133.27.4.27 o
8 bits
0 – 255 integer
3417476964
1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 0 0 1 1 1 1 0 1 1 0 0 1 0 0
11
Host address, network address
1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 0 0 1 1 1 1 0 1 1 0 0 1 0 0
12
Classify IP addresses
!"#$"%&'(#)* !"#$"+#,',
-./,,"0 123 2425
-./,,"6 17835 79987
-./,,"- 2421 297
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
13
Exercise
14
Limitation of classful IP address
Solution…
l CIDR: Classless Inter Domain Routing
l Network ID part will have variable length.
l Length of Network ID part is specified in Network mask
l Address notation: a.b.c.d/x, where x (mask) the number of
bits in Network ID part.
15
Network mask
16
Presentation of network mask
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0
17
Calculation of network address
AND
27 (bit)
203 . 178 . 142 . 128
110 0 1 011 101 1 0 010 100 0 1 110 100 0 0 000
18
Different significations of IP address
• Network address
• IP address assigned to a network
• hostID contains all 0
• Broadcast address
• Address used for sending data to all hosts in a
network
• All bit 1 in HostID part.
• Host address
• IP address assigned to a network card
• Should not be a network or a broadcast address
19
Network address or host address (1)
133 27 4 160
10000101000110110000010010100000
11111111111111111111111111000000
10000101000110110000010010000000
133 27 4 128
20
Network address or host address (2)
133 27 4 160
10000101000110110000010010100000
11111111111111111111111111100000
10000101000110110000010010100000
133 27 4 160
21
Exercice: IP address and network mask
22
Calculation of network size
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0
23
Calculation of network size
• Network mask: /n
• Network size: The maximum acceptable number
of hosts in that network, each host must have a
distinguish IP address
• IP address : NetworkID HostID
24
Subnet
• Subnet is a part of a
network 223.1.1.1
25
Example: Divide into 2 subnets
26
Principle
Network ID Host ID
subnetID
27
Exercise: Dividing into subnets
28
Addressing space of IPv4
• In theory
• All between 0.0.0.0 ~ 255.255.255.255
• Some special IP address (RFC1918)
10.0.0.0/8
Private address 172.16.0.0/12
192.168.0.0/16
Loopback address 127.0.0.0
224.0.0.0
Multicast address
~239.255.255.255
29
Attention about IP
30
IP packet
31
Header of IP
total datagram
length (words)
IP protocol version 32 bits
number
ver head. DS length
header length len for
(bytes) fragment
16-bit identifier flgs fragmentation/
offset reassembly
QoS support time to upper header
live layer checksum
max number 32 bit source IP address
remaining hops
32 bit destination IP address
(decremented at
each router) Options (if any) E.g. timestamp,
record route
data taken, specify
upper layer protocol (variable length, list of routers
to deliver payload to typically a TCP to visit.
or UDP segment)
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
32
IP header (1)
• Version (4 bits)
• IPv4
• IPv6
• Header length: 4bits
• In word unit (4 bytes)
• Min: 5
• Max: 60
33
IP header (2)
34
IP header (3)
35
IP header (4)
36
IP header (4)
37
Packet fragmentation (1)
38
Packet fragmentation (2)
• Offset
• Position of the fragment in the original packet
• In 8 bytes units
0 1399
Offset = 0/8 = 0
2800 3999
Offset = 2800/8 = 350
39
Network Address
Translation (NAT)
4.3. Chuyển đổi địa chỉ (NAT)
Principal NAT
41
Static NAT
42
Static NAT - Example
Src: a.b.c.d
Src: a.b.c.d
Dst: 10.0.0.20
Dst: 202.191.56.65
5/16/24
School of Information and Communication Technology
Dynamic NAT – Example
Inside IP Outside IP
NAT Table
10.0.0.31 202.191.56.15
10.0.0.32 202.191.56.16
5/16/24
School of Information and Communication Technology
PAT– Example
Src: 202.191.56.15:2001 Src: 10.0.0.31:6000
Dst: a.b.c.d:443 Dst: a.b.c.d:443
48
What is routing?
Routing principals
Forwarding mechanism
“Longest matching” rule
49
Routing and Forwarding principles (1)
Router Router
A
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
B C D
School of Information and Communication Technology
50
Forward IP packets
Routing protocol
Forwarding table
dest address outgoing port
net1. address/net.mask 1
net2. address/net.mask 2
net3. address/net.mask 1
YAMAHA
RTX-1500 Cisco 2600
BUFFALO PLANEX
BHR-4RV GW-AP54SAG
Router small size
Cisco CRS-1
Cisco 3700 53
Routing table and forwarding mechanism (1)
54
Bảng chọn đường và cơ chế chuyển tiếp (1)
Network Next-hop Interface
172.16.0.0/24 B2 A2 192.168.0.0/2 B3 C2
4
192.168.0.0/24 B2 A2
Router B Router C
Router A A2 B2 B3 C2
A1 B1 C1
10.0.0.0/24 A2 B2
Lưu ý quy tắc: No routes,
no reachability!
172.16.0.0/24 C2 B3
192.168.0.0/24 Direct B1
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
Routing table and forwarding mechanism (2)
Internet
Router B
Network Next-hop Q. What is the
10.0.0.0/24 A routing table in B?
172.16.0.0/24 C Q: What if C is
192.168.0.0/24 Direct connected to the
Internet?
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
59
Routing table and forwarding mechanism (2)
Router X Internet
Router B
Q: What if C is connected
Network Next-hop
to the Internet?
10.0.0.0/24 A
172.16.0.0/24 C What to be change in
192.168.0.0/24 Direct routing table of A,B, and C
0.0.0.0/0 C to communicate with the
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
Internet
School of Information and Communication Technology
60
Default route
Router A
Internet
61
Longest matching rule
Destination address:
11.1.2.5 = 00001011.00000001.00000010.00000101
Route 3:
11.1.2.0/24 = 00001011.00000001.00000010.00000000
Route 2:
11.1.0.0/16 = 00001011.00000001.00000000.00000000
Route 1:
11.0.0.0/8 = 00001011.00000000.00000000.00000000
63
Route aggregation
200.23.1.0/24
200.23.0.0/24
200.23.0.0/23
200.23.1.0/24
200.23.0.0/22
200.23.2.0/24
200.23.1.0/23
200.23.3.0/24
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
64
Packet processing on routers
• Step 1 : If TTL = 1(or TTL = 0), destroy the packet and send error
message. End.
• Step 2 : If TTL >1, extract the destination IP address of the packet.
Apply the mask of networks in its routing table to destination IP
address to find corresponding network addresses.
• Step 3 : Compare the obtained network addresses with networks
in routing table.
• If find a matching route, forward the packet to the interface of the
route, reduce TTL by 1.
• If find >1 routes matchedè apply longest matching rule to select the
best route, reduce TTL by1
• If no route match, check if there is a default route (with network
0.0.0.0 /0).
• If there is a default route, forward the packet to the corresponding
interface and reduce TTL by 1.
• If there is no default route: destroy the packet, send an error message
back to the source.
65
Exercises
66
Solution
67
PCM với 64 mức lượng tử.
Exercise
Câu 2 (1 ñiểm) Câu 2 Vẽ tín hiệu số ñiều chế ñược cho dữ liệu số 10110011100
theo kiểu mã hoá NRZ-L
Câu 3 (2 ñiểm) Nêu các phương pháp ñiều khiển truy cập ñường truyền. Giải
thích cơ chế hoạt ñộng của phương pháp CSMA/CD.
lAssume that we have a network with following
topology. chiaWhat should
con. Xác be
ñịnh sốrouting
máy tối ña trongtable
mỗi mạng?of
Câu 4 (2 ñiểm) Cho một mạng với ñịa chỉ IP là 192.168.1.0/24. Mạng này ñược
thành 5 các mạng Mặt
routers B, C, D in order to assure that all hosts
nạ cho các mạng con là bao nhiêu? Xác ñịnh ñịa chỉ mạng của mỗi mạng
con.
can send data to each other and to the Internet.
Câu 5 (2 ñiểm): Cho một sơ ñồ mạng như hình vẽ, thiết lập bảng ñịnh tuyến trên
các router B, C, D, X ñể các mạng có thể kết nối với nhau và Internet.
Câu 6 (1 ñiểm): TCP là một giao thức tin cậy, nó cung cấp các cơ chế kiểm lỗi,
luồng dữ liệu, tắc nghẽn mà IP không có. Tuy thế UDP không có các cơ
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
chế này. Vậy tại sao vẫn cần dùng UDP ? Tại sao không thể xây dựng các
School of Information and Communication Technology
lRouting table on D
Network Next hop
133.133.0.0/16 C
155.0.0.0/8 B
203.203.203.0/24 Direct
0.0.0.0/0 X
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
69
Internet Control Message Protocol
Packet format
Ping and Traceroute
70
Idea of ICMP (1)
71
Idea of ICMP (2)
ICMP message
72
IP header and Protocol field
Data
73
ICMP message format
0 78 15 16 31
Type Code Checksum
Rest of the header
Data
74
Some ICMP message types
3 Destination Unreachable
4 Source quench (nguồn giảm tốc độ)
Error-reporting
ICMP Message Type
5 Redirection
messages
11 Time exceeded
12 Parameter problem
8 or 0 Echo reply or request
75
ICMP code: sub-type
76
ICMP and debuging tools
77
Ping and ICMP
• ping
• Test a connection
• Sender sends packet “ICMP echo request”
• Receiver responses with “ICMP echo reply”
• Data field contains the time stamp when the
packet is sent
• For calculating RTT (round-trip time)
78
Ping: Example
79
Traceroute and ICMP
80
Traceroute and ICMP
Termination condition
• When ICMP echo packet arrive to the destination
• When source receives ICMP “host unreachable”
(type 3, code 3)
3 probes 3 probes
3 probes
81
Traceroute: Example
C:\Documents and Settings\hongson>tracert www.jaist.ac.jp
Trace complete.
82
Static and dynamic routing
Static routing
Dynamic routing
Advantage – Weakness
83
Problem of update routing table
New Network
lStatic routing
lEntries in the routing tables are updated manually
by network administrator.
lDynamic routing
lThe routing table is updated automatically by some
routing protocols running on routers
85
Static routing
• When there is some
failures on a route:
• Impossible to access to Internet
Internet even though
there is an alternative
route
• Admin needs to update
routing table at 10.0.0.1 10.0.0.3 10.0.0.2
Next-hop 10.0.0.3
Extract of routing table at 10.0.0.1
0.0.0.0/0 10.0.0.3
Next-hop 10.0.0.1
Entry causing error
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
86
Dynamic routing
Next-hop 10.0.0.1
87
Pros/cons
• Static routing
• Pros:
• Stable,
• Secure,
• Not influence by external factor
• Cons:
• Not flexible,
• It is impossible for using automatically backup routes
• Difficult to manage
• Dynamic routing
• Pros
• Easy to manage
• Backup routes are used automatically when there are failures
• Cons
• Not secure
• Complicated routing protocols
88
Routing algorithm and protocols
Dijkstra and Bellman-Ford Algo
link-state and distance-vector protocols
89
Graph representing the networks
• Graph with nodes (routers) and edges (links)
• Weight on each link c(x,y)
• Weigh can be bandwidth, delay, congestion level, cost…
expressing the contribution of the link in the total cost of a
route
• Routing algorithm: Determine the shortest path (in
term of weight) between a pair of two nodes.
3
v w
2 5
u 2 1 z
3
1
2
x y
1
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
90
Shortest path tree-SPT
v 3 w 5 v w
2
u 2 1 z u z
3
1 2
x 1
y x y
91
Two classes of routing algorithms
lLink-state
lGathering the topology information at a node à
build graph
lRun a path calculation algorithm on the node
lBuild routing table on the node
lOSPF routing protocol
lDistance vector
lEach node build temporary a routing table
lExchange routing tables for finding better routes
through the neighbors
lRIP routing protocol
92
Link-state algorithms- Dijikstra
• Notations:
• G = (V,E) : Graph representing the network: V: set of nodes, E: set
of links
• c(x,y): cost of using link x to y;
• = ∞ f the two nodes are not linked together
• d(v): current cost for going from the source node to node v
• p(v): node right before v on the route from the source to
destination
• T: Set of nodes whose shortest paths have been identified.
93
Link-state algorithms- Dijikstra
• Procedures:
• Init():
For each node v, d[v] = ∞, p[v] = NIL
d[s] = 0
• Improve(u,v), where (u,v) is an edge of G
if d[v] > d[u] + c(u,v) then
d[v] = d[u] + c(u,v)
p[v] = u
94
Link-state algorithms- Dijikstra
1. Init() ;
2. T = F;
3. Repeat
4. u: u Ï T | d(u) is the smallest;
5. T = T ∪ {u};
6. for all v Î neighbor(u) and v ÏT
7. improve(u,v) ;
8.Until T = V
95
Dijkstra’s algorithm: Example
96
Distance-vector algorithm Bellman-Ford (1)
5
v 3 w
2 5
u 2 1 z
3
1 2
x 1
y
Definitions:
du(z) := cost of the shortest path from u to z
We have: Bellman-Ford equation:
97
Distance-vector algorithm Bellman-Ford (2)
• Vision of u: • u choose the shortest
• Know only neigbour and path to a destination (ex.:
believe on the path z) amongst all paths via
reported by neighbors
its neighbour v, x,w
• Via x:
5 • du(z) = (u,x) + dx(z)
• Via v: Distance reported by x
v w
2 • du(z) = (u,v) + dv(z)
u z • Via w:
1 • du(z) = (u,w) + dw(z)
x y
98
Distance-vector algorithm Bellman-Ford (3)
99
Distance-vector algorithm Bellman-Ford (2)
100
Distance-vector algorithm (2)
101
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2
Node x
Cost to Cost to
x y z x y z
x 0 2 7 x 0 2 3 Dx(z) = min{c(x,y) +
y ∞∞ ∞ y 2 0 1 Dy(z), c(x,z) + Dz(z)}
From
from
= min{2+1 , 7+0} = 3
z ∞∞ ∞ z 7 1 0
Node y
Cost to
x y z y
2 1
x ∞ ∞ ∞
x z
y 2 0 1 7
from
z ∞∞ ∞
Node z
Cost to
x y z
x ∞∞ ∞
y ∞∞ ∞
from
z 7 1 0
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
Time
102
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} Dx(z) = min{c(x,y)+Dy(z), c(x,z)+ Dz(z)}
= min{2+0 , 7+1} = 2 = min{2+1 , 7+0} = 3
Node x
Cost to Cost to Cost to
x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3
y ∞∞ ∞ y 2 0 1 y 2 0 1
từ
từ
từ
z ∞∞ ∞ z 7 1 0 z 3 1 0
Node y
Cost to Cost to Cost to
x y z x y z x y z y
2 1
x ∞ ∞ ∞ x 0 2 7 x 0 2 3 x z
y 2 0 1 y 2 0 1 y 2 0 1 7
từ
từ
từ
z ∞∞ ∞ z 7 1 0 z 3 1 0
Node z
Cost to Cost to Cost to
x y z x y z x y z
x ∞∞ ∞ x 0 2 7 x 0 2 3
y ∞∞ ∞ y 2 0 1 y 2 0 1
từ
từ
từ
z 7 1 0 z 3 1 0 z 3 1 0
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
Time
103
Comparison of Link-state and Distance vector
104
Implementation of routing protocols
105
B
Internet
172.16.0.0/24 D
A C
10.0.0.0/24 192.168.0.0/24
107
Hierarchical architecture of the Internet
• Internet = Network of networks
• Each network may have a particular routing policy
• Such a network is an Autonomous System (AS)
AS 2
AS 5
AS 1
AS 4
AS 3
108
Concept of Autonomous system
Source: http://www.cidr-report.org
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
109
Number of ASN assigned by IANA
Source: http://www.potaroo.net/
2008
110
Hierarchical of routing protocols
111
Intra-domain and Inter-domain routing
AS2
EGP
RIP domain EGP
EGP
AS4 EGP IGP
IGP AS3
RIP domain
IGP
AS5 OSPF domain
RIP domain
RIP domain
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
112
Intradomain routing
RIP
OSPF
113
RIP ( Routing Information Protocol)
From A:
u v Destination number of hops
u 1
A B w v 2
w 2
x 3
x y 3
z C D z 2
y
114
Recall DV route calculation (1)
Net A
133.27.4.0/24
Router A Router C
To 133.27.4.0/24
1 hop
Net B
Router B
133.27.5.0/24
Router D
115
Recall DV route calculation (2)
Net A
133.27.4.0/24
116
Recall DV route calculation (3)
Net A
133.27.4.0/24
117
Recall DV route calculation (4)
Net A
133.27.4.0/24
Router A Router C
To 133.27.4.0/24
1 hop
Net B
Router B
133.27.5.0/24
Router D
To 133.27.4.0/24
2 hop
118
RIP: Routers exchange information
119
OSPF: Open Shortest Path First
120
Link state
121
Default metric in OSPF
122
Hierachical OSPF
123
Hierachical OSPF
124
RIP vs. OSPF comparison
RIP OSPF
125
Interdomain routing protocol
126
BGP – Border Gateway Protocol
2d
127
eBGP and iBGP
eBGP session
3c iBGP session
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
AS1 1d
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
128
BGP: Path vector routing
• Which routing protocol can be used to connect multiple ASes?
• No universal metric – policy decisions
• LS: No, Metric are not the same, LS database too large – entire
Internet
• DV: Bellman-Ford algorithm may not converge
• Solution: Path vector routing.
• The whole path 1is advertise instead of only distance
2 A
A
A B B→A C
3 A
1 C→B→A
A
D E
2 A 4 A
D→A D→A best path
C→B→A ×
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
129
Path attributes
AS 3 3b
AS 1b 3a 3c
1
1a 1c AS 2 3d X
2b
1d AS3, X
AS2,AS3,X 2a 2c
2d
AS2 router 2c receives path advertisement AS3,X (via eBGP) from AS3 router 3a
based on AS2 policy, AS2 router 2c accepts path AS3,X, propagates (via iBGP) to all
AS2 routers
based on AS2 policy, AS2 router 2a advertises (via eBGP) path AS2, AS3, X to
AS1 router 1c
AS 3 3b
AS 1b AS3,X 3a 3c
1 AS3,X
AS3,X
1a 1c AS 2 3d X
2b
AS3,X
1d AS3, X
AS2,AS3,X 2a 2c
2d
133
Example of BGP routes in routing table
134
ARP protocol
4.7. Giao thức ARP
MAC address and ARP
136
ARP operation
137
ARP operation – Example
ARP Request
(broadcast) Host B: 10.0.0.2
Who has 10.0.0.2? MAC: 12-29-9C-E8-FF-12
Host C: 10.0.0.3
Host A: 10.0.0.1 MAC: 13-29-9C-E8-FF-13
MAC: 11-29-9C-E8-FF-11 ARP Request
(broadcast)
Who has 10.0.0.2?
Host B: 10.0.0.2
MAC: 12-29-9C-E8-FF-12
Host C: 10.0.0.3
Host A: 10.0.0.1 ARP Request MAC: 13-29-9C-E8-FF-13
MAC: 11-29-9C-E8-FF-11 (broadcast)
Who has 10.0.0.2?
ARP Reply (unicast)
10.0.0.2 is at 12-29-9C-E8-FF-12
Host B: 10.0.0.2
MAC: 12-29-9C-E8-FF-12
Host C: 10.0.0.3
Host A: 10.0.0.1 MAC: 13-29-9C-E8-FF-13
MAC: 11-29-9C-E8-FF-11
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
138
Data transmission between LANs
Ex: A sends data to B via router R (according to routing table of A)
• A creates an IP packet with source address is A and destination address is B
• The packet is forwarded to the datalink layer of A to be packed in a layer 2 frame
with MAC source address of A and MAC destination address of R
A B
R
111.111.111.111
Switch Switch 222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
IP IP
Eth Eth
Phy Phy
A B
R1
R R2
111.111.111.111 switch switch 222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
v R chooses the next hop to forward the IP packet with source A and
destination B according to its routing table
v The IP packet is then packaged in a frame of layer 2 with MAC
address of R as source and MAC address of B as destination.
MAC src: 1A-23-F9-CD-06-9B
Figure is taken from: “Computer Networking: A MAC dest: 49-BD-D2-C7-56-2A
Top Down Approach”, Jim Kurose IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
IP Eth
Eth Phy
Phy
A B
R
111.111.111.111 switch R1 R2
switch 222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
143
DHCP : IP address distribution process
Server DHCP
3. Request: Cient choose a configuration
1. Discover : search for an available server
Client Server
• DHCP Discover: search for • DHCP Offer: provide
DHCP Server
configuration including
• DHCP Request: register an IP address
IP address
• DHCP ACK: Accept
• DHCP Release: return the
used IP address to the the registration
pool • DHCP NAK: Refuse
• DHCP Decline: Refuse an the registration
assigned IP address
145
Provide new configuration
DHCP Client DHCP Server
• B1: Client broadcasts DHCP
Discover message to look for
a Server DHCP Discover
• B2: If there is a DHCP Server (broadcast)
in the network,the server
sends DHCP Offer with
address information DHCP Offer
146
Extend the configuration
DHCP Client DHCP Server
• Each configuration is valid in a
time period T à client needs
to extend the validation of the DHCP Request
t = 0.5*T
configuration (unicast)
• When t = 0.5*T, client sends DHCP ACK
DHCP Request to DHCP (time period: T)
Server to extend the lease
Other Server
• If there is no DHCP ACK, at t= DHCP Request
0.875*T, client broadcasts t = 0.875*T
(broadcast)
DHCP Request
• If there is still no DHCP ACK, DHCP ACK
at t = T, client sends DHCP (time period: T)
Discover DHCP Discover
t=T
(broadcast)
147
DHCP Relay
148