CH2: Network Model
- Protocol Layering
- 定義通訊上的規則
- A protocol defines the rules that both the sender and receiver and all intermediate devices need to follow to be able to comunicate effectively
- Same layers do the same thing (同一層做相同/相似的事)
Difference between TCP/IP Model and OSI Model
- TCP/IP model has four different layers:
- (對照到OSI Model)
- Application(Application+Presentation+Session)
- HTTP、FTP、TELNET、NTP、DHCP、PING
- Transport(Transport)
- Network(Network)
- Network Interface(Data Link + Physical)
- Ethernet、Fiber、Routers、Switches
How to make communication approach?
- Cross layer en-capsulation and de-capsulation
- 把上層送來的內容當成自己這層的payload再加上自己這層的header後包在一起往下層送
- 收到下層送來的整包內容後先拆解掉屬於自己這層的header再把payload往上層送
- 因此header會在過程中不斷被修改
TCP/IP Protocol Suite(僅列重點,詳細看講義)
Physical Layer
- Data format: bit
- Major duties:
- topology
- simplex、 half-duplex、full-duplex
- direction of data flow…etc
Data Link Layer
- Data format: frame
- Major duties:
- Framing and tagging
- 可以僅讓擁有特定tag的通過
- 增加tag到frame header中,可將第二層各內容進行分割
- MAC Address(header)
- Switching
- Address Resolution Protocol(ARP)
- Find the link layer (physical) address of the device(找MAC位置)
- 一開始以廣播方式尋找目的地之MAC位置
- switch有紀錄功能,所以可依特定路徑傳送frame
Network Layer
- Data format: datagram (packet,封包)
- Major duties:
- IP address
- Routing (連接不同的子網路/網段)
- Find the next hop
- Internet Protocol(IP位置)
- 路由器可透過路由協定去學習封包如何前往其他網域的路徑,並在自身維護一個路由表紀錄Next-hop資訊供IP routing所使用
- 封包IP位置不在路由表內則被丟棄
- 和自己不同子網域的IP電腦溝通需要依靠Layer IP routing
Transport Layer
- Data format: TCP segment / UDP datagram
- Major duties:
- Service port mapping
- Connection (TCP) or connectionless (UDP)
- Flow control
- Error control
- Retransmission
- Some Important Number
- FTP: 20、21
- SMTP: 25
- DNS: 53
- HTTP: 80
- SSH: 22
- TELNET: 23
- DHCP: 67
- Details of each transmission protocol
- Transmission Control Protocol (TCP)
- Reliable-connection
- Btye-oriented
- Retransmission
- User Datagram Protocol (UDP)
- Unreliable-transmission
- Message-oriented
- Stream Control Transmission Protocol (SCTP)
- Reliable-connection
- Message-oriented
- Combine the best features of TCP and UDP
Application Layer
- Data format: Message
- Common protocols: HTTP、FTP、SMTP…etc
Multiplexing and De-multiplexing
- Message to Packet -> Multiplexing
- Packet to Message -> De-multiplexing (還原訊息)
- 依照目的地傳送封包
- 大訊息可能被拆成數個封包進行傳送
OSI Reference Model
- PDU (Protocol Data Unit)
- ex. Data、Segement/Datagram、Packet、Frame、Bit/Symbol
- SDU (Service Data Unit)
- PDU = SDU (payload) + Protocol Header
- At the layer N, the SDU will be added “layer N header” to produce a layer N PDU. After that, it will be passed to layer N-1.
- This process continues util reaching the layer 1.