# Chapter 1 Introduction
### 1.1 what isthe Internet?
+ What’s the Internet: “**nuts and bolts**”view
+ billions of connected computing devices:
+ hosts =end systems
+ running network apps
+ communication links
+ 材質 fiber, copper, radio, satellite
+ **transmission rate: bandwidth**頻寬
+ packet switches:
+ forward packets (chunks of data)
+ routersand switches
+ Internet:
+ “network of networks”
+ Interconnected ISPs(Internet Service Provider) : 主要的功能是要將你家裡的電腦與網際網路之間搭起連線的橋樑
+ protocol: 路上一種可以彼此溝通的模式
+ scontrol sending, receiving of messages
+ e.g., TCP, IP, HTTP, Skype, 802.11
+ Internet standards(STD): 關於網際網路相關的技術與方法論的技術規範
+ RFC: Request for comments
+ IETF: Internet Engineering Task Force
+ What’s the Internet: a **service** view
+ infrastructure that provides services to applications:
+ provides programming interface to apps
+ What’s a protocol?
+ all communication activity in Internet governed by protocols
+ protocolsdefine format, order of messages sent and received among network entities, and actions take non message transmission, receipt.
---
### 1.2 network edge
+ network structure
+ network edge:
+ hosts: clients and servers
+ servers often in data centers
+ network core:
+ interconnected routers
+ access networks, physical media:
+ wired, wireless communication links
:::info
+ Q: How to connect end systems to edge router?
+ residential access nets
+ institutional access networks (school, company)
+ mobile access networks
:::
+ Access network: digital subscriber line (DSL)
+ use existing telephone line to central office DSLAM(Digital Subscriber Line Access Multiplexer )
+ data over DSL phone line goes to Internet
+ voice over DSL phone line goes to telephone net
+ < 2.5 Mbps upstream transmission rate (typically < 1 Mbps)
+ 24 Mbps downstream transmission rate (typically < 10 Mbps)
+ 
+ Access network: cable network
+ HFC: hybrid fiber coax
+ network of cable, fiber attaches homes to ISP router
+ homes **share** access networkto cable headend
+ **DSL, which has dedicated access to central office**
+ 
+ Access network: home network
+ 
+ Enterprise access networks (Ethernet)
+ today, end systems typically connect into Ethernet switch
+ 
+ Wireless access networks
+ shared wirelessaccess network connects end system to router(via “access point”)
+ 
+ Host: sends packets of data
+ take app message
+ break in to small chunk known as packet of L bits
+ trans packet into access network at transmission rate R
+ link transmission rate, aka link capacity, aka link bandwidth
+ 
---
### 1.3 network core
+ The network core
+ mesh of interconnected routers
+ packet-switching: hosts break application-layer messages into packets
+ each packet transmitted at full link capacity
+ forward packetsfrom one router to the next, across links on path from source to destination
+ Packet-switching: store-and-forward
+ ==store and forward==: entire packet must arrive at router before it can be transmittedon next link
+ end-end delay = 2L/R (assuming zero propagation delay)
+ one-hop numerical example
+ L = 7.5 Mbits R = 1.5 Mbps
+ one-hop transmission delay = 5 sec
+ Packet Switching: queueing 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
+ 
+ Two key network-core functions
+ routing:
+ determines source-destination route taken by packets
+ by routing algorithms
+ forwarding:
+ move packets from router’s input to appropriate router output
+ for destination address in arriving packet’s header
+ Alternative core: circuit switching 電路交換
+ end-end resources allocated to, reserved for “call”between source & dest: 在兩通信端之間建立一條專用的 (dedicated) 實際路徑。
+ dedicated resources: no sharing
+ circuit segment idle 閒置 if not used by call (no sharing)
+ 直到通信結束之後,這條專用路徑才停止使用,並讓出供他人繼續使用。
+ used in traditional telephone networks
+ in diagram, each link has four circuits
+ 实时性强,时延小,交换设备成本低,但同时也会带来线路利用率低,电路接续时间长,通信效率低,不同类型终端用户不能进行通信等缺点。
+ Circuit switching: FDM versus TDM
+ 当发生拥塞等网络问题时, TDM 中的数据丢失可能只会是一部分,而FDM 中就可能是大部分或全部
+ FDM(频分复用Frequency Division Multiplexing):将整个传输频带划分为若干个频率通道,每个用 户占用一个通道。频率通道之间留有防护频带
+ TDM(时分复用Time Division Multiplexing):时间分割成小的时间片,每个时间片又分为若干个通道(时隙),每个用户占用一个通道传输数据。
+ 
+ Packet switching versus circuit switching
+ packet switching allows more users to use network!
+ excessive congestion possible: packet delay and loss
+ protocols needed for reliable data transfer, congestion control
+ packet switch is great for bursty 集送式數據 data
+ resource sharing.
+ simpler, no call setup
:::info
+ Q:How to provide circuit-like behavior?
+ bandwidth guarantees needed for audio/video apps
:::
+ Internet structure: network of networks
+ End systems connect to Internet via access ISPs (Internet Service Providers)
+ residential
+ company
+ university etc
+ Access ISPs(網際網路服務提供者) in turn must be interconnected互聯
+ 
+ 
+ at center: small # of well-connected large networks
+ tier-1”commercial ISPs(e.g., Level 3, Sprint, AT&T, NTT), national & international coverage
---
### 1.4 delay, loss, throughput in networks
+ How do loss and delay occur?
+ 封包queue in buffer
+ 因為packet arrival rate to link > output link capacity
+ 
+ Four sources of packet delay
+ 
+ dproc: nodal processing 節點處理延遲
+ 路由器**處理封包表頭(packet header)、檢查位元資料錯誤與尋找配送路徑等所花費的時間**。
+ check bit errors
+ determine output link
+ dqueue: queueing delay
+ 路由器因為某些因素無法立刻將封包傳送到網路上,造成**封包暫存在佇列(queue)中等待的時間**。
+ time waiting at output link for transmission
+ depends on congestion level of router
+ dtrans: transmission delay:
+ **網路卡將資料傳送到網路線上(或從網路線上接收)所花的時間**,與**網路設備的傳送速度**有關(如高速乙太網路傳送速度為 100Mbps)
+ L: packet length (bits)
+ R: link bandwidth (bps)
+ dtrans= L/R
+ dprop: propagation delay:
+ 封包在**網路線上傳輸**所花費的時間,與網路線上電子訊號跑的速度有關
+ d: length of physical link
+ s: propagation speed (~2x108m/sec)
+ dprop= d/s
:::info
#### hw1
+ 頻寬時延乘積(bandwidth-delay product) 稱頻寬延時乘積、頻寬延時積等
+ 指的是一個資料鏈路的能力(每秒位元)與來回通訊延遲(單位秒)的乘積。其結果是以位元(或位元組)為單位的一個資料總量,等同在任何特定時間該網**路線路上的最巨量資料量——已傳送但尚未確認的資料**。
+ **Propagation delay 乘上傳輸速率 = 該 link 會出現的最高 bits 數** **負載量**
+ bandwidth-delay product 即為在 link 中因為傳輸延遲可容納的 bits 數
+ 
+ 
+ width of a bit
+ 
+ 
+ 線的長度/線裡面的bit最高附載量(公式解)
+ a general expression
+ 
+ 假設傳輸速率可以改變 當傳輸速率是多少是 一個bit的寬度等同於線的長度
+ 
+ 
+ 
+ bit per second
+ 計算傳輸檔案要花多少時間
+ 一個大檔案
+ 
+ 
+ 分割小檔案
+ 
+ 一個送完才能送下一個 所以要回傳回來才知道可不可以傳下一個 因此dprop*2
+ 
+ 比較兩者差別
+ 
+ 傳輸檔案問題
+ 
+ 
+ without segementation
+ 
+ 到第一個router的時間
+ 
+ total time
+ 
+ with segement
+ 
+ 第一個packet到router的時間
+ 
+ 第一個到router後第二個才開始傳 第二個什麼時候才會傳完
+ 
+ total time
+ 
+ 
+ 傳完第一個是0.015 在這之後每0.05秒 一個packet傳到799個
+ 除了可以減少傳輸時間為什麼要用segementaion
+ 
+ 沒有分割要是有error整個大檔案都要重傳
+ segementation的缺點
+ 
+ 簡單來說浪費很多header
:::
+ traceroute
+ 
+ Packet loss
+ queue (aka buffer) preceding link in buffer has finite capacity
+ packet arriving to full queue dropped (aka lost)
+ 
+ Throughput
+ rate (bits/time unit) at which bits transferred between sender/receiver
+ instantaneous:rate at given point in time
+ average:rate over longer period of time
+ 
+ 
---
### 1.5 protocol layers, service models
+ Why layering?
+ modularization eases maintenance, updating of system
+ e.g., change in gate procedure doesn’t affect rest of system
+ Internet protocol stack
+ application:supporting network applications
+ FTP, SMTP, HTTP
+ transport:process-process data transfer
+ TCP, UDP
+ network:routing of datagrams from source to destination
+ IP, routing protocols
+ link:data transfer between neighboring network elements
+ Ethernet, 802.111 (WiFi), PPP
+ physical:bits “on the wire”
+ 
+ ISO/OSI reference model
+ presentation:
+ allow applications to interpret meaning of data, e.g., encryption, compression, machine-specific conventions
+ session:
+ synchronization, checkpointing, recovery of data exchange
+ 
+ Encapsulation
+ 
---
### 1.6 networks under attack: security
+ Bad guys: put malware 惡意軟件 into hosts via Internet
+ virus: self-replicating infection by receiving/executing object (e.g., e-mail attachment
+ worm: self-replicating infection by passively receiving object that gets itself executed
+ spyware malwarecan record keystrokes, web sites visited, upload info to collection site
+ infected host can be enrolled in botnet殭屍網路,used for spam. DDoS attacks
+ Denial of Service (DoS):
+ attackers make resources (server, bandwidth) unavailable to legitimate traffic by overwhelming resource with bogus traffic
+ select target
+ break into hosts around the network (see botnet)
+ send packets to target from compromised hosts
+ packet “sniffing ”:
+ promiscuous network interface reads/records all packets(e.g., including passwords!) passing by
+ 
+ IP spoofing:
+ send packet with false source address(fake addresses)
+ 
---
### 1.7 history
[reference link]https://webcache.googleusercontent.com/search?q=cache:NozW-PkuFCkJ:https://zhidao.baidu.com/question/743958922749448252.html+&cd=4&hl=zh-TW&ct=clnk&gl=tw
[reference link]ISP https://arcobaleno18.pixnet.net/blog/post/203574046
[reference link]認識惡意威脅:https://blog.trendmicro.com.tw/?p=5795
###### tags: `network`
`