# Layer 4 and Data Plane
###### tags: `Comoputer Internet - 7e`
## 一 . Overview of layer4
### (一) . Layer4的功能
1. Layer 4 的設計功能 :
- **forwarding** : refers to the router-local action of transferring a packet from an input link interface to the appropriate output link interfac
- **routering** : refers to the network-wide process that determines the end-to-end paths that packets take from source to destinatio
- 分別 : R1送到相連的router為forwarding,封包由R1到R2路徑,為routering。

2. Layer 4的子層 :
- data plane : 根據『forwarding table』,控制『轉發』的動作,主要為硬體的工作。
- control plane : 根據一些接收到的資訊,計算出forwarding table,主要為軟體,決定生成『forwarding table』。

3. SDN網路架構 :
- 傳統網路 : control plane和data plane在同一個機器上,且多半只提供遠端設計的介面。
- SDN : 將control和data plane抽離,可以遠端傳送,並控制control plane的應用。

### (二) . Network Service Model
1. Network Service Model : 代表單一網路商,在他們的network內可以提供的服務。
2. 常見的Network Service Model :
- Guaranteed delivery 。
- Guaranteed delivery with bounded delay。
- In-order packet delivery。
- Guaranteed minimal bandwidth。
- Security : 路由器可以過濾封包。
3. Internet的Service Modal : best-effort
## 二 . Router Structure
### (一) . Basic

1. 組成元件 :
- $Input\ interface$ : 輸入的硬體介面。
- $Output\ interface$ : 輸出的硬體介面。
- $Switch\ fabric$ : 硬體構造,會遵守forwarding table的規則輸出封包。
- $Routing\ process$ : control plane的軟體。
1. 計算出forwaring table(傳統網路),
2. SDN controller溝通。
2. forwarding的方法 :
- forwarding : 路由器接收到的封包,會根據上面的目的ip去送到應該要送到的router。
- forwaring table : 而這些傳送的依據,就是forwarding table。
- longest prefix matching rule : 路由器之間管理的是網域之間的傳送,所以會依據最長的網域id。

3. forwarding 的分類 :
- Destination-based forwarding : 依照目的位址進行輸送。
- Generalized forwarding : 不依照目的位址進行輸送。
### (二) . Switch
1. Via memory : 跟傳統電腦的I/O方法是一樣的。
- input interface經由『interrupt』告訴router preocessor有datagram傳入。
- router precessor將datagram複製到memory中。
- router計算memory的目的ip決定傳送封包的output interface。
- router precessor將datagram再複製到output。
- router用此方法 : 可以在頻寬B下,可以傳輸B/2的封包(因為需要讀和寫)。

2. Via bus : 用匯排流工作。
-