###### tags: `計算機網路概論`
:::info
[回共筆首頁](https://hackmd.io/SSJDgNdiQ02odihzTkkQpg)
[回科目首頁](https://hackmd.io/v_hdETFnSwCLMTNXEWM9Og)
:::
# 1. Introduction
## 1.1 what is the Internet?
### 什麼是互聯網?
1. hosts = endsystems:
- 功用: 執行 network apps
- 舉例: PC、SERVER、LAPTOP、SmartPhone
2. communication links:
- 範例: 光纖(fiber)、銅線(copper)、電波(radio)、衛星(satellite)
- transmission rate **越高** : bandwidth **越大**
3. packet switches:
- 功用: 發送封包(forward packets)
- 舉例: Routers(路由器)、Switches(網路交換器)
:::info
**Packets**
* 被分段的資料 => 封包
:::
### 連接到互聯網的裝置
越來越多裝置連接到互聯網(物聯網)。
### 什麼是互聯網?
1. Internet(互聯網):
- 各種網路組成的網路(network of networks)
2. protocols(協議):
- 控制訊息的傳送與接收
- 舉例: **TCP、IP(這兩個 狠 重要)**、HTTP、Skype、802.11
2. Internet standards:
- 協議的詳細內容
### 什麼是protocols(協議)?
1. **網路的協定相當於人類的語言。**
2. 協定定義**格式**、**訊息收發的順序** 和 **訊息傳輸的採取的行動**。
## 1.2 network edge
### 網路的結構
1. network edge
- 主機(Hosts): 客戶端(clients)與伺服器(servers)
2. access networks, physical media
- 有線較無線穩定,因為無線的干擾較多,你的訊息是別人的雜訊
3. network core
- 路由器互相連接,須具備**高速**的特性,常用**光纖**
### Access network: home network(家用網路)
1. ISP(網際網路服務供應商)提供網路
2. Modem(數據機)將網際網路的訊號轉換,並讓裝置可以連接到網際網路
3. 外網IP一個裝置只有一個
4. 有動態IP的其中一個原因**(?)**: 網路公司不想要用戶自己在家開伺服器
## 1.3 network core
### Introduct network core
1. The network core => 老師都稱core network
- 多個routers組成
2. 功用:
- forward packets
3. 通常只有ISP可以負擔的起建造network core的機器,因為這些routers都很貴
### Packet-switching: store-and-forward 如何傳送封包
1. store-and-forward
- router先把整個packets store起來,檢查整個封包的destination在哪裡,再forward出去
- 花費時間
- takes L/R seconds to transmit(push out) L-bit packet into link at R~bps~
- 我有L-bit長度的封包,然後傳送的速率為R~bps~,則傳送一次,需要花費L/R seconds
- 舉例:L = 7.5 Mbits, R = 1.5 Mbits ,則one-hop transmission delay = 5 sec
### Packet-switching: queueing delay, loss 在傳送封包時,會遇到delay跟loss
- if arrival rate(in bits) to link exceeds transmission rate of link for a period of time:
- packets will queue, wait to be transmitted on link
- packets can be dropped (lost) if memory (buffer) fills up
- 當要傳的資料大於switch傳的速率,就會發生
- 佇列,先進先出
- 倘若switch的buffer已經滿了,就會發生loss
### Two key network-core function
- routing: make a decision,有一個routing algorithm,可以把輸入的packet要去的方向,先至做出table表,交由forwarding處理。
- forwarding: process the packets base on routing,根據routing製作出來的table表,把封包傳送到指定的path。
### Alternative core: circuit switching
- Circuit switching
- 建立終端之間的連線
- 佔據線路直至通訊結束 => no sharing
- 傳統電話通訊網路,通常用於傳統電話 => 接線生
- 傳輸時針對多個User佔用資源的技術FDM versus TDM
- FDM 分頻多工
- TDM 分時多工
- 1. User2閒置,其他User不能用User2的Timeline

### Packet switching versus Circuit switching
| | 資源利用 | Congestion |
|:------- | ------------ |:------------------------------------------- |
| packet | 可以共用資源 | Excessive Congestion: packet delay and loss |
| Circuit | 一次只能一個 | 不會有Congestion |
### Internet Structure: network of networks
> 要怎麼把分佈在全球所有的Access network連接起來?
1. 先劃分區域,把該區域的所有Access network連接到當地的ISP
2. 每個ISP會通過Internet Exchange Point連接起來,橋接的線稱作peering link
3. 也可以把多個Access net連接到regional net,再連接到ISP,提高效率(Ex. 大學校園網路、公司內部網路、社區網路)
4. CDN (Content Delivery Network):
- 服務公司在世界各地架設該公司提供的伺服器
- 加速終端使用者下載、讀取資料

## 1.4 delay, loss, throughput in networks
### How do loss and delay occur?
- delay => 當前面的封包在處理時,等待被處理的時間就是 queueing delay
- loss => incoming rate > outgoing rate and buffer is fulled
### Four sources of packet delay
:::info
d~nodal~ = d~proc~ + d~queue~ + d~trans~ + d~prop~
:::
1. d~proc~ (nodal processing):
- determin output link 計算要出去的path的時間
- 只能換更好的router來加速d~proc~
2. d~queue~ (queueing delay):
- depends on congestion level of router 根據congestion的狀況,產生的delay時間
- 可以設計更好的演算法來加快queue的時間
3. d~trans~ (transmission delay):
- L(packet length(bits)) / R(link bandwidth(bps))
> bandwidth 指的是speed of changing 0 and 1
- 只能換更好的router來加速d~trans~
4. d~prop~ (propagation delay):
- depends on cable materials we used 速度是根據傳輸線使用的材質而定
- d(length of physical link)/s(propagation speed: 通常為光速)
### Queueing delay (revisited)
- R: link bandwidth (bps)
- L: packet length (bits)
- a: average packet arrival rate (per second)
:::info
- La/R ~ 0: avg. queueing delay small => 很通暢
- La/R = 1: avg. queueing delay large => 滿載,壅塞
- La/R > 1: more "work" arriving than can be servied, average delay infinite. 因為會發生loss,導致無法正確計算avg.
:::
### "Real" Internet delays and routes
- **traceroute** program: provides delay
- 會提供每個經過的router在transmit的delay時間
### Throughput
- 指於一通訊通道上單位時間能成功傳遞的平均資料量,單位通常表示為位元每秒(bit/s或bps)
- 兩種角度計算Throughput的
1. 短時間 instantaneous: rate at given point in time
2. 平均 average: rate over longer period of time
- Internet scenario
- per-connection end-end throughput: `min(Rc, Rs, R/10)`
- 現實層面,Rc或Rs通常是bottle neck

> Bottle Neck: 瓶頸,意思是在所有的通路中,傳輸速度最慢的路徑。
## 1.5 protocol layers, service models
## 1.6 networks under attack: security
## 1.7 history
## 重點整理
:::info
1.
2.
:::