Internetworking

Download Report

Transcript Internetworking

網路連結
Internetworking
1
2
Connecting Devices
Connecting
Devices
Networking
Devices
Repeaters
Hubs
Bridges
Switches
Internetworking
Devices
Routers
Gateways
3
Repeater
• Repeater amplifies the signal.
• At the physical layer
1
2
3
4
5
6
weak signal
1
2
3
4
5
6
strong signal
4
Hub
• Deploy as star topology
• Emulate the bus topology (broadcast)
• Work as an repeater
Hub
4
1
2
3
5
Collision
• Collision in bus
topology
• Degradation of
performance
Host A
Host B
A sends a frame.
Host A
Host B
B sends a frame.
Host A
Host B
Collision occurs.
Host A
Host B
B finds collision.
A finds collision.
6
Bridge
• Bridges operate at the first two layers
of the OSI model.
1
2
3
8
5
4
6
7
6
1
8
3
7
2
segment
4
5
7
Switch
• Stations send frames directly to the switch.
• At the first two layers
1
7
6
2
5
3
4
8
Routers in an Internet
• Routers operate at the first three layers
of the OSI model.
9
Gateway
• Traditionally, a gateway is a connecting
device that acts as a protocol converter.
– Understand two protocols
– Translate from one to another
• Today, the term gateway is used
interchangeably with the term router.
IP Network
Telecommuni
cation
Network
gateway
10
Connecting Devices and the OSI
Model
switch
Hub
11
Hubs
… physical-layer (“dumb”) repeaters:
– bits coming in one link go out all other links at
same rate
– all nodes connected to hub can collide with one
another
– no frame buffering
– no CSMA/CD at hub: host NICs detect
collisions
twisted pair
hub
12
Switch
• link-layer device: smarter than hubs, take
active role
– store, forward Ethernet frames
– examine incoming frame’s MAC address,
selectively forward frame to one-or-more
outgoing links when frame is to be forwarded on
segment, uses CSMA/CD to access segment
• transparent
– hosts are unaware of presence of switches
• plug-and-play, self-learning
– switches do not need to be configured
13
Switch: allows multiple simultaneous
transmissions
A
• hosts have dedicated, direct
connection to switch
• switches buffer packets
• Ethernet protocol used on
each incoming link, but no
collisions; full duplex
– each link is its own collision
domain
• switching: A-to-A’ and Bto-B’ simultaneously,
without collisions
– not possible with dumb hub
C’
B
6
1
5
2
3
4
C
B’
A’
switch with six interfaces
(1,2,3,4,5,6)
14
Switch Table
A
• Q: how does switch know
C’
that A’ reachable via interface
4, B’ reachable via interface 5?
• A: each switch has a switch
table, each entry:
– (MAC address of host,
interface to reach host, time
stamp)
• looks like a routing table!
• Q: how are entries created,
maintained in switch table?
– something like a routing
B
6
1
5
2
3
4
C
B’
A’
switch with six interfaces
(1,2,3,4,5,6)
15
Switch: self-learning
A A A’
• switch learns which
hosts can be reached
through which interfaces
– when frame received,
switch “learns” location
of sender: incoming LAN
segment
– records sender/location
pair in switch table
MAC addr
A
C’
Source: A
Dest: A’
B
1
6
5
2
3
4
C
B’
A’
interface TTL
1
60
Switch table
(initially empty)
16
Switch: frame filtering/forwarding
When frame received:
1. record link associated with sending host
2. index switch table using MAC dest address
3. if entry found for destination
then {
if dest on segment from which frame arrived
then drop the frame
else forward the frame on interface indicated
forward on all but the interface
}
on which the frame arrived
else flood
17
Self-learning,
forwarding:
example
Source: A
Dest: A’
A A A’
C’
• frame destination
unknown:flood
• destination A
location known:
selective send
B
A6A’
1
2
4
5
C
A’ A
B’
3
A’
MAC addr interface TTL
A
A’
1
4
60
60
Switch table
(initially empty)
18
Interconnecting switches
• switches can be connected together
S4
S1
S2
A
B
S3
C
F
D
E
I
G
H
• Q: sending from A to F - how does S1 know to
forward frame destined to F via S4 and S3?
• A: self learning! (works exactly the same as in
single-switch case!)
19
Self-learning multi-switch example
Suppose C sends frame to I, I responds to C
S4
1
S1
S2
A
B
C
2
S3
F
D
E
I
G
H
• Q: show switch tables and packet forwarding in S1,
S2, S3, S4
20
Institutional network
to external
network
mail server
router
web server
IP subnet
21
Switches vs. Routers
• both store-and-forward devices
– routers: network layer devices (examine network layer
headers)
– switches are link layer devices
• routers maintain routing tables, implement routing
algorithms
• switches maintain switch tables, implement filtering,
learning algorithms
22
Summary comparison
hubs
routers
switches
traffic
isolation
no
yes
yes
plug & play
yes
no
yes
optimal
routing
cut
through
no
yes
no
yes
no
yes
23
網路連結
• 將網路 LAN 相連接的方法:
–
–
–
–
直接連結
與 WAN 連結
透過 WAN 連結
連結成階層式架構
24
直接連結
LAN 1
網路連
結設備
LAN 2
computer
25
與 WAN 連結
LAN 1
網路連
結設備
WAN 2
26
透過 WAN 連結
LAN 1
WAN 2
LAN 2
27
連結成階層式架構
WAN
WAN
WAN
28
透過骨幹網路(Backbone
Network)連結
WAN
WAN
LAN
LAN
Backbone
Network
LAN
LAN
LAN
29
網路連結設備
• 以黑盒子代表網路連結的設備。
• 網路連結的設備會影響連結網路的性質。
• 根據連結網路的特性可將設備分類為
–
–
–
–
–
數訊號加強器(Repeater)
橋接器(Bridge)
路由器(Router)
閘道器(Gateway)
其他常見的連結設備有數據機(Modem)、
30
集線器(Hub)、Ether 交換器(Ether Switch)
數據機(Modem)
• MOdulator(調變,數位→ 類比)and
DEModulator(解調變,類比→數位)
電話網路
PSTN
Central Office
ISP
數據機
Digital Signal
數位訊號
Analog Signal
類比訊號
Digital Signal
數位訊號
31
訊號加強器(Repeater)
• 連接 2 個完全相同的網路。
• 將收到的訊號放大、修正復原,再送出。
• 不對 Signal 做任何的處理。
10 Base2 Ethernet
Repeater
10 Base2
Ethernet
32
Repeater 通訊協定架構
Host A
Host B
Application
Presentation
Session
Application
Presentation
Session
Transport
Network
Data Link
Transport
Network
Data Link
Repeater Function
Physical
PHY
LAN 1
Physical
PHY
LAN 2
33
集線器(Hub)
• 用以連接多台電腦。
• 不對收到的資料做位址的檢查。
Hub
Hub
Hub
34
Hub 的運作
• Hub 採取 point-to-point 的設計,必須模
擬 CSMA/CD 在 Bus 的行為:
– Broadcast:Hub 將收到的 Signal 強制轉到其
他 Ports 送出。
也有 Repeater 的作用。
– Frame Collision:Hub 將同時收到 2 Signals
視為發生 Collision。
Hub Broadcast 給所有電腦一個 collision presence
signal。
35
Ether-Switch
• 改進 Hub 同一時間
只能傳送一個
Frame 的缺點。
• 檢查 Frame 上目的
地的 MAC address,
將 Frame 轉送到正
確的 port。
• 建立自動學習的位
址對照表。
Ethernet 1 Ethernet 2
A
C
B
D
port 1
port 2
port 3
port 4
E
G
F
H
Ethernet 3
EtherSwitch
Ethernet 4
36
Ether-Switch 的架構圖
位址對照表
host
port
A
B
C
D
E
F
G
H
1
1
2
2
3
3
4
4
交換
元件
Buffer
控制處
理機
Collision
Detection
port 1 port 2 port 3 port 4
A
C
E
G
B
D
F
H
37
Ether-Switch 的效能
• 最多可同時傳送 n/2 個 Signals
– n is the number of ports in the switch
• 有交換機目的地衝突的問題
– A wants to talk to C, however C is reading now
– Send a Collision Signal to A
38
Bridge
• 類似 Ether-switch 的功能
– 通常以硬體製作的設備稱為 Switch ,軟體
製作的設備稱為 Bridge。
• 結合實際傳輸線路不同(實體層、MAC
層不同,但LLC及以上要相同)的網路。
• “邏輯上”成為一個網路,但各個“實體”
子網路(subnet)則各自獨立運作。
– Users 感覺不到 Bridges 的存在。
39
Bridge的例子
• Subnet 1 、2 、3 擁有相同的 LLC
protocol(IEEE 802.2),MAC 層不同
Subnet 2
FDDI
10Base2
IEEE 802.3
FDDI
橋接器
Wireless LAN
IEEE 802.11
無線電收訊塔台
筆記型電腦
筆記型電腦
40
Bridge 的過濾(Filtering)
• Subnet 1 、2 、3 擁有相同的MAC
protocol(CDMA/CD),PHY 層不同
• A→B(In the same subnet 1)
A:
140.126.155.12
Subnet 2
10Base5
橋接器
Subnet 1
10Base2
集線器
C:
140.126.156.114
B:
140.126.155.14
Subnet 3
10BaseT
41
Bridge 的轉送(Forwarding)
• A (Subnet 1) →C(Subnet 2)
A:
140.126.155.12
Subnet 2
10Base5
橋接器
Subnet 1
10Base2
集線器
B:
140.126.155.14
Subnet 3
10BaseT
C:
140.126.156.114
42
Bridge 的運作
• Host X → Host Y
• 檢查 Destination Y MAC Address
– 在 DB 上:
同一 port:Filtering
不同 port:Forwarding to Y’s port
– 不在 DB 上:Forward to all other ports
• 檢查 Source MAC Address
– 在 DB 上:檢查 DB 是否正確需要修改
– 不在 DB 上:記錄新的資料
43
Bridge 的特性
• Bridge 會檢查 MAC address
– 有 Filtering(frame過濾)的功能。
– 若不在相同 Subnet 上,則做Forward (轉送)
的動作。
• 通常用 Bridges 連結的網路會形成 A
Spanning Tree,使 2 Hosts 間 Only One
Path:
– 不會有 Frame 重覆收到的問題。
– 簡化 Routing 的問題。
44
Bridge 通訊協定架構
Host A
Host B
Application
Presentation
Session
Application
Presentation
Session
Transport
Network
Data Link
Transport
Network
Data Link
Bridge Function
LLC
Physical
LAN 1
MAC
MAC
PHY
PHY
Physical
LAN 2
45
Bridge 的運作原理
高層軟體 (擴張樹維運軟體,橋接器管理軟體)
LLC
埠狀態
訊息
MAC 軟體 1
LLC
訊框轉送程式
MAC 軟體 2
訊框接收程式
網路界面 1
port 1
LAN 1
埠狀態
訊息
訊框傳送程式
過濾資料庫
網路界面 2
port 2
LAN 2
46
Bridge 的元件
• 過濾資料庫(Filtering Database)
– 存放各主機隸屬於那一個 port 的 Database。
• 轉送程式(Forwarding Process)
– 負責將收到且要轉送的 Frame 傳給適當的 port
– 查詢 Filtering Database,Bridge 才能判定要
Forwarding 或 Filtering。
• 學習程式(Learning Process)
– Bridge 自己學習建立 Filtering Database
– 檢查 Source MAC Address 修改過濾資料庫
47
路由器(Router)
• Router 用於連接 LLC 不同,但 Network
Layer 及上層都相同的網路。
• Internet 以 Routers 做為中繼站,穿越各
個網路轉送 Packet。
• 企業內部以 Routers 做為子網路交換
Packet 的中心。
48
路由器 R2 的路由資訊
49
Router R2 路由表
50
Routers 的運作
• 讀取收到的 Packet 上的 IP 位址,查詢路
由表(Routing Table),以得知應從那
一個 Port 將 Packet 送出
• Router 必須了解兩個協定的 PHY、Data
Link Layers,以便和兩個子網路溝通和
進行封包的轉換
– Ex:FDDI MTU=4500 bytes、Ethernet
MTU=1500 bytes
51
Dynamic Routing
• Router 會不斷學習改進其 Dynamic
Routing Table
• Router 之間使用 Routing Protocol 來交換
網路的資訊
– RIP(Routing Information Protocol)
– OSPF(Open Shortest Path First)
52
Router 通訊協定架構
Host A
Host B
Application
Presentation
Session
Application
Presentation
Session
Transport
Network
Data Link
Router Function
Transport
Network
Data Link
Network
Data LinkData Link
Physical
PHY
LAN 1
Physical
PHY
LAN 2
53
閘道器(Gateway)
• 連接型態完全不同的網路
– GPRS & Internet,CATV & Ethernet
• Gateway 必須完成通訊協定轉換的動作:
– Frame 格式的轉換
不同的 Frame 格式與最大長度限制 MTU。
– Address 的轉換
不同的網路使用不同的定址模式。
– Protocol 的轉換
控制 Frame 的轉換、流量控制、錯誤偵測及修正。
54
Gateway 通訊協定架構
Host A
Host B
Gateway Function
Application
Presentation
Session
Transport
Network
Data Link
Physical
LAN 1
AP
AP
Presentation Presentation
Session Session
Transport Transport
Network Network
Data LinkData Link
Physical Physical
Application
Presentation
Session
Transport
Network
Data Link
Physical
LAN 2
55
網路連結設備分類規則
連結設備
實體層
通訊協定
資料鏈結層
MAC
LLC
網路層
以上
Repeater
相同
相同
相同
相同
Bridge
不同
不同
相同
相同
Router
不同
不同
不同
相同
Gateway
不同
不同
不同
不同
56
網路連結設備功能
連結設備
實際網路個數
邏輯網路個數
Repeater
1
1
Bridge
N
1
Router
N
N
Gateway
N
N
57