網路通訊

xiru2ly3rd88
6 min readApr 29, 2022
  • control plane vs data plane:
    control plane: how data are forwarded, create routing table
    data(forwarding) plane: actually forwards the data

SDN/NFV :

  • Software-Defined Network(SDN):將路由器的control plane從data plane中分離,改以軟體方式實作,集中化管理分散在各個網路裝置上的control plane, 不更動硬體裝置的前提下,用軟體重新規劃網路
  • Network Functions Virtualization(NFV): 將實體設備的網路功能,以軟體的型態呈現,例如路由器(Router)、防火牆(Firewall)、負載平衡器(Load Balancer)與用戶終端設備(CPE)等

— — — — — — — — — — — — — -

Devices 透過wired or wireless傳送訊息, 資料

Wired

Wired communication:

ex: telephone networks, cable television or internet access, and fiber-optic communication, ethernet cable.

Wireless

Wireless communication:

Technologies: Radio ware, blue-booth, Wi-Fi, cellular, GPS, RF, microwave

VoWiFi(voice over Wi-Fi)/Wi-Fi calling

手機網路較差的地方(ex: 偏遠地區), 可利用連接Wi-Fi再進行通話

語言傳輸有2種: CS vs PS

  1. Circuit switching: 事先規劃path, 保留頻寬, 品質較好
  2. Packet switching: 不會規劃path, 不保留頻寬, 頻寬使用率較好

2G/3G 用CS

4G 用PS

scenario:
沒有VOLTE: 手機用4G上網 -> 打電話掉回3G
有VOLTE: 手機用4G上網 -> 打電話VOLTE, 跑在4G

過去架構:

IP Network, PSTN無法互通, 發展出IP Multimedia Subsystem(IMS)

PDN = IP network ??
  • IMS + VoWiFi:

Architecture:

Implement:

802.11

  • 802.11k: Radio Resource Measurement, 提供找到最好的AP的信息
    設備. 訊號最好的AP_1滿載, 訊號稍弱的AP_2沒人用 -> 換到AP_2
  • 802.11v: Wireless Network Management, 允許終端設備交換網絡拓撲的信息,包括射頻環境

包含2功能:
1. Network assisted Power Savings: 睡眠時間更長, 每隔一段時間跟AP通訊確保沒有斷開

2. Network assisted Roaming: 允許WLAN發訊息給終端, 終端可連接更好的AP

  • 802.11r: Fast Basic Service Set Transition or fast roaming, 減少AP接換時間

ref: 802.11 k/v/r

802.11ac: 發展自802.11n, 稱Wi-Fi 5

  1. 擴展綁定的頻道: 強制支援至80MHz頻寬, 160MHz 可選
  2. 更多的MIMO空間串流
    2.1 8個MIMO空間串流
    2.2 Multi-user MIMO
  3. 調變(Modulation: 256-QAM, rate 3/4 與 5/6, 可作為選項

Wi-Fi security:

Socket programming

OSI 7 layers

影片說明

分層, 每層做好自己的事, 很好的理論, 但實作上不用它(old protocol沒有follow?, 太多層實作複雜?)

  1. 實體層(Physical Layer): 定義出在終端和網絡之間要使用的設備, 如何將硬體所攜載的信號轉換成電腦可以理解的電子信號( 0 和 1 ), 比如﹕數據線的接腳﹑電壓﹑波長﹑相位… 設備: 網線﹑網路卡﹑電話線, modem…

2. 資料連接層(Data Link Layer): 指定了要採用的信息單元 (message unit﹐通常在 LAN上面的信息單元被稱為 frame)

功能:

  • 網路卡的實體位址(Physical Address)﹐也被稱為MAC(Media Access Control) Address
  • 虛擬電路(Virtual Circuit)連接和邏輯連結(Logical Link)的建立和結束
  • 控制框包的傳送和錯誤檢測方式
  • 框包的傳送及接收順序和傳遞方式
  • 判定框包的建立及重組分界
  • 檢測框包的確認﹐以及在得不到回應或重複發送的情形下進行修復的程序
  • 處理實體層的轉換和管理
  • 對接收框包進行檢錯和確認
  • 檢查發送框包的實體位址以確保資料能正確的被送抵目的地之網路層

IEEE802 再分成Media Access Control 和 Logical Link Control

Note: 802/803.x, 保證一個無錯誤的物理上的數據傳輸

3. 網路層(Network Layer): 定義封包在網路中移動的路由和處理過程

功能:

  • 如果封包不是屬於同一個網路的時候﹐會將之交由 router 處理
  • 控制數據流量﹐當 router 的緩衝區飽和的時候﹐會通知數據傳輸設備使用其它路徑或暫停發送封包
  • 當封包體積超過 router 的 MTU (Maximum Transmission Unit) 數值的時候﹐允許 router 對封包進行重組後再進行傳送。(一些所謂的增加 modem上網速度的軟體﹐就是因為可以對電腦的 MTU 數值進行最佳化﹐儘量減少 router 的封包重組﹐以達到最高的數據傳輸效率。)
  • 負責 MAC 位址和網路位址(如 IP 位址﹑IPX 位址)之間的解釋和轉換

4. 傳送層(Transport Layer): 控制節點之間的資料傳遞﹐還有錯誤檢測和修正的方法

功能:

  • 接管由上層協定傳來的資料﹐並進行“分拆”和“打包”等工作。
  • 利用點對點的方式進行資料傳送和回應的確認。
  • 在得到接收端之資料緩衝區飽和信息之後﹐暫時停止資料發送。
  • 能在單一位址上處理不同的程式協定(如ftp﹑http﹑telnet等)﹐並分別進行追蹤及轉換。

5. 會談層(Session Layer): 定義了連接和掛斷連接﹐建立和管理電腦與電腦之間的溝通模式﹐也就是在資料真正進行傳送之前設定並建立好連線。這裡定義了連線的請求和結束﹑傳送和接收狀態的設定﹑等等動作。

功能:

  • 允許程式以電腦名稱註冊成為網路上唯一的位址。
  • 在電腦之間建立﹑監測﹑和結束虛擬電路(Virtual Circuit)。
  • 負責電腦之間的信息同步﹐監測資料溝通狀態﹐並對錯誤信息做出處理。

6. 表現層(Presentation Layer): 定義數據的語法(syntax)﹑變更﹑和格式。當應用程式的語法和格式都不同的時候﹐這層還將定義了如何翻譯這些不同。

功能:

  • 字元碼轉換﹐例如﹕ASCII 碼和 EDCDIC 碼之間的轉換。
  • 資料形態轉換﹐例如﹕CR 碼和 CR-LF 碼﹑整數和浮點數之間的轉換。
  • 對資料進行壓縮和加密﹐以提高速度和增加安全性

7. 應用層(Application Layer): 將傳入來的資料種類轉換成 PC 的資料種類, presentation layer是針對特定的主機的 CPU 類型﹐而application layer則針對特定application。
ex: FTP﹐HTTP﹐TELNET, 在TCP/IP中不同的app用不同的port, ex:HTTP 使用 80﹑FTP使用 21

app與 socket 作溝通,一個 socket 就是一個羅輯位址和 port 了

ref:

https://www.pcnet.idv.tw/pcnet/network/network_ip_model.htm

TCP/IP

影片說明, 接近OSI 7 layers, 實作會用TCP/IP

4 layers update to 5 layers
OSI 7 layers vs TCP/IP 5 layers

ref:

https://www.techtarget.com/searchnetworking/definition/TCP-IP

compatible with all operating systems (OSes)

  1. Transmission Control Protocol
  2. Internet Protocol

生活化例子-訂便當

訂便當的網路分層
  • HTTP: 用來訂便當
  1. 標準化要求_內容格式: 分為header(4個動作), body
    a. GET 取得訂單資訊
    b. POST 訂便當
    c. DELETE 取消訂單
    d. PUT 修改訂單
  2. 標準化結果_狀態碼:
回傳_狀態表
訂便當過程

加入其他生活化例子

對應TCP/IP 4 layers

https://hulitw.medium.com/learning-tcp-ip-http-via-sending-letter-5d3299203660

Function:

  1. broken into packets
  2. addressed
  3. transmitted
  4. route
  5. receive
  • TCP vs UDP:

透過IP + port形成socket

UDP: half-duplex

TCP: full-duplex

TCP: reliable, slow

Flow:

  1. Establish connection: three-way handshake

Flow: A send SYN -> B reply ACK+SYN -> A reply ACK

three-way handshake

2. Send packets of data

A send data with sequence no. -> B reply with ACK no.

data transmit

sequence/ACK no. 用來處理data lost, duplicate

  • Handle data lost:

A send pkt -> set the timer, put the pkt into retransmit queue
-> if timer run out & does not receive the ACK, A send pkt again

This mechanism may send the duplicate pkt(slow arrive or ACK), the receiver(B) can discard the duplicate pkt

  • Handle out of order packets:
out of order packets

可能原因:

Receiver can use the sequence no. to reassemble the pkts.

  • Flow control: sliding window
  1. receiver advertise the window size 6(可以送6 bytes pkts)
  2. pkt 13~15 已經送了, 等待ACK
  3. pkt 16~18 還沒送, 可以馬上送
  4. sender rx ACK of pkt 13~15, window left end往右縮 -> receiver advertise more window size, window 往右滑

ref:

https://www.thegeekstuff.com/2013/10/tcp-sliding-window/

3. Close the connection

A,B 都可以colse the connection

ref:

UDP: unreliable, fast

用在real time, 要即時得到資料(ex: 球賽轉播)

No error/flow control, depend on IP and ICMP reporting

ref:

https://www.geeksforgeeks.org/user-datagram-protocol-udp/

IP:

compatible with all types of computer hardware and networks

  1. address
  2. route
  • 4 layer:
  1. application: standardized data exchange
    ex: HTTP, FTP, SMTP…
  2. transport: end-to-end communication
    ex: TCP, UDP
  3. network: deals with packets and connects independent networks to transport the packets across network boundaries
    ex: IP, ICMP
  4. physical: operate only on a link
    ex: ARP
  • TCP/IP vs OSI:
  1. TCP/IP is a protocol-oriented standard, whereas OSI is a generic model based on the functionalities of each layer.

2. In TCP/IP, the protocols were developed first, and then the model was developed. In OSI, the model was developed first, and then the protocols in each layer were developed.

3. TCP/IP helps establish a connection between different types of computers, whereas OSI helps standardize routers, switches, motherboards and other hardware.

NAT (network address translation)

  1. 解決IPv4 address數量不夠的問題(inside: private IP ; outside: public IP, inside hosts用同一組public IP)
  2. security

method:

  1. static translation
  2. dynamic translation
    ex: 1.1.1.1 ~ 1.1.1.2 pre-len 24 bit
  3. PAT (port address translation)
    加上src/des port(1~65535)

4. inside destination translation:
inside 作load balance

  • GNSS (Global Navigation Satellite System), ex: GPS…
  • C-V2X (Cellular Vehicle to Everything)

--

--

xiru2ly3rd88
0 Followers

學習筆記不保證100%正確, 只是用來快速複習; 聯絡信箱: xiru2ly3rd88@gmail.com