---
robots: index, follow
tags: NCTU, CS, 共筆, 陳志成, 網路
description: 交大資工課程學習筆記
lang: zh-tw
dir: ltr
breaks: true
disqus: calee
GA: UA-100433652-1
---
無線網路 -- 陳志成
======
:::info
:mega: Feel free to edit / correct this page :tada:
:::
[TOC]
## Syllabus
- ~~除加簽者外,上課不點名~~
- 考試時間不調整,分數不調分
- 分數
1. 四次考試各佔 25%
- [HW1](https://hackmd.io/mZbgq6z2RLiD6xB4vUXNCA)
- [Exam1]()
- [HW2](https://hackmd.io/OU9dQriZR8mpTeLQteWzgQ)
- [Exam2]()
- [HW3]()
- [Exam3]()
- [HW4]()
- [Exam4]()
3. P + L
- 3 Lab: 30%
- Final Project: 70%
4. L + E
- 3 Lab: 30%
- Final Exam: 70%
- 參考書: [IP-Based Next-Generation Wireless Networks: Systems, Architectures, and Protocols](https://people.cs.nctu.edu.tw/~jcc/book.html)
## Outline
### 1G - 5G
- 1G
- Analog + Circuit-switched
- 2G
- 只能打語音,不能上網
- 3G
- IP-base
- packet-switched 出現
- 可以上 Internet
- 同時有 circuit 與 packet
- 傳 data
- 種類
- 3GPP
- 3GPP2
- 
- 4G
- Long Term Evolution (LTE)
- 傳 video

- 5G
- ?
- 1-4G 是 person 2 person(P2P)
- 希望有更多 device 2 device(D2D) 應用
- 低 delay, 高 bandwidth
- 手機在高速移動時的連線
- 軟體化、SDN、NFV
## Intro
### Background
- [參考 計網概--陳志成](https://hackmd.io/DapUVL6OR1uqlaJOAKI_qA)
- 分類(以覆蓋範圍來區分):
- WAN (Wide Area Networks)
- 覆蓋範圍大
- LAN (Local Area Networks)
- 覆蓋範圍小
- Switched Network
- circuit switching
- telephone network
- 尋找鏈路(連線)
- 要確定有 resource 才會連線
- Low channel utilization:
- 建立好連線後,只能有一個人用這個 channel
- 連線建好後,只會剩下 propagation delay (傳播延遲,物理層的 delay),不會有其他 delay
- 好處
- resource 都是你一個人用的,無 traffic,較穩定
- 壞處
- 使用率低(正常通話有 64% 是 idle)
- bursty traffic ([非連續的資料傳遞](http://sls.weco.net/blog/tzef/10-jan-2009/12441))
- 傳資料正常時都是 low usage,會有間斷的突然高峰
- packet switching
- 切小塊封裝 packet
- 多人共用連線
- same destination 不一定走 same route
- 不一定照順序收到,最後再組合回來就好
- 可能會掉包
- 重傳 (TCP) -- non-real time,穩定
- 算了 (UDP) -- real time,XNET
- packet
- header: 控制(要跳的資訊等等)
- payload: 資料
- 好處
- Greater efficiency for bursty traffic
- 可以確保 packet 都丟出去,但是這樣可能會有 delay
- 也可以選擇不要確保都收到 (UDP),就比較少 delay
- 可以有 priority (在Header設定)
### Evolution of Wireless Networks
- Wireless 種類
- 理論上傳得越遠,資料量會低
- Personal Area Networks (PANs)
- Wireless Local Area Networks (WLANs)
- Low-tier wireless systems
- High-tier wireless systems(要執照)
- Public wide-area (high-tier) cellular radio systems <- 這堂課主要要講的
- Mobile satellite systems(衛星電話)
- 
- IEEE 802.xx: 區域網路
- [PANs (Personal Area Networks)](https://www.rs-online.com/designspark/chi-blog-WPAN)
- Short-range low-power radios(短距離使用)
- ex. Bluetooth, ZigBee
- IEEE 802.15
- WLANs (Wireless Local Area Networks)
- 頻段可以自己改,但是沒有管制了話,容易跟別人衝到 (License)
- 有些頻段不需要
- ex. ISM -- USA
- ex. 2.4GHz, 5.7GHz -- TW (2.4GHz[微波爐], 5GHz)
- 以上兩個頻段在台灣不用申請執照也可以用
- IEEE 802.11: 最廣泛使用
- Architecture (兩種)
- Ad hoc (Independent network)
- 直連 (Direct communication)
- One BSS (basic service set)
- 802.11網路最基本的組件我們稱之為基本服務集(BSS)
- 軍事戰爭用
- 
- Infrastructure
- AP (access point) and stations
- Distribution System
- 802.11 收到無線網路資訊(Distribution System)
- 802.3 打進有線網路(Core network)
- multiple BSS connected together form an ESS (extended service set)
- 
- 重疊區:handoff / handover
- 低於 n% 時,開始搜尋其他基地台
- 低於 m% 時,轉到其他基地台
- n > 50 > m
- (if m == 50) -> 可能會不斷換基地台 (ping-pong效應)
- cellular network: 分散區的樣式
- 
- Wi-Fi (Wireless Fidelity) Certification
- Wi-Fi 只是經過 wifi 這個非營利組織**認證**過的 802.11 的產品
- Low-Tier Wireless Systems
- 設計給行人(有移動速度)
- 室外小於 500m,室內小於 30m
- 辦公室 or 住宅的無線通訊
- Cordless Telephone (無線的電話), Second Generation (CT2)
- UK 設計
- circuit-switch voice
- Digital European Cordless Telecommunications (DECT) <- 台灣使用
- EU 設計
- circuit-switch voice & data service
- 如果要佈給大眾,基地台需要佈建的比較密(Provide public services)
- Personal Access Communications Systems (PACS
- Telcordia (then, ++Bellcore++) 設計
- Personal Handyphone System (PHS) <- 台灣使用
- JP 設計
- voice + data service
- 384Kbps channel rate
- High-Tier Wireless Network
- 大範圍的 Provide public mobile services,可以支援步行 & 車輛速度
- 由以下兩點組成
- RAN(無線電接入網絡):為移動用戶提供接入核心網絡的無線電資源
- cell 的直徑可以超過 10 km
- Core Network: 讓 RAN 互連,以及連出到其他網路
- 1G - 5G
### Generation
#### 1G
- Analog radio(類比,較易衰減) + circuit-switched + networking technologies
- 三種標準
- Advanced Mobile Phone Systems (AMPS) <- 台灣使用
- 就算兩家公司都用AMPS,也不一定能互通(Core Network做得不好)
- Total Access Communications Services (TACS) <- 英國使用
- Nordic Mobile Telephone (NMT) <- 北歐使用
#### 2G
- Digital + circuit-switched
- Core network 出現標準了
- 除了 circuit-switched voice 之外,還啟用了第一批移動數據和移動互聯網服務
- GSM -- 歐洲 <- 台灣使用
- RAN (radio-access-network digital) + core network (circuit-switched)
- 900MHz, 1800MHz(Europe)
- 800MHz, 1900MHz(United States)
- 服務
- circuit-switched voice
- 9.6 Kbps circuit-switched symmetric channel as a data connection to access the Internet
- IS-136/IS-95 + IS-41 -- 北美
- RAN
- IS-136 (TDMA)
- IS-95 (CDMA)
- Core Network
- IS-41 (circuit-switched)
- support roaming(漫游)
- PDC (Personal Digital Cellular network) -- 日本
- TDMA(時間排程多工)
- CDMA([分碼多重進接](https://zh.wikipedia.org/wiki/%E5%88%86%E7%A2%BC%E5%A4%9A%E9%87%8D%E9%80%B2%E6%8E%A5) -- 編碼不同)
- power control很重要
- FDMA(頻率排程) -- [參考](https://hackmd.io/DapUVL6OR1uqlaJOAKI_qA#02phy)
- 以上分法主要目的:讓多人同時傳輸
#### 2.5G
- 手機支援連上 Internet 時,出現了 **GPRS** 的協定,將手機的 circuit-switched 轉換成一些 packet-switched
- EDGE: 同上
#### 3G
- **IP based** <- 最重要 (Evolutionary rather than revolutionary,演化而非革命)
- QoS (quality-of-service) -- [參考](http://blog.csdn.net/shuijingshizhe/article/details/53188300)
- 3G 有 circuit switch (voice),也有 packet switch (data)
- 3GPP (Third-Generation Partnership Project) <- 歐洲人成立
- 容納 GSM
- Wideband-CDMA (WCDMA) -- 為了避過 CDMA 的專利
- 3GPP2 (Third-Generation Partnership Project2) <- 北美人成立
- 容納 IS-41
- cdma2000
#### Summary
- 
- 
#### 3.5G
- 3GPP High-Speed Packet Access (HSPA)
- HSPA+
- MIMO
- 多個天線
- multipul input / multipul output
- 實際:不會直接加疊,會互相干擾
- 3GPP2 Evolution - Data Optimized (EV-DO)
- 美國
- eHRPD + EPC
#### 4G
- WiMAX -- 死
- LTE(Long Term Evolution)
- All IP
- LTE-A (LET-Advance)
#### 5G
- 5G, will be about intelligent networks that can handle ==billions of connected devices== while remaining stable and operational.
- SDN (Software Defined Networking) 軟體定義網路
- NFV (network function virtualization) 網路功能虛擬化
- 
- 5 Horizontal Topics:
- (D2D) Device-to-Device Communication
- (MMC) Massive Machine Communications (ex. IoT)
- (MN) Moving Networks (ex. 高鐵)
- (UDN) Ultra-dense Networks (超密集,訊號強,需減少干擾)
- (URC) Ultra-reliable Communications
#### 標準
- IMT(International Mobile Telecommunications): 統一制定標準的組織
- 符合 IMT 標準的,才可以叫 3G
- 第三代行動通訊技術,簡稱3G,規格名稱IMT-2000
- 不管如何實作
- 有些人說符合 IMT-Advance 的就可以叫 4G
- 100Mbps for high mobility
- 1Gbps for low mobility
- 3GPP (www.3gpp.org)
- R4, R5, R6, R7, R8
- 3GPP 這個組織一直在更新 spec
- 
- TSGs (Technical Specification Groups)
- RAN (Redio Access Network)
- SA (Service and ...)
- CT (Core Network & Terminals)
- GERAN (GSM - EDGE)
- Spec
- TS -- Technical Specifications
- TR -- Technical Report (只是 report,幫你了解 TS,主要還是要看 TS)
- Rn(R4, R5, ...): Release
- Freeze: 在這個時間後,不會再動 Spec
- 第一個
- 3G -- R4
- 4G -- R8
- Evolved Packet System (EPS)
- [參考](http://www.txrjy.com/thread-459496-1-1.html)
- SAE(System Architecture Evolution) (core network)
- packet-switched only
- AIPN:"all-IP" network (只有 packet switched)
- LTE (Long Term Evolution) (radio)
- 同時容納 3GPP2
- 5G Architecture -- R15
- Non-Standalone (NSA)
- Use **4G EPC** as the core network
- Standalone (SA)
- the first set of 5G standards
- Service Based Architecture (SBA)
- Multimedia Broadcast Multicast Service (MBMS)
- 3GPP 的 multicast 標準
- unicast:一對一傳播
- broadcast:一對多(所有人都收到)
- multicast:一對多(自己決定接收者)
- 3GPP2
- REV(=revolution)
- Rev 0, Rev A, Rev B, Rev C
- 然後死了 QQ
- [IETF](www.ietf.org/) (一個大型開放的國際社區)
- For Internet
- RFC(Request for Comments)有人提出的標準
- IP / TCP / UDP
## 2G
- 1G Core network 沒標準
- 2G Core network 出現標準

- 2G 架構
- PSTN (Public Switched Telephone Network 公用交換電話網路)
- 2G 的 core network
- circuit-switched
- SS#7: Signalling System No.7
- 有線網路
- circuit-switched 標準
- MAP (Mobile Application Part)
- wireless 部份的標準
- 以下是 MAP 的流程
- 
- HLR (Home Location Register,一個中心資料庫)
- 手機移動時只跟 HLR 報告
- VLR (Visitor location register,一個資料庫)
- 先透過 VLR 作溝通註冊,VLR 再去跟 HLR 報告
- 如果是去到不同電信業者的 BS 時,先跟不同電信的 VLR 註冊,再回到原來電信的 HLR
- or 台北的 VLR 再回到新竹的 HLR
- AuC(Authentication Centre):認證
- EIR:硬體序號 (IMEI) 註冊,分別不同 Device
- D/G/C/E/B/H/F/I/...: interface
- 
- BS
- Base Station
- 1 個 BSC 連到數個 BTS
- BSC: Base Station ==Controller==
- BTS: Base ==Transceiver== Station
- 
- MSC (Mobile Switching Center)
- 負責管 BS
- MSC 會連回 PSTN
- Handoff (換手)
- Mobile-controlled handoff (MCHO)
- 手機量訊號,自己決定要不要換訊號
- 手機沒有全盤資訊,不利於全盤規劃
- 手機只要自己 handle 自己的部分就好了
- DECT, PACS
- 優:對網路負擔輕
- 缺:對網路沒有全盤的了解,可能做錯決定令網路負擔變重 (ex. 這個基地台很 traffic 了)
- Network-controlled handoff (NCHO)
- 基地台量訊號決定手機要不要換訊號
- 基地台比較有全盤的視角
- 基地台需要定時測量每一台機器
- CT-2 Plus, AMPS
- 優:基地台對網路了解,容易決定
- 缺:基地台 loading 重
- Mobile-assisted handoff (MAHO)
- 手機量完訊號,回報給基地台,由基地台決定要不要 Handoff
- GSM, IS-95(CDMA)
- Handoff 種類
- Hard Handoff
- 把舊的基地台連線切掉,再連線到新的基地台 (Break-before-make)
- 優 : 系統設計較簡單
- 缺 : 可能會有空窗期
- Soft Handoff (Inter-cell)
- 先連到新的基地台,再切斷舊的基地台
- 優 : 連線不會斷
- 缺 : 系統設計較困難、同時連到多個網路會有干擾,網路端也會有問題產生(迴圈)
- CDMA 之後出來,可同時連上 7 台基地台
- 
- 下載 (Forward Link):
- SDU (Selection and Distribution Unit) 把資料都丟下去,手機利用 L1 的方式,把資料 conbine 起來
- [我猜] SDU 會 copy 兩份資料兩邊都丟一樣的(因為是由手機測訊號,所以 SDU 不會知道哪邊的訊號比較好丟那個 link),手機在過度帶(將要做 handoff)所以也不知道哪邊的訊號會比較強,就直接把兩個訊號加疊起來,得到的最終訊號大概就是對的了
- 上傳 (Reverse Link):
- 手機上到 SDU,SDU 用 L2 方式(RLP)把資料 conbine 起來
- [我猜] 因為手機知道哪個訊號比較好,手機可以總是丟訊號比較好的地方,那可是手機會移動,SDU不知道這時候是從哪個 link 上來,所以用 header 排出 packet order
- 
- RLP (Radio Link Protocol)
- 第二層
- Soft Handoff(Inter-sector)
- Soft-Softer
- Roaming (漫遊)
- 功能:換 Domain
- Home Domain
- Visit Domain
- 
- 
- 
- Roaming Broker: 跟我簽約的人,就可以跟**全世界**跟我簽約的人互通
### ---------------2020第一次考試分隔線---------------
## 3G
- Network 架構分以下三部分
- Public Land Mobile Network (PLMN)
- Radio Access Networks (RANs)
- Core Network (CN)
- 可以向下支持 2G 的 RAN
- HLR 被封裝到 HSS
- 
- CN
- CS Domain
- PS Domain
- IMS (IP Multimedia Subsystem)
- packet switch 用來傳語音的 (real-time)
- RANs
- (2G)GERAN (GSM/EDGE RAN):
- circuit-switch
- BSS(Base Station Subsystem)
- BTS
- BSC
- (3G)UTRAN (UMTS Terrestrial RAN):
- packet-switch
- RNS (Radio Network Subsystem)
- Node B (類似 BTS)
- RNC(Radio Network Controller)(類似 BSC)
- User Equipment (UE)
- 2G 時叫 MS (mobile station)
- 
- USIM(3G):SIM(2G) 卡
- ME:還沒裝 SIM 卡的機器
- TE 比較類似 protocol 部分(偏軟體)
- MT 偏硬體
- TA 偏天線
- Identifiers
- IMEI (International Mobile Station Equipment Identity):
- 硬體序號 for 手機
- IMSI (International Mobile Subscriber Identity):SIM card 序號
- 電信業者拿來收錢的
- 非必要不拿來傳輸 (有 leak private key 可能)
- TMSI (Temporary Mobile Subscriber Identity)
- 用 IMSI 算出一個暫時的 TMSI
- 4-octet number
- 用 MSC/VLR or SGSN 算出來
- P-TMSI: packet-switch 在用的
- IP
- single or multiple
- 只有需要時才會被 assign
- circuit-switched CN (core network) 內有
- SS#7 是 circuit-switched 的標準
- singaling system no. 7
- 
- 與 2G 不同的地方
- switching (轉送) vs. call control
- switch 與 control 分離 (SDN)
- Scalibility (擴展性) 會變好
- Reliability (可靠性) 也會變好
- MSC Server (controller):
- call control and mobility management
- CS Media Gateway (CS-MGW)
- circuit switching
- media conversion
- payload processing
- ...
- control plane -- singling message
- 用來作 call control
- user/data plane -- switching
- pros:
- **circuit switching** **scability**.
- two plane independent, protocol more easier.
- note: In 5G, two plane is for **packet switching** scability
- Packet-Switched CN
- 主要要做三件事情
- Network access control
- 控制 ACL
- Packet routing and transport
- Mobility management
- track 位置 (VLR, HLR)
- initating paging (知道使用者在哪個基地台下)
- 維護 up-to-date routes
- 流程: IP 從 internet 用 routing 來到 GGSN,GGSN 打 tunnel 到 SGSN,SGSN 再打 tunnel 到 RNC(Radio)
- SGSN (==Serving== GPRS Support Node)
- CN 往手機端連的 GW
- 處理 ACL
- 處理位置
- report 到 HLR
- Routing
- Paging
- [參考](http://xdxdd.blogspot.tw/2012/08/lte-paging-proccess.html)
- GGSN (==Gateway== GPRS Support Node)
- CN 到 Internet 的 GW
- packet 在 CN 的走法不是 routing table,而是 Tunnel,IP packet 只是用來背資料的
- Tunnel
- 在 IP packet 外層再封裝一層,保證路徑是你要的,而不是讀 routing table 任意傳送
- Internet 常見 Tunnel 有三種 (header 差別)
- IP-in-IP: 在 packet 外面多封裝一層 ip header
- Minimum encapsulation: 有些 header 不需要重複使用,指封裝需要的
- Generic routing encapsulation(GRE): [參考](https://www.incapsula.com/blog/what-is-gre-tunnel.html)
- 3GPP 都不是,用的是 GTP
- 因為手機會移動,又要配合 ip protocol,因此會使用 tunnel 來處理 GGSN 到手機部分
- 
- packet route 的中心
- 所有在 PLMN 的 packet 都會跑到 GGSN
- 就算是手機給手機,同一個 Base Station,也一定會來到 GGSN 再下來,因為 GGSN 才知道誰在哪裡 => delay 比較長
- SGSN 與 GGSN 都有
- IP address
- SGSN Number, GGSN Number
- IP Multimedia subsystem(IMS)
- 支援 real time voice / multimedia
- Session Initiation Protocol(SIP)
- Information Server
- CS, PS 共用
- HSS(Home Subscriber Server)
- HLR
- user subscription DB
- AuC(Authentication Center)
- 作身分認證
- 廠商用 AuC 收費
- EIR(Equipment Identity Register)
- 存 IMEIs(硬體序號)的
- 3G 四個主要部分
- RAN (Radio 部分)
- RAN-to-CN
- CS CN(Circuit)
- Iu-CS (3G 時代的)
- 還是支援很多 MAP(Circuit Switch 標準)
- PS CN(Packet)
- Iu-PS
- 
- 協定
- RAN 端
- GERAN(2G 時代)
- Abis (BSC 到 BTS)
- Um (BTS 到 MT)
- UTRAN(3G 時代)
- Iub
- RNC 到 NodeB 的協定
- Iur
- RNC 與 RNC 溝通
- 邏輯 Interface
- 實際上可能先跑到 SGSN 再下來
- control plane
- Uu
- NodeB 到 MT(mobile)
- RAN-to-CN
- GERAN
- A or IuCS: Circuit switch
- G or IuPS: Packet switch
- UTRAN
- 確定用 IuCS 與 IuPS
- 
- Tunnel
- 
- 3GPP Bearers
- 將傳輸分成 3 部分
- 拆開來比較簡單
- 抽象化
- 各段有新的技術,其他段不用改
- 有利於流動性管理(mobility management)
- Radio access bearer(RAB)
- 
- Radio bearer (RRC)
- Signaling Radio Bearer (虛線)
- Traffic Radio Bearer (實線)
- Iu bearer (RANAP)
- Iu Signaling
- Control Plane (虛線)
- Iu Traffic
- Data Plan(User Plane) (實線)
- CN bearer
- Packet Data Protocol
- PDP(Packet Data Protocol)
- 類似手機端的 IP Protocol
- 3GPP PS CN Domain 交換 packets
- PDP Context(內容)
- 用來幫助送資料的 (header?)
- PDP address (可以想像成IP address)
- (以前還有其他,but IP 獨大後,就變成 IP 了)
- Routing Info.
- (APN, Access Point Name)
- QoS Profiles
- ex. 學生專案、吃到飽...
- PDP States
- ACTIVE State
- 可以讓某些 bearer 保持工作
- CN Bearer 一定要存在
- 因為要找User
- RAB 不一定要存在 (省資源)
- 用電量大到小 (傳輸>接收>睡眠)
- INACTIVE State
- 省資源
- 不會作 location update => 用 paging
- SGSN initating paging
- 
- PDP Transition
- PDP Context Activation
- PDP Context Modification
- 修改 PDP Address、QoS屬性
- R5 允許 GGSN-initiated PDP Context modify
- PDP Context Deactivation
- PDU(Packet Data Unit)
- 類似手機端的 packet
- 透過 traffic bearer 傳遞
- 3GPP Packet Switch 步驟
- 
- GPRS Attach (手機到 SGSN) [第一步]
- 與 SGSN 註冊
- 提供認證與服務需求(authenticated and authorized)
- 建立 Mobility Management Context (手機到 SGSN)
- 建立 ==signaling connection== (手機到 SGSN)
- 允許使用 SGSN 提供給手機的服務 (ex. 簡訊, paging)
- PDP Context Activation & RAB (RAN 端的 Tunnel) [第二步]
- 建起來之後,就可以傳收資料
- Register IMS [第三步]
- (optional,只有在需要傳 Real-time 才需要作)
- Packet Routing
- Internet 到 GGSN 用 routing table
- GGSN 之下都用 GTP (Tunnel)
- Host-Specific routes
- 系統都幫忙維護好到手機的路徑了
- active PDP context 時才要維護
- ID 對照
- 
- 反正最後都是用 GTP 的 Tunnel Endpoint Identifier(TEID) 作辨識
- PDP Address
- 跟 DHCP 87% 一樣
- 主要問題在,如何知道分配 Address 的 Server
- 流程
- GPRS Attach (要連到 SGSN)
- Call Flow:
- 
- Attach Request
- 辨識:用 P-TMSI or IMSI
- P-TMSI Signature 簽章
- GPRS Attach 是模仿 IMSI Attach
- ==需要講你是誰,全部做完會收到 Attach Ack==
- PDP Context Activation and Modification
- PDP Address allocation
- CN Bearer 建立
- RAB Assignment
- 三種方法 (前兩種都是作 active)
- Mobile-Initiated PDP Context Activation and Modification
- 
- 6、7 是 optional
- Network-Request PDP Context Activation
- 
- GGSN 送一個 msg 給 mobile,叫 mobile 做 mobile-initiated PDP context activation
- GGSN 需要有手機的 *static* information (ex. IMSI),才能拿去問 HLR 位置
- PDP Context-Modification
- 
- PDP Address 只有 GGSN 可以改
- QoS 大家都可以改
- APN (Access Point Name)
- 特定 Service 的名字 (ex. DHCP)
- 應該類似 DNS (?)
- DNS 可以把 APN 轉換成 IP address
- PS Domain Protocol Stacks
- (OSI 七層架構就是一種 protocol stack)
- Gn, Gp interface
- 
- Gn: 相同 PLMN 中,SGSN 與 GGSN / SGSN 與 SGSN 溝通
- Gp: 不同 PLMN 中,SGSN 與 GGSN 溝通
- GTP (GPRS Tunneling Protocol)
- GTP-C
- control plane
- 處理 GTP-U tunnels, PDP contexts, location, mobility
- GTP-U
- user/data plane
- 建立並處理 GTP tunnels
- GTP Messages
- Tunnel Management
- Location
- Mobility
- Path
- GTP header
- 
- Version
- PT(Protocol Type): 3GPP 或 GPRS/GSM
- E(Extension header flag)
- ...
- 最重要的是 TEID(Tunnel Endpoint Identifier): 知道 tunnel 要從哪裡打到哪裡
- Iu-PS
- Tunnel Management
- Radio Access Bearer
- Radio Resource
- Mobility
- 3GPP Iu-PS interface protocol stack
- 
- user plane 一樣
- control plane 不同 (底層用 ATM)
- Gi, Gr, Gc, Gs int
- Gi: GGSN 與 Internet IP 連接口
- 
- Gr: SGSN 與 HLR 連接口
- Gc: GGSN 與 HLR 連接口
- 
- 
- 上圖主要是請 GSN 做 GGSN 與 HLR 的翻譯
- Gs: SGSN 與 MSC/VLR
- 
- Mobile 到 GGSN
- 
- 把 MAC、RLC、PDCP 想像成第二層
- RLC (Radio Link Control)
- 與 internet 的 LLC 類似(Layer 2.5)
- error detection
- 手機可以有多個 RLC connections
- PDCP (Packet Data Convergence Protocol)
- Header Compression
- 壓縮 Header,主要有兩種方法
- IPHC (IP Header Compression)
- ROHC (Robust Header Compression)
- 把更高階的資料(IP...)映射到低階的協定(RLC)
- 維護資料傳送順序(order)
- PDP 是跟外面連線用的,GTP-U 是內部連線用的
- GGSN 中
- PDP 內的 IP 是 external internet 的 IP
- GTP-U 是幫忙作 Tunnel 的 header
- UDP、IP、... 是 GGSN 本身的位置
- (Non-)Transparent Access
- TA:
- GGSN 沒有包含在裡面,只負責把 packet 傳出去
- N-TA:
- GGSN 用了 MIPv4 Foreign Agent
- To Internet
- TA 版本
- 
- 3GPP Packet Domain Bearer 可以用 [Mobile 到 GGSN] 那張圖取代
- PSDN 外是用 IP routing,內是用 Tunnel
- NTA 版本
- 
### Mobility Management
- Type of Mobility
- Terminal mobility
- 機器在移動時,不會斷線
- 最大問題所在
- 種類
- discrete
- 連線斷後,馬上再連上網
- continuous
- 移動時,IP 還是可以用,不會斷線
- User mobility
- 使用者移動時,都可以使用網路
- Service mobility
- 在不同地方可以使用相同的服務
- 支援 Mobility 時,盡量可以做到的
- Location management
- Location Update
- 改變 attachment points 時
- 改變 location areas 時 <- 較好
- 這種方法要找 User 時,再做 paging
- RAN 與 CN 對 location areas 的定義可以不同
- 種類
- Time-based: 一段時間 update 一次
- Movement-based: 每移動固定數量的 **area**
- Distance-based: 跟原來位置差超過固定數量的 **area**
- Parameter-based: 自己找參數,參數過標就 update (包含上面的都算)
- Implicit update: 在送其他 control msg 時,順便 update 一下
- Probabilistic update: 看機率 (學術上還在研究)
- Location Discovery (Paging)
- 送一個或多個 paging msg 到 paging area
- paging area 與 local area 不用一樣
- 收到 paging msg 後,手機需要 update 位置
- paging 需要在短時間內完成
- 如何建立 area (dynamic, static)
- 方案
- blanket
- broadcast 到所有,在的人就會回復
- sequential
- 一個一個 area 問
- etc.
- location update 愈多,paging 越少
- Packet delivery to mobiles
- 種類
- Direct
- 獲取位置,資料傳給本人
- 壞處,dst 是不會移動的機器,根本不需要每次都問位置
- Relayed
- 資料傳給 relay,由 relay 負責送給本人,無須獲取位置
- 壞處:可能 src 與 dst 都在美國,relay 在台灣、relay 的 loading 會比較重 (多台機器的 relay 是同一台)
- 
- 整合兩種方法:Integrated Relayed Delivery and Direct Delivery strategies
- 
- 第一個封包用 relay,之後的都用 direct
- Handoff & Roaming
- 之前講過了
- Network Access Control (AAA)
- Authentication 認證
- Authorization 授權
- Accounting 計費
### ---------------第二次第三次考試分隔線---------------
- Roaming
- Mobility Management IP
- Issue(問題)
- 主要解決連線不能斷,不是斷了再連的問題
- IP 代表 ID 與 Location
- 移動就不能用了 (socket 會斷掉)
- **Mobile IPv4**
- Home Network (HN)
- HA 給的 IP address 叫 Home address (HoA)
- 不會動的 Address
- 是 Internet 中,手機的 dst-ip
- 有一個 Binding Table
- 存取 HoA 和 CoA 的對應關係
- Home Agent
- 維護 up-to-date location
- 攔截封包到手機的 home address
- tunnel packet 到手機的當前位置
- Foreign Network (FN)
- 提供 MH CoA (Care-of Address)
- CoA (Care-of Address)
- 在 Foreign network 用 CoA 收 IP packet
- FA CoA (MS用的CoA)
- 在 Foreign 用的 IP address
- 類似一個 subnet 的 IP address
- 可以很多人共用
- 例:朋友將信寄至郵局(FA),由郵局再轉交給你。
- Co-Located CoA (mobile自己拿到的CoA)
- Mobile 到 FA 的 address
- 相當於DHCP
- 例:朋友將信寄至你目前通訊處(HA),由你自己收信(靠tunnel)。
- Foreign Agent (FA)
- 提供 CoA 和其他必要的配置信息
- De-tunnels packets
- Ingress Filtering
- router 會檢查 IP 是否屬於該 subnet
- 如果檢查出不是,就不幫你送出去
- 沒做 Ingress Filtering 就直接送出去
- 
- 如果回去是走 Mobile -> Correspondent
- triangular routing
- 如果 Mobile -> HA
- reverse tunnel
- 
- CH send msg to HoA
source IP address:**S**; destination IP address:**D**
- CH only send traffic to HA. No need to know CoA of MH.(relayed directly)
- **D**: HoA; **S**: CH
- HA relay message to MH.
Use tunneling: ip-in-ip/Minimal Encapsulation?/GRE*
- **D**: CoA; **S**: HA
- If MH at home network, MH will receive msg when last router send ARP REQUEST.
- MH sends msg to CH
*depends on if routers **have Ingress filtering or not**.*
- Routers **do not have** Ingress filtering
- **triangular routing**
- **D**: CH; **S**: HoA
- Routers **have** Ingress filtering
- issue: source IP, **HoA**, doesnt belong to the subnet of the FN where the MH is at. -> Routers wont forward the data sent from the MH.
- 解決: **reverse tunnelnig**
- 內部ip
- **D**: CH; **S**: HoA
- 外部ip
- **D**: HA; **S**: CoA

- 缺點: MH <-> CH路徑拖很長
- If CH through HA(HA in the US) to MH(MH in Taiwan), it's long to send msgs back and forth along the way b/w the CH and the MH.
- Agent Discovery
- 尋找 mobile agent (HA[一定有], FA[不一定有], ...)
- Agent Advertisement message
- Agent ==主動定期== broadcast 說我在這裡
- Agent Solicitation
- 自己直接問 agent 在哪
- 所有 Agent 都會監聽 224.0.0.11,所以如果 mobile 要找 Agent 又沒有聽到 broadcast,就送資訊到 224.0.0.11 (Mobile-Agents Multicast Group address)
- 使用 ICMP(Internet Control Message Protocol) Router Discovery Message
- ICMP Router Advertisement Message
- router 主動 boardcast
- ICMP Router Solicitation Message
- 沒聽到 boardcast 就送這個 Solicitation Message 去問 ICMP
- 利用 Router Advertisement 加入 Extensions,帶 MIPv4 資訊 (mobile IPv4)
- Mobile IP Agent Advertisement message
- 
- Mobility Agent Advertisement Extension
- HA 要講的 msg. 就放在這裡
- 
- Type:不同 extension 有不同編號
- Length:知道 extension 有多長
- Zero or more CoA:由 length 決定
- Sequence Number:一直增加,讓每次msg.都不一樣,防 replay attack(有心人士重複訊息,安全性問題)
- Registration Lifetime:可以註冊多久
- Reserved:保留給將來用的欄位
- R:強制一定要跟我註冊,不能用Co-located CoA
- B:正在忙
- M:沒講就是 IP in IP
- Prefix-Lengths Extension (optional)
- 看有沒有換 subnet
- 
- 一個 agent 可能有數個 IP
- Prefix Length:代表 Prefix 的長度
- ......:代表數個Prefix Length
- 找 FA Agent 是找最近的,所以 TTL = 1
- Movement Detection
- 最好方法,找底層問 (L1, L2)
- Leaving Home Network
- ARP Cache
- 存起來,限時間,預設20min
- ARP (Address Resolution Protocol) in MIPv4
- Gratuitous ARP (無故 ARP)
- 要離開 Home Network 時,跟大家說,我要離開了,可以把我的 cache 清掉
- mobile address 移走後,會告訴其他人,要更新我的 hardware address 到 HA 的 hardware address,以後請送資料到 HA
- HA 就會 proxy ARP,代表 mobile 回 ARP REQUEST
- 進入(Entering)和留在(Staying)新的 Network
- 1. 要(acquire)新的 CoA
- 2. 跟 HA 註冊(register)這個 CoA
- Location update
- HA 就會把 packet tunnel 到 新的 CoA
- Registration
- 目的:MH 拿到一個新的 CoA 要跟 HA 註冊時候用的msg.
- 過程:MH 拿到 CoA 送 RRQ 給 HA,HA 收到 RRQ 會回覆 RRP,說我收到了
- RRQ 和 RRP 是 MIPv4 唯二自定的新的 msg.
- Registration Request (RRQ)
- UDP -> port 434 (TCP 太複雜)
- HA 認證所有 RRQ
- 不只是 UE 拿來做註冊
- 是應用層(L5)
- Registration Reply (RRP)
- UDP 434
- mobile 認證所有 RRP
- FA CoA vs Co-located CoA
- FA CoA
- 必需要和 FA 註冊
- FA 可以不接受註冊
- Co-located CoA
- 可直接和 HA 註冊
- 'R' flag 可強制和 FA 註冊
- Registration Request (RRQ)
- directed broadcast 回 Home Network
- 除了註冊外,還有其他功能
- 1.Discover HA 的 address
- 2.如果沒有 HoA,會 discover HoA
- 3.續期
- 4.回到home network 會 Deregister (登出) with the HA
- 回顧:
- directed broadcast
- broadcast in the **other subnet**. (1~3)
- limited broadcast
- broadcast in the **same subnet**. (4)
- 
- S:Simultaneous bindings
- (同時binding 多個 CoA,為了同時 tunnel,解決重疊問題)
- B:Broadcast datagrams
- (broadcast在原來的subnet)
- D:Decapsulation by mobile terminal
- (MH 不想用 FA,叫 HA 直接 tunnel 給 MH)
- Lifetime:原本由 HA 決定
- 0 代表 MH 要登出
- HoA
- Preconfigured(預先配置)
- 填 0.0.0.0 代表沒有IP
- HA
- Dynamic Home Agent Address Resolution:不知道 HA 的 IP
- (MH 傳 RRQ 到 HA 的 subnet-directed broadcast,HA 拒絕,MH 就從拒絕地址得知 IP)
- Identification
- Matching RRQ and RRP
- 有點像 Sequence Number 防 replay attack
- One or more Extension Fields
- Mobile-Home 認證 Extension
- Registration Reply (RRP)
- 
- Code
- RRQ的結果
- Lifetime
- successful registration:會顯示剩餘秒數
- zero:代表之前登出已成功
- Failed registration:若為空,則這代表沒註冊成功
- Returning to the Home Network
- Broadcast Gratuitous ARP(更新 cache)
- Deregistration Request
- Mobile-Home Authentication Extension(security再講)
- Fields protected by MIP Mobile-Home Authentication Extension
- 
- Vendor/Organization Specific Extensions to Mobile IP Messages
- 允許網絡運營商添加特定信息
- CVSE
- 如果不認得 CVSE,就把整個 msg. 都不要
- NVSE
- 如果不認得 NVSE,只無視 NVSE,其他msg. 繼續處理
- Reverse Tunneling
- Ingress filtering:之前講過
- Limitations(局限性) of MIPv4
- MIP的優點
- IP routing 不變
- backward compatible(向下兼容)
- MIP的缺點
- Triangular routing(Delay 可能很長)
- HA Relayed Delivery,可能太忙,會crash
- Potential long handoff delay (RRQ可能要很久,從舊到新)
- deregistration 不足
- FA only deregister of FoA(MH) by life time.
- MIPv4 route optimization(優化)
- Correspondent Node(CN)
- 可以看成 CH
- Binding Cache
- Map HoA to their CoA
- Binding Update
- 送 MH 目前的 CoA 給 CH
- CH 直接用 CoA 會斷線
- IETF 最後沒採用,因為安全性問題
- 為什麼要經 HA 來做 Binding Update 而不用 MH 回訊息時直接更新?
- 安全性問題,從 MH 角度來看,CH 和 HA 做比較安全,若要和 MH 建立驗證則會太多,相對 HA 來得較少和好管理。
- continuity 問題
- 若連線期間MH又換至其他網域,原連線(MH<->CH)斷掉(退回 discrete connection),喪失MIPv4初衷。
- scalability(量少較好)
- **Mobile IPv6**
- 和 MIPv4 不同點
- address 變長
- 有 ==extension header(有安全性)==
- MH 可以直接和 CH 做 Binding Update
- 沒 FA,只用 Co-located CoA
- IPv6 的 Neighbor Discovery 可以 detect movement
- Binding
- 目的:HoA <---Map---> CoA
- Binding Update(BU) [FN -> HN] (似MIPv4 RRQ)
- Binding Acknowledgment(BA) [HN -> FN] (似MIPv4 RRP)
- IPsec (一群security)
- **Packet Delivery (數據傳送)**
- Bi-directional tunneling mode
- 類似 MIPv4 的 reverse tunneling
- Route optimization mode (常用)
- 
- 解決了 MIPv4的問題
- security issue(再講)
- continuity issue
- HoA 和 CoA 都帶著,一個放 base header,一個放 extension header
- ***Movement Detection***
- 用 IPv6 Neighbor Discovery
- Router Advertisement
- 似MIPv4, **not standardlized**
- lower layer has better solution, 但不在IETF管理的範圍內
- ***Sending Packets Directly to Mobile’s Care-of Address(CH -> MH)***
- 用 ==MIPv6 routing header== format
- 
- Destination Address: CoA
- Next Header: routing header
- Home Address: HoA
- 當 MH 收到 packet 後,MH -> CH
- Source Address: HoA
- Next Header: destination header
- Home Address: CoA
- Segments Left
- 一開始設成 1,對調後就減 1,這樣就回去了
- ***Sending Packets While Away From Home(MH -> CH)***
- 
- 用 ==Destination Options Header==
- CoA 和 HoA 視情況使用
- replace the source IPv6 address
- 為什麼分 routing header 和 DOH?
- 希望 HoA 和 CoA 都帶著,必要時替換,看要取代 src 或 dst
- RH: swap dst(CH -> MH)
- DOH: swap src(MH -> CH)
- ***Formats of Binding Update and Binding Acknowledgement Messages***
- Mobility Header
- 其中一種 extension header
- 傳 BU 和 BA
- 
- Payload Protocol (= next header)
- Checksum
- parity check(奇偶校驗)
- Message Data
- *MIPv6 BU message*
- 
- sequence number: 防 replay attack
- life time: remaining time of binding before expired. 像RRQ
- A (Acknowledge):回 ack
- L: 複習IPv6
- H (Home Registration)
- Mobility Options
- 
- 一定有 CoA
- Alternative Care-of Address option:carry a mobile's CoA
- *MIPv6 BA message*
- 
- Status:BA 回BU成功或失敗的訊息
- Mobility Options:和 security 有關
- **Mobility Management in 3GPP Packet Switch Core Networks**
- **Different Scopes of Mobility**
- 
- 樹狀架構
- Inter-Node B Handoff
- 變 Radio Bearers(RB)
- Inter-RNC Handoff
- 變 I~u~ Bearers 和 RB
- Inter-SGSN Handoff
- **Update** the PDP context
- 建新的 CN Bearers
- 變 I~u~ Bearers 和 RB
- Inter-GGSN Handoff
- **Create** a new PDP context
- 建新的 CN Bearers
- 變 I~u~ Bearers 和 RB
- **Packet Mobility Management (PMM) Context and States**
- PMM context
- a set of information
- track the mobile’s location
- PMM state
- How the mobile’s location should be tracked by the network
- Maintained by ==SGSN and mobile station==
- PMM States
- PMM-DETACHED State
- SGSN 沒有連接 MH
- PMM-CONNECTED State
- 已連接
- 有 signaling connection
- PMM-IDLE State
- 有些有,有些沒有
- SGSN 只知道 MH 在 Routing Area 底下(大概位置)
- PDP Context
- 若從 CONNECTED -> IDLE,可以在 GGSN 和 SGSN 之間繼續保持 ACTIVE state
- 好處:GGSN 知道 MH 在 SGSN 底下,容易 paging
- PMM state transition machines
- 
- mobile 和 SGSN 之間的不同
- SGSN 的 PMM-CONNECTED 有 Serving RNS Relocation
- Synchronization 同步
- state 不同步時做更正
- Routing Area Update(RAU)
- paging
- **Location Management for Packet-Switched Services**
- Location Concepts
- RAN 用
- Cell Area
- UTRAN Registration Area(URA):一群 Cell
- CN 用
- Location Area(LA):一群 Cell (CS services)
- 1 個 LA 處理 1 MSC/VLR
- Location Area Identifier (LAI)
- Routing Area(RA):一群 Cell (PS services)
- 1 個 RA 處理 1 SGSN
- Routing Area Identifier (RAI)
- URA, LA, RA 範圍沒有必要一樣大
- Location Tracking
- PMM-IDLE state
- => RRC IDLE/**CONNECTED**
- RRC-CONNECTED in CS domain, 但PMM 在PS domain
- PMM-CONNECTED state
- SGSN 知道 MH
- => RRC-CONNECTED
- RRC States
- MH 到 RNS
- RRC 是 CS 和 PS 共用的
- (note) RRC: connection b/w MS and RNC
- **Routing Area Update(RAU)**
- 何時執行 RAU
- 進入新的 RA (movement base)
- 時間到期 (time base)
- Network 命令
- Network Capability changes (例:加密)
- Intra-SGSN RAU (在移動)SGSN沒變
- 
- SRNS (serving-Radio Network System)
- Target SGSN 請 Source RNC 把 Data Forward 給它
- 1.先在 PMM-CONNECTED state
- 2.傳 RAU Request 到 Target SGSN
- Inter-SGSN RAU (在移動)SGSN有變
- 
- 1.傳 RAU Request 到 Target SGSN
- 2.Target SGSN 向 source SGSN to 認證 the mobile’s P-TMSI
- 3-1.認證為 Positive,跳過 4,把 PMM context and PDP context 拿到
- 3-2.認證為 Negative,做 4,或重新做一次認證
- 4.做雙箭頭(Security Procedure)
- 5.剩下的
- 簡單版:舊的東西把它轉到新的地方,新的連線建起來,舊的連線切掉。
- **Serving RNS Relocation(搬遷)**
- 
- Radio Network System(RNS): 包含RNC and Node B
- 原本(左圖):
- 舊的沒切掉,用I~ur~ interface tunnel 到 Target RNC
- 好處:
- Reduce handoff lantency.
- 壞處:
- Routing path may be too long.
- 若從SoureceRNC->TargetRNC~1~-> TargetRNC~2~-> ... ->TargetRNC~n~, Path變太長
- Source(Serving)RNC may be bottleneck.
- Source(Serving)RNC 多服務不屬於自己服務範圍的user.
- summary: 占用資源比較多,路徑變長,多個RNC同時服務 1 個 user
- 超過容忍值後, Serving RNS Relocation(右圖)
- 什麼時候做?
- 用演算法去決定
- **Hard Handoff**
- 
- 這是 Network 決定 Handoff 的 call flow
- 由 source RNC initiate(起頭)
- RNC 可理解成 基地台
- Relocation Request Acknowledge
- Target RNC to Source RNC Transparent Container
- RRC Message 1
- Source RNC -> MH
- 舊基地台告訊你新基地台的info.
- RRC Message 2
- 我已經連上新基地台的info.
- **Paging Initiated by Packet-Switched Core Network**
- 由 SGSN initiate
- 有 Type 1 和 Type 2 Paging
- **Service Request Procedure**
- MH 要求 PSCN 傳東西就是 Service Request
- 在 PMM-IDLE state 會把 signaling connection 建起來
- 在 PMM-CONNECTED state 會把 resource 保留起來
## 4G
- Outline
- EPS(Evolved Packet System) = LTE(4G的RAN) + EPC(4G的CN)
- Rel-5:3G
- Rel-8:4G
- Rel-15:5G
- LTE Objectives
- Compatibility with earlier releases and with other systems
- 和舊的一定要相容
- 3GPP Architecture (R8)
- 3GPP Evolved Packet System (EPS)
- Radio Side (LTE)
- 作品:E-UTRAN
- Network Side (SAE)
- 作品:EPC
- PS Only,沒 CS
- VoLTE (voice over LTE)
- 用 packet 傳 voice
- 台灣目前4G只服務網路,打電話用**CS Fall Back** 回到 3G
- 3GPP, non-3GPP(such as wifi) (trusted and nontrusted)
- AIPN (the "all-IP" network)
- Multimedia Broadcast Multicast Service (MBMS)
- Multicast -- 節省頻寬
- Flat architecture
- Network sharing
- 基地台共構
- 3GPP SAE Architecture
- 
- EPS Architecture
- 
- 虛線:Control plane
- 實線:Data plane
- S-GW 類似 SGSN
- P-GW 類似 GGSN
- Home Subscriber Server (HSS)
- A central database about all the network operator’s subscribers
- Policy and Charging Rules Function (PCRF)
- 做決策:policy and charging
- Mobility Management Entity (MME)
- 只有在 control plane
- Serving Gateway (S-GW)
- Interface between E-UTRAN and CN
- Packet are routed through S-GW for intra E-UTRAN mobility
- Packet 可以送到 S-GW 就好,不用到 P-GW
- Packet Data Network (PDN) Gateway (P-GW)
- 類似 GGSN (HA)
- Policy enforcement
- PCRF 叫 它做就做
- E-UTRAN Architecture
- 
- 與 UTRAN 的差別
- eNodeB 可以直接對連,用 X2 interface
- 沒有 RNC,被 eNodeB,MME,S-GW 取代
- eNodeB
- RRC 跑到 eNodeB 底下
- Comparison between EPS and UMTS
- S-GW 負責 user plane
- MME 負責 control plane
- 兩個 plane 可以分開改善(或加減)
- Summary
- Flat architecture (latancy 變低)
- control plane 和 user plane 分開
- PS only
- Roaming between 3GPP and non-3GPP
- Packet 可以送到 S-GW 就好,不用到 P-GW
- 
- Control Plane
- 第四層(L4)由 TCP/UDP 變成 SCTP (IETF發明的)
- S1-AP 在 應用層(L5)
- Diameter (IETF 定的 protocol)
- 做 AAA 的事情
- Authentication 認證
- Authorization 授權
- Accounting 計費
- RADIUS <- 舊的 protocol
- cons:
- scalibility not good
- not good for accounting
- User Plane
...
### ---------------第三次第四次考試分隔線---------------
## 5G
### feature
- D2D (Device-to Device Communication)
- 透過其他機器、人 幫忙傳
- 
- MTC (Massive Machine Type Communications)
- Machine to machine (有一大堆機器要上網 ex. IoT)
- wireless sensors
- Low data rate (low power)
- low cost, low energy
- MN (Moving Networks)
- 車載網路 (高速)
- V2X (Vehicle to X[可以是任何東西] communication)
- UDN (Ultra Dense Networks)
- macro(30km), micro(2km), pico(200m), fento(10m) cell
- fento cells 傳輸率高,可是很近 => 密集部屬
- 把不同種類都整合起來,達到最有效率使用
- 可能根據不同的行為模式來改變使用種類 (ex. 待在家裡沒有移動、作高鐵時)
- URC (Ultra-Reliable)
- availability * reliability
### Implement
- Network Slicing
- NFV
- SDN
## Security
### Intro.
- AAA
- 認證(Authentication)
- 授權(Authorization)
- 計費(Accounting)
- Integrity
- 完整性、不可竄改
- Confidentiality or Privacy
- 保密,只有授權用戶才能理解(ex. encrypted file)
- Availability
- 確保合法者都可以連上 (ex. DoS)
- Non-repudiation
- 不可抵賴性 (log,做過的事情都有記錄)
#### Security Attack
- Passive
- 不搞破壞
- 竊聽、偷資料 等
- Active
- 破壞
- ex.
- DoS (Denial-of-service)
- Masquerade (假冒)
- Man in the middle
- Replay (雖然我不知道密文解法,但是我可以把他複製重送一次)
- Dictionary (字典檔攻擊)
- 弱密碼、預設帳密
- 後門
- ...
#### Encryption
- Encrypt 加密
- plaintext(cleartext)明文 -> ciphertext密文
- Decrypt 解密
- ciphertext -> plaintext
- 種類
- Secret-key (密鑰系統)
- 共享相同的 key (Symmetric)
- 比較快
- DES、AES
- [CBC、ECB、CTR、OCB、CFB](https://stackoverflow.com/questions/1220751/how-to-choose-an-aes-encryption-mode-cbc-ecb-ctr-ocb-cfb)、[GCM](https://blog.csdn.net/T0mato_/article/details/53160772)、...
- 
- Public-key (公鑰系統)
- 公私鑰分開 (Asymmetric)
- 速度較慢
- RSA
- use two large prime numbers be the public key/secret key
- ECC
- 缺點:怕man in middle attack改public key
- 
#### MSG Authentication
- integrity & authenticate
- 確認資料完整性
- 確認資料真的是誰送出的
- 有 key 的 MAC 才能
- symmetric key 了話只能雙方有,第三方有就不能驗證了
- one-way hash
- 無 key: SHA、md5...
- 有 key: HMAC
- MSG Auth. code (MAC)
- 
#### Digital Signature (數位簽章)
- 驗證是否真的某人送出的資訊
- 基本上就是 public-key MAC
- 
- Download Public 時可能會被 man-in-middle => 簽 CA (可信任第三方)
- PKI (public key infrastructure)
- 把 public 放到可信任第三方(CA) 託管
- CA 的 public 預設已經存在你的電腦裡了
- 用 CA 的 public 驗證你下在別人的 public
- [X.509](https://en.wikipedia.org/wiki/X.509): ITU 標準
- CA 互簽
- 
### IPsec (IP Security)
- 一群 protocols
- IETF 定義
- IPv4 選用
- IPv6 必用
- 
- AH (Authentication Header)
- data ==integrity==(主要) and authentication
- ESP (Encapsulating Security Payload)
- provides confidentiality services
- ==integrity== & ==confidentiality==(主要) 都可以做
- Operation
- Transport
- Tunnel
- SA (Security Association)
- Security (key) 的互相關聯
- 一系列資訊由兩個 node 維護
- 要提供哪些安全服務
- 如何提供 (實作)
- SAD (SA Database) 存三個資訊
- Protocol: AH or ESP
- Dest. IP address
- SPI (Security Parameter Index): 用來尋找最終的 SA (同一個 SA、同一個 IP 還是有可能有多個 SA(用不同實作可能有不同 key))
- Diffie-Hellman (DH) Algo.
- AH (Authentication Header)
- Header format of AH
- 
- mac 就是 Auth. Data (integrity & Auth.)
- Integrity Check Value (ICV)
- MAC by SA
- 32bits
- Computed over (需要保護的範圍)
- ==immutable== IP header fields (傳輸過程中不會改變的欄位 ex. TTL 就會變)
- AH header
- upper level proto. data
- Sequence Number: 避免 replay attack
- AH in IPv4 in transport mode
- 
- AH in IPv6 in transport mode
- 
- AH in tunnel mode
- 
- ESP (Encapsulation Security Payload)
- 把原來的 Payload ==包起來==變成亂碼
- 
- ESP in IPv4 in transport mode
- 
- ESP in IPv6 in transport mode
- 
- 
- Header
- SPI
- Sequence Number
- Trailer
- Padding
- 補齊bit
- 加一些無意義的東西把原始資料隱藏起來
- Pad Length
- Next Header
#### Security in Wireless Networks
- 
- Security Provisioning
- 產生和分發 ==credentials(憑證)== to user and network
- In GSM
- $K_i$ 為 secret key (在SIM卡內)
- In IS-41
- A-key 為 secret key (手動Key進去手機)
- Authentication and Key Agreement (AKA)
- For GSM
- ==Challenges== the user (Authentication)
- and expects a correct response (Key Agreement)
- 
- Security in GSM
- 3 Algorithms
- A3: authentication (認證)
- A5: stream cipher algorithm (加密演算法)
- A8: cipher key generation (產生 secret key)
- 
- Weakness
- 不能認證 network
- visited system 可能不安全
- 假設 core network 是安全的
- 64bit 的 $K_c$ 可能不安全(不夠長)
- 沒有 end-to-end encryption
- 沒有 integrity check
- Security in GPRS (2G->3G)
- 沒 integrity
- Confidentiality: GPRS Encryption Algorithm (GEA)
- MS <--> SGSN
- uplink 和 downlink 用不同的加密方法
- 
- 用到 exclusive or (因為做2次就還原)
- 比 GSM 快很多
- Security in 3GPP
- Network Access Security
- Authentication and Key Agreement (AKA)
- 
- 重點
- Mutual authentication (相互認證)
- Master Key 可分別真假的電信業者
- 先產生一堆 AV,需要時直接用
- Authentication Vector (AV)
- a cipher key (CK)
- an integrity key (IK)
- an authentication token (AUTN)
- 
- Anonymity Key (AK)
- 隱藏 sequence number (SQN)
- 
- UMTS Encryption Algorithm (UEA)
- 比 GEA 多一些 input,更好用一點
- UMTS Integrity Algorithm (UIA)
- 做 integrity check
- 若 IK 一樣 => Master Key 一樣
- Network Domain Security
- PS 用 IPsec
- CS 用 MAPsec