You are on page 1of 103

Chương 4&5

Tầng mạng
ThS. Cấn Thị Phượng

Network Layer: 4-1


Tầng mạng

Data Plane Control plane


Chương 4 Chương 5

Network Layer: 4-2


Tài liệu tham khảo
A note on the use of these PowerPoint slides:
We’re making these slides freely available to all (faculty, students,
readers). They’re in PowerPoint form so you see the animations; and
can add, modify, and delete slides (including this one) and slide content
to suit your needs. They obviously represent a lot of work on our part.
In return for use, we only ask the following:
▪ If you use these slides (e.g., in a class) that you mention their
source (after all, we’d like people to use our book!)
▪ If you post any slides on a www site, that you note that they are
adapted from (or perhaps identical to) our slides, and note our
copyright of this material.
Computer Networking: A
For a revision history, see the slide note for this page.
Top-Down Approach
Thanks and enjoy! JFK/KWR 8th edition
All material copyright 1996-2020
Jim Kurose, Keith Ross
J.F Kurose and K.W. Ross, All Rights Reserved Pearson, 2020
Network layer: Mục tiêu
▪Hiểu các nguyên lý các dịch ▪ Hiện tại tầng mạng trên
vụ tầng mạng tại data Internet
plane: • IP protocol
• Dịch vụ tầng mạng • NAT, middleboxes
• forwarding versus routing
• Router làm việc
• Địa chỉ
• generalized forwarding
• Kiến trúc Internet

Network Layer: 4-4


Network layer: “data plane”
▪ Network layer: tổng quan
• data plane
• control plane
▪ Cái gì trong router
• input ports, switching, output ports
• buffer management, scheduling
▪ IP: the Internet Protocol ▪ Generalized Forwarding, SDN
• Định dạng datagram
• Match+action
• Địa chỉ
• OpenFlow: match+action in action
• network address translation (NAT)
• IPv6 ▪ Middleboxes
Network Layer: 4-5
Network-layer services and protocols
▪ Vận chuyển segment từ host gửi mobile network

tới host nhận national or global ISP

• sender: đóng gói segments vào


datagrams, gửi xuống link layer application

• receiver: phân phát segment tới transport


network

transport layer protocol link


physical
network

▪ network layer protocols trong mọi


network
link link
physical physical

Internet device: hosts, routers


network

▪ routers: link network


physical link
physical network
datacenter
• Kiểm tra các trường trong header
link
physical network

trong tất cả các IP datagram.


application
• Di chuyển datagrams từ input ports transport
network
enterprise
đến output ports để truyền network
link
physical

datagrams dọc theo đường end-end


Network Layer: 4-6
Hai chức năng chính của network-layer
network-layer functions: Tương tự: tham gia một
▪ forwarding: đưa gói từ link đầu chuyến đi
vào của router tới link đầu ra ▪ forwarding: Xử lý để đi qua một
tương ứng tới router kế tiếp. nút giao thông
▪ routing: quyết định tuyến ▪ routing: kế hoạch chuyến đi từ
đường gói sẽ đi từ source đến nguồn tới đích
destination
• routing algorithms

forwarding

Network Layer: 4-7


routing
Network layer: data plane, control plane
Data plane: Control plane
▪ local, chức năng tại router ▪ network-wide logic
▪ Quyết định phương thức ▪ Quyết định phương thức nào để
làm thế nào để datagram datagram được định tuyến dọc
nhận trên link đầu vào sẽ theo tuyến đường end-end từ
được đẩy ra đến router kế nguồn tới đích
tiếp ▪ Hai cách tiếp cận control-plane:
• traditional routing algorithms: thi
values in arriving hành tại router
packet header
• software-defined networking (SDN):
0111 1 thực thi tại server từ xa (bộ điều
3
2 phối)

Network Layer: 4-8


Per-router control plane
Thành phần của giải thuật định tuyến trong mỗi router và mọi
router tương tác với nhau trong control plane

Routing
Algorithm
control
plane

data
plane

values in arriving
packet header
0111 1
2
3

Network Layer: 4-9


Software-Defined Networking (SDN) control plane
controller từ xa tính toán, cài đặt forwarding tables trong các
router
Remote Controller

control
plane

data
plane

CA
CA CA CA CA
values in arriving
packet header

0111 1
2
3

Network Layer: 4-10


Network service model
Q: mô hình dịch vụ cho “channel” truyền datagrams từ người
gửi tới người nhận?
Ví dụ dịch vụ cho từng Ví dụ dịch vụ cho luồng
datagrams: datagrams:
▪ Phân phát đảm bảo ▪ Phân phát datagram theo thứ tự
▪ Đảm bảo độ trễ nhỏ hơn 40 ▪ Đảm bảo băng thông tối thiểu cho
msec luồng
▪ Hạn chế thay đổi khoảng cách
giữa các gói

Network Layer: 4-11


Network-layer service model
Quality of Service (QoS) có đảm bảo không?
Network Service
Architecture Model Bandwidth Loss Order Timing

Internet best effort none no no no

ATM Constant Bit Rate Constant rate yes yes yes


Internet “best effort”: Mô hình dịch vụ “nỗ lực tối đa”
ATM
NoAvailable
(khôngBitđảm Rate
bảo):Guaranteed min no yes no

Internet i. Phân
Intserv phát datagram
Guaranteed yes tới đích yes yes yes
ii. 1633
(RFC Thời) gian hoặc thứ tự
Internet Diffserv
iii. Băng 2475) sẵnpossible
(RFCthông có cho luồng end-end
possibly possibly no

Network Layer: 4-12


Network-layer service model
Quality of Service (QoS) Guarantees ?
Network Service
Architecture Model Bandwidth Loss Order Timing

Internet best effort none no no no

ATM Constant Bit Rate Constant rate yes yes yes

ATM Available Bit Rate Guaranteed min no yes no

Internet Intserv Guaranteed yes yes yes yes


(RFC 1633)

Internet Diffserv (RFC 2475) possible possibly possibly no

Network Layer: 4-13


best-effort service cho phép:
▪ Cơ chế đơn giản: Cho phép Internet triển khai mở rổng dễ dàng
▪ Cung cấp đủ băng thông: cho phép hiệu năng của các ứng dụng thời
gian thưc (interactive voice, video) có thể “đủ tốt” cho mọi thời gian.
▪ Nhân bản dịch vụ ứng dụng phân tán (datacenters, content distribution
networks) kết nối gần hơn với mạng của khách hàng, cung cấp dịch vụ
nhiều nơi.
▪ Kiểm soát tắc nghẽn mềm dẻo

It’s hard to argue with success of best-effort service model


Network Layer: 4-14
Network layer: “data plane” roadmap
▪ Network layer: overview
• data plane
• control plane
▪ Bên trong router
• input ports, switching, output ports
• buffer management, scheduling
▪ IP: the Internet Protocol
• datagram format ▪ Generalized Forwarding, SDN
• addressing • Match+action
• network address translation • OpenFlow: match+action in action
• IPv6 ▪ Middleboxes
Network Layer: 4-15
Tổng quan kiến trúc Router
routing, management
control plane (software)
Xử lý theo khung thời gian
routing tính bằng
processor

forwarding data plane


(hardware)
Xử lý theo khung thời
gian tính bằng
high-speed nanosecond
switching
fabric

router input ports router output ports

Network Layer: 4-16


Chức năng của Input port
lookup,
link
layer forwarding
line switch
termination protocol fabric
(receive)
queueing

physical layer:
bit-level reception
Chuyển mạch phi tập trung:
link layer:
e.g., Ethernet ▪ Dùng giá trị trong các trường của header, tìm output port
dùng forwarding table trong bộ nhớ của cổng input port
(chapter 6)
“match plus action”
▪ Mục tiêu: hoàn thành xử lý ở tại ‘line speed’
▪ input port queuing: nếu datagrams đến nhanh hơn tốc độ
forwarding vào switch fabric Network Layer: 4-17
Chức năng Input port
lookup,
link
layer forwarding
line switch
termination protocol fabric
(receive)
queueing

physical layer:
bit-level reception
Chuyển mạch phi tạp trung:
link layer:
e.g., Ethernet ▪ Dùng giá trị trong các trường của header, tìm output port
dùng forwarding table trong bộ nhớ của cổng input port
(chapter 6)
“match plus action”
▪ destination-based forwarding: chuyển tới đich dựa vào IP
đích (truyển thống)
▪ generalized forwarding: chuyển dựa vào bất kì tập giá trị của
Network Layer: 4-18
Destination-based forwarding

Q: điều gì xẩy ra nếu các dải phân chia không “đẹp”?


Network Layer: 4-19
Khớp số bit prefix dài nhất (Longest prefix matching)
longest prefix match
Khi tra cứu trong forwarding table cho địa chỉ đích, sử
dụng so khớp số bít dài nhất của prefix.

Destination Address Range Link interface

11001000 00010111 00010*** ******** 0

11001000 00010111 00011000 ******** 1

11001000 00010111 00011*** ******** 2

otherwise 3

11001000 00010111 00010110 10100001 which interface?


examples:
11001000 00010111 00011000 10101010 which interface?
Network Layer: 4-20
Longest prefix matching
longest prefix match
when looking for forwarding table entry for given
destination address, use longest address prefix that
matches destination address.

Destination Address Range Link interface

11001000 00010111 00010*** ******** 0

11001000 00010111 00011000 ******** 1

11001000 match!
00010111 00011*** ******** 2

otherwise 3

11001000 00010111 00010110 10100001 which interface?


examples:
11001000 00010111 00011000 10101010 which interface?
Network Layer: 4-21
Longest prefix matching
longest prefix match
when looking for forwarding table entry for given
destination address, use longest address prefix that
matches destination address.

Destination Address Range Link interface

11001000 00010111 00010*** ******** 0

11001000 00010111 00011000 ******** 1

11001000 00010111 00011*** ******** 2

otherwise 3
match!
11001000 00010111 00010110 10100001 which interface?
examples:
11001000 00010111 00011000 10101010 which interface?
Network Layer: 4-22
Longest prefix matching
longest prefix match
when looking for forwarding table entry for given
destination address, use longest address prefix that
matches destination address.

Destination Address Range Link interface

11001000 00010111 00010*** ******** 0

11001000 00010111 00011000 ******** 1

11001000 00010111 00011*** ******** 2

otherwise 3
match!
11001000 00010111 00010110 10100001 which interface?
examples:
11001000 00010111 00011000 10101010 which interface?
Network Layer: 4-23
Longest prefix matching
▪ Chúng ta sẽ nghiên cứu chi tiết trong phần địa chỉ
▪ longest prefix matching: thường được thực thi sử dụng bộ
nhớ TCAM (ternary content addressable memories)
(TCAMs)
• content addressable: đặt địa chỉ trong TCAM: truy xuất địa chỉ
trong 1 chu kì đồng hồ bất kể kích thứơc của bảng
• Cisco Catalyst: ~1tỉ entry tuyến đường (routing table) trong TCAM

Network Layer: 4-24


Switching fabrics
▪ Truyền gói từ input link đến output link tương ứng
▪ switching rate: tốc độ khi gói được truyền từ đầu vào tới đầu ra
▪ Thường được đo bằng bội số tốc độ line đầu vào/ra
• N đầu vào: switching rate N lần tốc độ line rate

R (rate: NR, R
ideally)

...
...

N input ports high-speed N output ports


switching
fabric

R R

Network Layer: 4-25


Switching fabrics
▪ Truyền gói từ input link đến output link tương ứng
▪ switching rate: tốc độ khi gói được truyền từ đầu vào tới đầu ra
▪ Thường được đo bằng bội số tốc độ line đầu vào/ra
• N đầu vào: switching rate N lần tốc độ line rate

▪ Ba kiểu switching fabrics:

memory

memory bus interconnection


network
Network Layer: 4-26
Switching theo kiểu memory
Router thế hệ đầu tiên:
▪ Máy tính truyền thống với chuyển mạch được điều khiển trực tiếp của
CPU
▪ Gói được copy tới bộ nhớ hệ thống
▪ Tốc độ bị giới hạn bởi memory bandwidth (2 bus crossings per datagram)
input output
port memory port
(e.g., (e.g.,
Ethernet) Ethernet)

system bus

Network Layer: 4-27


Switching theo kiểu bus
▪datagram từ bộ nhớ của input port tới bộ nhớ của output
port memory theo đường bus chia sẻ
▪bus contention: tốc độ chuyển mạch bị giới hạn bởi bus
bandwidth
▪32 Gbps bus, Cisco 5600: tốc độ thỏa mãn cho router truy
cập

Network Layer: 4-28


Switching theo kiểu interconnection network
▪ Crossbar, Clos networks, other
interconnection nets để kết nối các
bộ vi xử lý trong nhiều bộ vi xử lý

▪ multistage switch: nxn switch từ nhiều 3x3 crossbar


trạng thái của smaller switches
▪ Xử lý song song:
• Chia nhỏ datagram thành các cell có kích
thước cố định
• Chuyển mạch các cell vào fabric, đóng gói lại
datagram tại đầu ra 8x8 multistage switch
built from smaller-sized switches
Network Layer: 4-29
Switching theo kiểu interconnection network
▪ scaling, sử dụng nhiều switching “planes” song song:
▪ speedup, scaleup theo kiểu song song

▪ Cisco CRS router:


fabric plane 0
▪ basic unit: 8 fabric plane 1

. . .. . .
. . .. . .
fabric plane 2
switching planes fabric plane 3

. . .. . .
. . .. . .
fabric plane 4
▪ Mỗi plane: 3-stage fabric plane 5

. . .. . .
. . .. . .
fabric plane 6
interconnection fabric plane 7
network

. . .. . .
. . .. . .
▪ Lên tới 100’s Tbps
switching capacity

Network Layer: 4-30


Input port queuing
▪ Nếu switch fabric chậm hơn các input ports -> queueing có thể xẩy ra
tại đầu vào = input queues
• queueing delay and loss phụ thuộc vào bộ đệm đầu vào!
▪ Head-of-the-Line (HOL) blocking: datagram trong hàng đợi phía
trước chặn các datagram khác trong hàng đợi di chuyển phía trước

switch switch
fabric fabric

Tranh chấp ở đầu ra: chỉ có một Một thời gian sau: gói xanh lá
datagram màu đỏ được truyền, cây sẽ trải qua HOL
datagram màu đỏ còn lại bị khóa
Network Layer: 4-31
Output port queuing
datagram This is a really important slide
switch buffer link
layer line
fabric termination
protocol
(rate: NR) queueing (send) R

▪ Buffering được dùng khi datagrams đến


từ fabric nhanh hơn tốc độ truyền của Datagrams có thể mất
link. Chính sách drop: datagrams to drop nếu tắc nghẽn, thiếu
if no free buffers?
dung lượng bộ đệm
▪ Chính sách lập lịch Scheduling Lập lịch ưu tiên– ai có thể
chọn datagram trong hàng đợi phải ưu tiên nhất
để truyền
Network Layer: 4-32
Output port queuing

switch
switch
fabric
fabric

at t, packets more one packet time later


from input to output

▪ buffering khi tốc độ đến theo switch vượt quá tốc độ link đầu ra
▪ queueing (delay) and loss phụ thuộc vào bộ đệm cổng ra!

Network Layer: 4-33


Bộ đệm bao nhiêu?
▪ RFC 3439 đưa ra luật: bộ đệm trung bình = RTT đặc biệt ( 250 msec)
nhân với khả năng của link C
• e.g., C = 10 Gbps link suy ra bộ đệm =0.25*10= 2.5 Gbit buffer
▪ Đề xuất: với N luồng, bộ đệm
RTT . C
N
▪ Nhưng quá nhiều bộ đệm có thể tăng độ trễ
• long RTTs: hiệu năng nghèo nàn cho các ứng dụng thời gian thực, phản
hồi TCP chậm chạp
• Nhớ lại kiểm soát tắc nghẽn dựa vào độ trễ: “giữ link đủ bận rộn nhưng
không quá đầy”
Network Layer: 4-34
Quản lý bộ đệm
buffer management:
switch
datagram
buffer link
▪ drop: gói nào thêm, vứt khi
fabric layer line R bộ đệm đầy
protocol termination
queueing (send) • Vứt đuôi: vứt các gói đang
scheduling đến
• Ưu tiên: vứt/gỡ bỏ dựa vào
mức độ ưu tiên.

Abstraction: queue ▪ Đánh dấu: gói được đánh


dấu thông báo có tắc nghẽn
R packet
departures
(ECN, RED)
packet
arrivals queue link
(waiting area) (server)

Network Layer: 4-35


Packet Scheduling: FCFS
packet scheduling: quyết định FCFS: gói truyền theo thứ tự
gói nào được gửi tiếp theo trên đến output port
link
▪ Giống như: First-in-first-out
• first come, first served
• priority (FIFO)
• round robin ▪ Lấy ví dụ trong cuộc sống?
• Trọng số công bằng

Abstraction: queue
R packet
departures
packet
arrivals queue link
(waiting area) (server)

Network Layer: 4-36


Scheduling policies: ưu tiên
Priority scheduling: high priority queue

▪ Lưu lượng đến được phân


arrivals

lớp, đợi theo lớp classify link departures

• Bất cứ trường nào trong low priority queue


header dùng để phân lớp 2
▪ Gửi gói trong hàng đợi có arrivals
1 3 4 5

độ ưu tiên cao hơn. packet


• FCFS trong phạm vi các gói in
service
1 3 2 4 5

có độ ưu tiên departures
1 3 2 4 5

Network Layer: 4-37


Scheduling policies: round robin
Round Robin (RR) scheduling:
▪ Lưu lượng đến được phân
lớp, đợi theo lớp
• Bất cứ trường nào trong
header dùng để phân lớp
R
▪Phục vụ theo chu kì, lặp đi
lặp lại quét lớp hàng đợi classify link departures
arrivals
gửi một gói của lớp đi sau
đó lặp lại

Network Layer: 4-38


Scheduling policies: trọng số (Weighted Fair
Queuing)
Weighted Fair Queuing (WFQ):
▪ Tạo ra Round Robin
▪ Mỗi lớp, i, có trọng số wi, và w1
tổng trọng số mỗi chu kì:
w2 R
wi
classify link departures
Sjwj arrivals w3

▪ Tối thiểu băng thông được


đảm bảo(per-traffic-class)
Network Layer: 4-39
Sidebar: Mạng trung lập (Network Neutrality)
Cái gì là Network Neutrality
▪ technical: ISP nên chia sẻ/ định vị tài nguyên như thế nào?
• packet scheduling, buffer management are the mechanisms
▪ Nguyên lý kinh tế, xã hội
• Bảo vệ quyền tự do
• Khuyến khích cải tiến và cạnh tranh
▪ Thực hiện luật và chính sách

Các quốc gia khác nha có network neutrality khác nhau


Network Layer: 4-40
Sidebar: Network Neutrality
2015 US FCC Order on Protecting and Promoting an Open Internet: three
“clear, bright line” rules:
▪no blocking … “shall not block lawful content, applications, services,
or non-harmful devices, subject to reasonable network management.”
▪no throttling … “shall not impair or degrade lawful Internet traffic
on the basis of Internet content, application, or service, or use of a
non-harmful device, subject to reasonable network management.”
▪no paid prioritization. … “shall not engage in paid prioritization”
Các quốc gia đang đưa ra các chính sách về mạng đặc biệt mạng xã hội?
Network Layer: 4-41
Network layer: “data plane” roadmap
▪ Network layer: overview
• data plane
• control plane
▪ What’s inside a router
• input ports, switching, output ports
• buffer management, scheduling
▪ IP: the Internet Protocol ▪ Generalized Forwarding, SDN
• datagram format • match+action
• addressing • OpenFlow: match+action in action
• network address translation ▪ Middleboxes
• IPv6
Network Layer: 4-43
Network Layer: Internet
Chức năng của host, router network layer:

transport layer: TCP, UDP

IP protocol
Path-selection
• datagram format
algorithms: • addressing
network implemented in • packet handling conventions
• routing protocols forwarding
layer (OSPF, BGP) table ICMP protocol
• SDN controller • error reporting
• router “signaling”

link layer

physical layer

Network Layer: 4-44


Định dạng của IP Datagram
32 bits
IP protocol version number type of total datagram
ver head. length length (bytes)
header length(bytes) len service
fragment fragmentation/
“type” of service: 16-bit identifier flgs
▪ diffserv (0:5) offset reassembly
time to upper header
▪ ECN (6:7) header checksum
live layer checksum
TTL: remaining max hops source IP address 32-bit source IP address
(decremented at each router)
Maximum length: 64K bytes
destination IP address 32-bit destination IP address
upper layer protocol (e.g., TCP or UDP) Typically: 1500 bytes or less
options (if any) e.g., timestamp, record
overhead route taken
▪ 20 bytes of TCP payload data
▪ 20 bytes of IP (variable length,
▪ = 40 bytes + app typically a TCP
layer overhead for or UDP segment)
TCP+IP
Network Layer: 4-45
IP addressing (địa chỉ IP): giới thiệu
223.1.1.1

▪ IP address: 32-bit định danh host 223.1.2.1


hoặc router interface 223.1.1.2
223.1.1.4 223.1.2.9
▪ interface: kết nối giữa
host/router và physical link 223.1.1.3
223.1.3.27

• Router có nhiều interface 223.1.2.2

• host thường chỉ có 1 hoặc 2


interfaces (có dây, không dây) 223.1.3.1 223.1.3.2

(e.g., wired Ethernet, wireless 802.11)

dotted-decimal IP address notation:


223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 1 1
Network Layer: 4-46
IP addressing: introduction
223.1.1.1

▪ IP address: 32-bit định danh host 223.1.2.1


hoặc router interface 223.1.1.2
223.1.1.4 223.1.2.9
▪ interface: kết nối giữa
host/router và physical link 223.1.1.3
223.1.3.27

• Router có nhiều interface 223.1.2.2

• host thường chỉ có 1 hoặc 2


interfaces (có dây, không dây) 223.1.3.1 223.1.3.2

(e.g., wired Ethernet, wireless 802.11)

dotted-decimal IP address notation:


223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 1 1
Network Layer: 4-47
IP addressing: giới thiệu
223.1.1.1

Q: interface thực sự 223.1.2.1


kết nối như thế 223.1.1.2
nào? A: một kết nối có
223.1.1.4 223.1.2.9

dây kết nối interface


A: Chương 6, 7 Ethernet với 223.1.1.3
223.1.3.27
223.1.2.2
interface Ethernet
trên switch

223.1.3.1 223.1.3.2
For now: don’t need to worry
about how one interface is
connected to another (with no
intervening router) A: Interface không dây kết nối với
trạm thu phát song Wifi

Network Layer: 4-48


Subnets (mạng con)
223.1.1.1

▪ Mạng con là cái gì 223.1.2.1

• Các interface có thể kết nối vật 223.1.1.2


223.1.1.4 223.1.2.9
lý với nhau mà không cần có sự
can thiệp của router? 223.1.1.3
223.1.3.27
223.1.2.2

▪ Địa chỉ IP có cấu trúc:


• Phần mạng con: các thiết bị cùng 223.1.3.1 223.1.3.2

subnet có số bit trọng số cao (bit


phía bên trái) giống nhau network consisting of 3 subnets
• Phần trạm (phần host): phần bit còn
lại
Network Layer: 4-49
Subnets subnet 223.1.1.0/24
223.1.1.1 subnet 223.1.2.0/24

Công thức xác định subnets: 223.1.2.1

▪Mỗi interface của router là 223.1.1.2


223.1.1.4 223.1.2.9

một hòn đảo độc lập – mạng


độc lập 223.1.1.3
223.1.3.27
223.1.2.2

▪Mỗi mạng độc lập được gọi là


subnet
subnet 223.1.3.0/24 223.1.3.1 223.1.3.2

subnet mask: /24


(high-order 24 bits: subnet part of IP address)

Network Layer: 4-50


Subnets 223.1.1.2

subnet 223.1.1/24
223.1.1.1
▪ Có Các mạng 223.1.1.4

con? 223.1.1.3

▪ Mạng con /24 223.1.9.2 223.1.7.0


là gì subnet 223.1.9/24
subnet 223.1.7/24

223.1.9.1 223.1.7.1
223.1.8.1 223.1.8.0

subnet 223.1.2/24 223.1.2.6 subnet 223.1.8/24 223.1.3.27


subnet 223.1.3/24
223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2

Network Layer: 4-51


IP addressing: CIDR
CIDR: Classless InterDomain Routing (phát âm là “cider”)
• Phần mạng con có độ dài tùy ý
• Định dạng địa chỉ: a.b.c.d/x, x là số bit trong phần mạng con
của địa chỉ
subnet host
part part
11001000 00010111 00010000 00000000
200.23.16.0/23

Network Layer: 4-52


IP addresses: lấy địa chỉ bằng cách nào
Có hai câu hỏi thực sự:
1. Q: 1 host lấy địa chỉ trong mạng của nó như thế nào? (phần host)
2. Q: một mạng lấy địa chỉ mạng cho nó bằng cách nào(network
part)

Host lấy địa chỉ IP như thế nào?


▪ Được mã hóa cứng trong file config (e.g., /etc/rc.config in UNIX)
▪ DHCP: Dynamic Host Configuration Protocol: tự động lấy địa chỉ từ
server
• “plug-and-play”
Network Layer: 4-53
DHCP: Dynamic Host Configuration Protocol
Mục tiêu: host tự động lấy địa chỉ IP từ máy chủ mạng khi nó tham gia
vào mạng
▪ Có thể thuê mới địa chỉ trong quá trình dùng
▪ Cho phép sử dụng lại địa chỉ (chỉ giữ địa chỉ khi kết nối)
▪ Hỗ trợ người dùng di động trên các mạng khác nhau

DHCP tổng quan: quá trình DORA


▪ host broadcasts DHCP discover msg [optional]
▪ DHCP server responds with DHCP offer msg [optional]
▪ host requests IP address: DHCP request msg
▪ DHCP server sends address: DHCP ack msg
Network Layer: 4-54
DHCP mô hình client-server
Thông thường, DHCP server sẽ kết
DHCP server hợp với router để cung cấp địa chỉ
223.1.1.1
223.1.2.1
cho toàn bộ các mạng kết nối tới
router (thậm chí router đóng vai trò
223.1.2.5 là dhcp server)
223.1.1.2
223.1.1.4 223.1.2.9

223.1.1.3
223.1.3.27 arriving DHCP client needs
223.1.2.2 address in this network

223.1.3.1 223.1.3.2

Network Layer: 4-55


DHCP client-server scenario
DHCP server: 223.1.2.5 DHCP discover Arriving client
src : 0.0.0.0, 68
Broadcast: is there a
dest.: 255.255.255.255,67
DHCPyiaddr:
server 0.0.0.0
out there?
transaction ID: 654

DHCP offer
src: 223.1.2.5, 67
Broadcast: I’m a DHCP
dest: 255.255.255.255, 68
server!
yiaddrr:Here’s an IP
223.1.2.4
address youID:can
transaction 654 use
Hai bước ở trên có thể bị
lifetime: 3600 secs
DHCP request bỏ qua nếu client sử dụng
src: 0.0.0.0, 68 lại địa chỉ trước đó [RFC
2131]
Broadcast: OK. I would
dest:: 255.255.255.255, 67
yiaddrr: 223.1.2.4
like totransaction
use this ID:IP655
address!
lifetime: 3600 secs

DHCP ACK
src: 223.1.2.5, 67
Broadcast: OK. You’ve
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
got that IPID:
transaction address!
655
lifetime: 3600 secs
Network Layer: 4-56
DHCP: cung cấp nhiều thông tin hơn bên cạnh địa
chỉ
DHCP có thể cấp phát nhiều thông tin hơn bên cạnh địa chỉ:
▪ Địa chỉ gateway
▪ Tên và địa chỉ DNS server
▪ Mặt nạ mạng (xác định phần mạng trong địa chỉ)

Network Layer: 4-57


DHCP: example
DHCP DHCP ▪ Labtop kết nối sẽ dùng DHCP để
DHCP UDP
DHCP IP
lấy địa chỉ IP, gateway, mặt nạ
DHCP Eth mạng, địa chỉ của DNS server.
Phy
▪ Thông điệp DHCP REQUEST được đóng
DHCP

gói trong UDP, đóng gói trong IP, đóng


DHCP DHCP 168.1.1.1 gói trong Ethernet
DHCP UDP
IP
▪ Frame quảng bá Ethernet (dest:
DHCP

DHCP Eth
Phy Router có chức năng của FFFFFFFFFFFF) được nhận tại router
DHCP

▪ Ethernet bóc tách thông tin đến DHCP

Network Layer: 4-58


DHCP: example
DHCP DHCP ▪ DCP server tạo thông điệp DHCP ACK
DHCP UDP chứa địa chỉ IP, gateway, mặt nạ, địa
DHCP IP chỉ DNS server sẽ cấp cho client
DHCP Eth
Phy

▪ Gửi tới client, bóc tách thông tin


DHCP DHCP
DHCP UDP
DHCP IP
DHCP Eth router with DHCP
DHCP
Phy server built into ▪ Client bây giờ sẽ có IP, gateway, mặt
router nạ, địa chỉ DNS server

Network Layer: 4-59


IP addresses: lấy địa chỉ bằng cách nào
Q: lấy địa chỉ mạng như thế nào?
A: lấy từ không gian địa chỉ của ISP
ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20

ISP có thể chia nhỏ khối thành 8 khối:


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

Network Layer: 4-60


Phân cấp địa chỉ: tổng hợp tuyến đường
Phân cấp địa chỉ cho phép quảng bá thông tin định tuyến hiệu
quả.
Organization 0
200.23.16.0/23
Organization 1
“Send me anything
200.23.18.0/23 with addresses
Organization 2 beginning
200.23.20.0/23 . Fly-By-Night-ISP 200.23.16.0/20”
.
. . Internet
.
Organization 7 .
200.23.30.0/23
“Send me anything
ISPs-R-Us
with addresses
beginning
199.31.0.0/16”

Network Layer: 4-61


Hierarchical addressing: tuyến đường cụ thể
▪ Organization 1 di chuyển từ Fly-By-Night-ISP to ISPs-R-Us
▪ ISPs-R-Us quảng bá tuyến đường cụ thể Organization 1
Organization 0
200.23.16.0/23
Organization 1
“Send me anything
200.23.18.0/23 with addresses
Organization 2 beginning
200.23.20.0/23 . Fly-By-Night-ISP 200.23.16.0/20”
.
. . Internet
.
Organization 7 .
200.23.30.0/23
“Send me anything
ISPs-R-Us
with addresses
Organization 1 beginning
199.31.0.0/16”
200.23.18.0/23 “or 200.23.18.0/23”

Network Layer: 4-62


Hierarchical addressing: more specific routes
▪ Organization 1 di chuyển từ Fly-By-Night-ISP to ISPs-R-Us
▪ ISPs-R-Us quảng bá tuyến đường cụ thể Organization 1

Organization 0
200.23.16.0/23

“Send me anything
with addresses
Organization 2 beginning
200.23.20.0/23 . Fly-By-Night-ISP 200.23.16.0/20”
.
. . Internet
.
Organization 7 .
200.23.30.0/23
“Send me anything
ISPs-R-Us
with addresses
Organization 1 beginning
199.31.0.0/16”
200.23.18.0/23 “or 200.23.18.0/23”

Network Layer: 4-63


IP addressing: last words ...
Q: ISP lấy khối địa chỉ từ đâu? Q: 32-bit IP addresses có đủ
A: ICANN: Internet Corporation for không?
Assigned Names and Numbers ▪ ICANN cấp phát chunk cuối
http://www.icann.org/ cùng của IPv4 addresses đến
• Cấp phát địa chỉ thông qua 5 RRs in 2011
regional registries (RRs) (5 tổ chức ▪ NAT (next) giúp giải quyết vấn
này sau đó sẽ cấp phát tới các ISP local)
đề cạn kiệt IPv4
• Quản lý DNS root zone, bao gồm
cả quản lý TLD (.com, .edu , …) ▪ IPv6 có 128-bit
“Ai mà biết được chúng ta cần bao nhiêu
địa chỉ?" Vint Cerf (reflecting on decision
to make IPv4 address 32 bits long)

Network Layer: 4-64


Network layer: “data plane” roadmap
▪ Network layer: overview
• data plane
• control plane
▪ What’s inside a router
• input ports, switching, output ports
• buffer management, scheduling
▪ IP: the Internet Protocol ▪ Generalized Forwarding, SDN
• datagram format • match+action
• addressing • OpenFlow: match+action in action
• network address translation ▪ Middleboxes
• IPv6
Network Layer: 4-65
NAT: network address translation
NAT: các thiết bị trong mạng cục bộ chia sẻ một địa chỉ IPv4 khi
đi ra Internet
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

Tất cả các datagramsdời mạng cục bộ với datagrams với nguồn hoặc đích trong
cùng địa chỉ IP nguồn đã được NAT. : mạng này có địa chỉ trong mạng 10.0.0/24
138.76.29.7, nhưng khác địa chỉ cổng
nguồn Network Layer: 4-66
NAT: network address translation
▪ Tất cả các thiết bị trong mạng cục bộ có địa chỉ 32-bit trong không
gian địa chỉ riêng tư (10/8, 172.16/12, 192.168/16 prefixes) chỉ
dùng cục bộ
▪ Ưu điểm:
▪ Chỉ cần 1 địa chỉ từ ISP cho tất cả các thiết bị
▪ Có thể thay đổi địa chỉ của host trong mạng cục bộ không cần
thông tin với thế giới bên ngoài
▪ Có thể thay đổi ISP mà không cần thay đổi địa chỉ các thiết bị
trong mạng
▪ Bảo mật: thiết bị bên trong mạng cục bộ không được xác định
trực tiếp, không hiển thị với thế giới bên ngoài.

Network Layer: 4-67


NAT: network address translation
triển khai: NAT phải trong suốt:
▪ Datagrams đi ra ngoài: thay thế (IP nguồn, cổng #) của mọi datagram
sang (địa chỉ IP được NAT, cổng mới #)
• clients/servers từ xa sẽ phản hồi lại dùng địa chỉ IP đã NAT và địa
chỉ cổng mới như địa chỉ đích
▪ Nhớ (trong bảng NAT translation table) mọi cặp (source IP address,
port #) được NAT (NAT IP address, new port #)
▪ Datagrams đi vào mạng: thay thế (NAT IP address, new port #) trong
địa chỉ đích của mọi datagram đến với (source IP address, port #) lưu
trong bảng NAT table
Network Layer: 4-68
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

Network Layer: 4-69


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

Network Layer: 4-70


IPv6: dịch chuyển sang IPv6
▪ Động lực: không gian 32-bit IPv4 cạn kiệt
▪ additional motivation:
• Tốc độ xử lý/forwarding: 40-byte fixed length header
• Cho phép xử lý các luồng ở tầng mạng khác nhau

Network Layer: 4-71


IPv6 datagram format
flow label: identify
priority: identify
32 bits datagrams in same
priority among ver pri flow label "flow.” (concept of
datagrams in flow
payload len next hdr hop limit “flow” not well defined).
source address
128-bit (128 bits)
IPv6 addresses destination address
(128 bits)

payload (data)

So với IPv4:
▪ no checksum (tăng tốc độ tại router)
▪ no fragmentation/reassembly
▪ no options (Tầng trên sẽ có trường này nếu cần thiết)
Network Layer: 4-72
Từ IPv4 đến IPv6
▪ Không phải tất cả các router được nâng cấp đồng thời
• no “flag days”
• Mạng sẽ xử lý việc tồn tại cả IPv4 và IPv6 như thế nào
▪ Tunneling (đường hầm): IPv6 datagram được coi như payload trong
IPv4 datagram tại các router IPv4 (“packet within a packet”)
• Đường hầm được định nghĩa trong các kiểu mạng khác (4G/5G)

IPv4 header fields IPv6 header fields


IPv4 payload
IPv4 source, dest addr IPv6 source dest addr
UDP/TCP payload

IPv6 datagram
IPv4 datagram
Network Layer: 4-73
Đường hầm và đóng gói (Tunneling and
encapsulation
A B Ethernet connects two E F
Ethernet connecting IPv6 routers
two IPv6 routers: IPv6 IPv6 IPv6 IPv6

IPv6 datagram
Link-layer frame The usual: datagram as payload in link-layer frame

IPv4 network A B E F
connecting two
IPv6 routers IPv6 IPv6/v4 IPv6/v4 IPv6

IPv4 network

Network Layer: 4-74


Tunneling and encapsulation
A B Ethernet connects two E F
Ethernet connecting IPv6 routers
two IPv6 routers: IPv6 IPv6 IPv6 IPv6

IPv6 datagram
Link-layer frame The usual: datagram as payload in link-layer frame

IPv4 tunnel A B IPv4 tunnel E F


connecting IPv6 routers
connecting two
IPv6 routers IPv6 IPv6/v4 IPv6/v4 IPv6

IPv6 datagram
IPv4 datagram tunneling: IPv6 datagram as payload in a IPv4 datagram
Network Layer: 4-75
Tunneling
A B IPv4 tunnel E F
connecting IPv6 routers
logical view:
IPv6 IPv6/v4 IPv6/v4 IPv6

A B C D E F
physical view:
IPv6 IPv6/v4 IPv4 IPv4 IPv6/v4 IPv6

flow: X src:B src:B src:B flow: X


src: A dest: E dest: E src: A
dest: F
dest: E
dest: F
Flow: X Flow: X Flow: X
Src: A Src: A Src: A
Chú ý địa chỉ data Dest: F Dest: F Dest: F data
nguồn và địa chỉ
đích! data data data

A-to-B: E-to-F:
B-to-C: B-to-C: B-to-C:
IPv6 IPv6
IPv6 inside IPv6 inside IPv6 inside
IPv4 IPv4 IPv4
Network Layer: 4-76
IPv6: triển khai
▪ Google1: ~ 30% dịch vụ khách hàng là IPv6
▪ NIST: 1/3 domain của chính phủ Mỹ là có khả năng IPv6

https://www.google.com/intl
/en/ipv6/statistics.html
Network Layer: 4-77
IPv6: triển khai
▪ Google1: ~ 30% dịch vụ khách hàng là IPv6
▪ NIST: 1/3 domain của chính phủ Mỹ là có khả năng IPv6
▪ Thời gian rất dài để triển khai
• 25 năm và hơn nữa!
• Trong 25 có thể các dịch vụ tầng ứng dụng sẽ thay đổi rất nhiều:
WWW, social media, streaming media, gaming, telepresence, …
• Thực sự việc thay đổi giao thức tầng mạng là một câu chuyện
quá khó …
• Why?

1 https://www.google.com/intl/en/ipv6/statistics.html
Network Layer: 4-78
Network layer: “data plane” roadmap
▪ Network layer: overview
• data plane
• control plane
▪ What’s inside a router
• input ports, switching, output ports
• buffer management, scheduling
▪ IP: the Internet Protocol
• datagram format ▪ Generalized Forwarding, SDN
• addressing • Match+action
• network address translation • OpenFlow: match+action in action
• IPv6 ▪ Middleboxes
Network Layer: 4-79
Generalized forwarding (chuyển tiếp tập chung):
match plus action
Review: mỗi router có một bảng forwarding table (aka: flow table)
▪ “match plus action” : khớp bit trong gói tin đến, có hành động tương ứng
• destination-based
values in arriving
forwarding: chuyển đi dựa vào địa chỉ IP đích
packet header
0111 1

• generalized forwarding: 3
2

• Nhiều trường header có thể quyết định hành động


• Các hành động có thể: drop/copy/modify/log packet

forwarding table
(aka: flow table)

Network Layer: 4-80


Flow table
▪ flow: được định nghĩa với giá trị của trường header tại nhiều tầng(in
link-, network-, transport-layer fields)
▪ generalized forwarding: luật đơn giản rules
• match: so khớp giá trị trong các trường của header
• actions: sau khi đã khớp: vứt bỏ, chuyển đi, chỉnh sửa các gói đã khớp hoặc gửi
gói đã khớp tới controller
• priority: phân biệt các mẫu bị chồng chéo
• counters: số byte (#bytes) và số gói (#packets)

Flow table Router’s flow table define


match action router’s match+action rules

Network Layer: 4-81


Flow table abstraction
▪ flow: được định nghĩa với giá trị của trường header (in link-, network-,
transport-layer fields)
▪ generalized forwarding: luật đơn giản rules
• match: so khớp giá trị trong các trường của header
• actions: sau khi đã khớp: vứt bỏ, chuyển đi, chỉnh sửa các gói đã khớp hoặc
gửi gói đã khớp tới controller
• priority: phân biệt các mẫu bị chồng chéo
• counters: số byte (#bytes) và số gói (#packets)

Flow table src = *.*.*.*, dest=3.4.*.* forward(2)


match action src=1.2.*.*, dest=*.*.*.* drop
src=10.1.2.3, dest=*.*.*.* send to controller
* : wildcard
1 4
3
2 Network Layer: 4-82
OpenFlow: các flow table
Match Action Stats

Packet + byte counters


1. Forward packet to port(s)
2. Drop packet
3. Modify fields in header(s)
4. Encapsulate and forward to controller

Header fields to match:


Ingress Src Dst Eth VLAN VLAN IP IP TCP/UDP TCP/UDP
IP Src IP Dst Src Port Dst Port
Port MAC MAC Type ID Pri Proto ToS

Link layer Network layer Transport layer


Network Layer: 4-83
OpenFlow: ví dụ
Gửi dựa trên địa chỉ đích:
Switch MAC MAC Eth VLAN VLAN IP IP IP IP TCP TCP
Port src dst type ID Pri Src Dst Prot ToS s-port d-port Action
* * * * * * * 51.6.0.8 * * * * port6
IP datagrams dành cho dích 51.6.0.8 nên hướng ra cổng router là 6

Firewall:
Switch MAC MAC Eth VLAN VLAN IP IP IP IP TCP TCP
Port src dst type ID Pri Src Dst Prot ToS s-port d-port Action
* * * * * * * * * * * 22 drop
Chặn (không forward) tất cả datagrams trên cổng TCP port 22 (ssh port #)

Switch MAC MAC Eth VLAN VLAN IP IP IP IP TCP TCP


Port src dst type ID Pri Src Dst Prot ToS s-port d-port Action
* * * * * * 128.119.1.1 * * * * * drop
Chặn (do not forward) all datagrams gửi bởi host 128.119.1.1
Network Layer: 4-84
OpenFlow: ví dụ
Chuyển tiếp dựa vào địa chỉ tầng 2:
Switch MAC MAC Eth VLAN VLAN IP IP IP IP TCP TCP
Port src dst type ID Pri Src Dst Prot ToS s-port d-port Action
22:A7:23:
* * 11:E1:02 * * * * * * * * * port3

layer 2 frames với MAC dích là 22:A7:23:11:E1:02 hướng ra ngoài cổng 3

Network Layer: 4-85


OpenFlow abstraction
▪ match+action: thống nhất các loại thiết bị

Router Firewall
• match: so khớp số bit • match: so khớp địa chỉ IP và
dài nhất trong IP prefix địa chỉ cổng
• action: forward out a • action: permit or deny
link
Switch NAT
• match: so khớp MAC • match: địac chỉ IP và địa chỉ
đích cổng
• action: forward or flood • action: thay đổi địa chỉ IP
và địa chỉ cổng
Network Layer: 4-86
OpenFlow example
Host h6 Các bảng được tổ chức tốt có
10.3.0.6
1 s3 controller
thể tạo hành vi cho một mạng
2
4
rộng lớn e.g.,:
3
Host h5
▪ datagrams từ host h5 và h6
10.3.0.5 nên gửi tới h3 hoặc h4, theo
s2 và từ đó tới s2
1 s1 1 s2
Host h1 2 Host h4
10.1.0.1 4 2 4
10.2.0.4
3 3

Host h3
Host h2
10.2.0.3
10.1.0.2

Network Layer: 4-87


OpenFlow example
match action
IP Src = 10.3.*.*
forward(3)
Host h6 Các bảng được tổ chức tốt có
10.3.0.6
IP Dst = 10.2.*.*
1 s3 controller
thể tạo hành vi cho một mạng
2
4
rộng lớn e.g.,:
3
Host h5
▪ datagrams từ host h5 và h6
10.3.0.5 nên gửi tới h3 hoặc h4, theo
s2 và từ đó tới s2
1 s1 1 s2
Host h1 2 Host h4
10.1.0.1 4 2 4
10.2.0.4
3 3

match match action


action Host h3
Host h2 ingress port = 2
ingress port = 1 10.1.0.2
10.2.0.3 forward(3)
IP Src = 10.3.*.* forward(4) IP Dst = 10.2.0.3
IP Dst = 10.2.*.* ingress port = 2
forward(4)
IP Dst = 10.2.0.4
Network Layer: 4-88
Generalized forwarding: tóm tắt
▪ “match plus action” abstraction: khớp các bit trong gói tin đến tại bất cứ
tầng nào và hành động
• So khớp nhiều trường của các tầng khác nhau (link-, network-,
transport-layer)
• local actions: drop, forward, modify, hoặc gửi gói tin so khớp tới
controller
• Chương trình hành vi cho toàn mạng
▪ Mạng có thể lập trình
• Có thể lập trình, xử lý trên gói
• historical roots: active networking
• today: lập trình được phổ biến có thể xem trong https://p4.org/

Network Layer: 4-89


Network layer: “data plane” roadmap

▪ Network layer: overview


▪ What’s inside a router
▪ IP: the Internet Protocol
▪ Generalized Forwarding
▪ Middleboxes
• middlebox functions
• evolution, architectural principles of
the Internet

Network Layer: 4-90


Middleboxes
Middlebox (RFC 3234)

“bất kì box trung gian có chức năng khác ngoài các


chức năng được tiêu chuẩn của router IP trên
đường đi của dữ liệu từ nguồn tới đích”
Middleboxes ở mọi nơi!
Firewalls, IDS: corporate,
institutional, service providers,
national or global ISP ISPs
NAT: home,
cellular,
institutional
Load balancers:
corporate, service
provider, data center,
mobile nets
Application-
specific: service datacenter
network

providers,
institutional, Caches: service
CDN enterprise
provider, mobile, CDNs
network
Middleboxes
▪ Ban đầu: là các giải pháp phần cứng độc quyền
▪ Chuyển sang phần cứng “whitebox” thực thi các open API
▪ Thoát khỏi các giải pháp phần cứng độc quyền
▪ Hành động cục bộ có thể lập trình được bằng cách match+action
▪ Hướng tới sự cải tiến/khác biệt trong phần mềm
▪ SDN: (logically) kiểm soát tập trung và quản lý cấu hình trong
private/public cloud
▪ network functions virtualization (NFV): Các dịch vụ và chức năng
mạng có thể lập trình được
The IP hourglass (đồng hồ cát)

HTTP SMTP RTP …


QUIC DASH
Internet’s “thin waist”: Trong khi các
▪ Chỉ một giao thức TCP UDP
tầng mạng: IP
tầng khác có
▪ Phải thực thi hàng IP nhiều giao thức
tỉ(billions) kết nối giữa tại tầng dịch vụ,
Ethernet PPP …
các thiết bị trên PDCP WiFi Bluetooth tầng vận chuyển,
Internet tầng link, tầng
copper radio fiber
vật lý
The IP hourglass, at middle age

HTTP SMTP RTP …


QUIC DASH
Internet’s middle age TCP UDP
“love handles”? caching
▪ Có nhiều hơn IP
middlebox xử lý trong Firewalls
Ethernet PPP …
tầng mạng PDCP WiFi Bluetooth

copper radio fiber


Architectural Principles of the Internet
RFC 1958
“Many members of the Internet community would argue that there is no architecture, but only a tradition,
which was not written down for the first 25 years (or at least not by the IAB). However, in very general terms,
the community believes that the goal is connectivity, the tool is the Internet
Protocol, and the intelligence is end to end rather than hidden in the
network.”

Ba quan điểm nền tảng:


▪ Kết nối đơn giản
▪ IP protocol: điểm mấu chốt ở giữa
▪ Thông minh, phưc tạp để tại biên của mạng
Tranh luận end-end
▪ Một số chức năng của mạng ví dụ truyền tin cậy, xử lý tắc nghẽn có
thể thực thi tại trong mạng hoặc biên mạng

application end-end implementation of reliable data transfer application


transport transport
network network
data link data link
physical physical

application
application
transport
transport
network hop-by-hop (in-network) implementation of reliable data transfer network
data link
data link
physical network
physical
network network network network network link
link link link link link physical
physical physical physical physical physical
Tranh luận end-end
▪ Một số chức năng của mạng ví dụ truyền tin cậy, xử lý tắc nghẽn có
thể thực thi tại trong mạng hoặc biên mạng

“The function in question can completely and correctly be implemented only


with the knowledge and help of the application standing at the end points of the
communication system. Therefore, providing that questioned function as a
feature of the communication system itself is not possible. (Sometimes an
incomplete version of the function provided by the communication system may
be useful as a performance enhancement.)

We call this line of reasoning against low-level function implementation the “end-
to-end argument.”
Saltzer, Reed, Clark 1981
Thông minh ở đâu?

20th century phone net: Internet (pre-2005) Internet (post-2005)


• intelligence/computing at • intelligence, computing at • programmable network devices
network switches edge • intelligence, computing, massive
application-level infrastructure at edge
Chapter 4: Xong!
▪ Network layer: overview
▪ What’s inside a router
▪ IP: the Internet Protocol
▪ Generalized Forwarding, SDN
▪ Middleboxes

Question: how are forwarding tables (destination-based forwarding)


or flow tables (generalized forwarding) computed?
Answer: by the control plane (next chapter)
Additional Chapter 4 slides

Network Layer: 4-101


Phân mảnh IP /ráp lại (fragmentation/reassembly)
▪ network links có MTU (max
transfer size) – lớn hơn khả năng
fragmentation:


link-level frame in: one large datagram
• link khác nhau, MTU khác nhau out: 3 smaller datagrams

▪ IP datagram lớn bị chia nhỏ


(“fragmented”) trong phạm vi
reassembly
mạng
• 1 datagram thành nhiều several
datagrams


• “reassembled” chỉ tại đích
• Các bit trong IP header dùng định
danh các mảnh theo thứ tự

Network Layer: 4-102


IP fragmentation/reassembly
example: length ID fragflag offset
=4000 =x =0 =0
▪ 4000 byte datagram
▪ MTU = 1500 bytes one large datagram becomes
several smaller datagrams

1480 bytes in length ID fragflag offset


data field =1500 =x =1 =0

offset = length ID fragflag offset


1480/8 =1500 =x =1 =185

length ID fragflag offset


=1040 =x =0 =370

Network Layer: 4-103


DHCP: Wireshark output (home LAN)
Message type: Boot Request (1)
Hardware type: Ethernet Message type: Boot Reply (2)
Hardware address length: 6 Hardware type: Ethernet
Hops: 0 request Hardware address length: 6
Hops: 0
reply
Transaction ID: 0x6b3a11b7
Seconds elapsed: 0 Transaction ID: 0x6b3a11b7
Bootp flags: 0x0000 (Unicast) Seconds elapsed: 0
Client IP address: 0.0.0.0 (0.0.0.0) Bootp flags: 0x0000 (Unicast)
Your (client) IP address: 0.0.0.0 (0.0.0.0) Client IP address: 192.168.1.101 (192.168.1.101)
Next server IP address: 0.0.0.0 (0.0.0.0) Your (client) IP address: 0.0.0.0 (0.0.0.0)
Relay agent IP address: 0.0.0.0 (0.0.0.0) Next server IP address: 192.168.1.1 (192.168.1.1)
Client MAC address: Wistron_23:68:8a (00:16:d3:23:68:8a) Relay agent IP address: 0.0.0.0 (0.0.0.0)
Server host name not given Client MAC address: Wistron_23:68:8a (00:16:d3:23:68:8a)
Boot file name not given Server host name not given
Magic cookie: (OK) Boot file name not given
Option: (t=53,l=1) DHCP Message Type = DHCP Request Magic cookie: (OK)
Option: (61) Client identifier Option: (t=53,l=1) DHCP Message Type = DHCP ACK
Length: 7; Value: 010016D323688A; Option: (t=54,l=4) Server Identifier = 192.168.1.1
Hardware type: Ethernet Option: (t=1,l=4) Subnet Mask = 255.255.255.0
Client MAC address: Wistron_23:68:8a (00:16:d3:23:68:8a) Option: (t=3,l=4) Router = 192.168.1.1
Option: (t=50,l=4) Requested IP Address = 192.168.1.101 Option: (6) Domain Name Server
Option: (t=12,l=5) Host Name = "nomad" Length: 12; Value: 445747E2445749F244574092;
Option: (55) Parameter Request List IP Address: 68.87.71.226;
Length: 11; Value: 010F03062C2E2F1F21F92B IP Address: 68.87.73.242;
1 = Subnet Mask; 15 = Domain Name IP Address: 68.87.64.146
3 = Router; 6 = Domain Name Server Option: (t=15,l=20) Domain Name = "hsd1.ma.comcast.net."
44 = NetBIOS over TCP/IP Name Server
……
Network Layer: 4-104

You might also like