TCP/IP Concepts
Internet 概念 m 使用 TCP/IP 通訊協定 m 全球性的網路 Internet TCP/IP UNIX 主機
什麼是 TCP/IP ? Transmission Control Protocol/Internet Protocol TCP/IP Model Application Layer Host-to-Host Transport Layer Internet Layer Network Access Layer
Application Layer Data Header Data Transport Layer DataHeader Internet Layer DataHeader Send Receive Network Access Layer 什麼是 TCP/IP ? (Cont.) 資料打包
Application Layer Transport Layer Internet Layer Network Access Layer message UDP stream segment datagram frame TCP packet datagram frame 資料結構 什麼是 TCP/IP ? (Cont.)
TCP/IP 協定 v.s.OSI 協定 OSI Reference Model TCP/IP Conceptual Layers Application Presentation Session Transport Network Data Link Physical Application Transport Internet Network Interface Ethernet, 802.3, 802.5,FDDI, etc.
TCP/IP Protocol Stack Application UDPTCP Network Interface Internet ARP,RARP ICMP
TCP/IP Protocol Stack Application Transport Internet Network Interface Host A Host B Identical message Identical paclet Identical datagram Identical frame Physical Net 1Physical Net 2 Gateway G
TCP/IP Protocol Stack Application Transport Internet Network Interface Conceptual Layer Hardware Objects Passed Between Layers Messages or Streams Transport Protocol Packets IP Datagrams Network-Specific Frames
Application Layer 簡介 Application Transport Internet Network Interface File Transfer -TFTP* -FTP -NFS -SMTP Remote Login -Telnet* -rlogin Network Management -SNMP* * Used by the router
Transport Layer 簡介 Application Transport Internet Network Interface Transmission Control Protocol (TCP) User Datagram Protocol(UDP )
Internet Layer 簡介 Application Transport Internet Network Interface Internet Protocol ( IP) Address Resolution Protocol ( ARP ) Reverse Address Resolution Protocol ( RARP ) Internet Control Message Protocol ( ICMP )
Network Interface Layer 簡介 Application Transport Internet Network Interface Ethernet/IEEE802.3 Token Ring/IEEE802.5 FDDI
網路存取層介紹
Physical and Data Link Standards Separate physical and data link layers for LAN and WAN Data Link ( frames ) physical ( bits, signals, clocking) LLC EthernetEthernet FDDIFDDI Dial on Demand SDLC HDLC X.25 Link Frame Relay ISDN PPP V.24 EIA/TIA-232 G.703 V.35 EIA/TIA-449 EIA-530 HSSI
LAN Data Link Sublayers Network LLC Data Link Physical MAC Logical Link Control Media Access Control MAC Frame LLC Packet or Datagram LLC refers upward to higher-layer software functions MAC refers downward to lower-layer hardware functions
Media Access Control (MAC) Vendor Code Serial Number 24 bits ROM RAM c MAC address is burned into ROM on a network interface card
區域網路的技術 Ethernet / IEEE802.3 Token Ring / IEEE802.5 FDDI
Ethernet / IEEE 網路拓撲 : Bus topology 存取方法 : CSMA / CD
Physical Layer : Ethernet/802.3 Hub PC Sun Mac Host 10BaseT - Twisted Pair 10Base2 - Thin Ethernet 10Base5 - Thick Ethernet
Ethernet /802.3 Operation Application Presentation Session Transport Network Data Link Physical Application Presentation Session Transport Network Data Link Physical A A B B C C D D D D B and C
Ethernet / Broadcast Application Presentation Session Transport Network Data Link Physical Application Presentation Session Transport Network Data Link Physical Application Presentation Session Transport Network Data Link Physical Application Presentation Session Transport Network Data Link Physical ABCD
Common WAN Technologies SDLC HDLC LAPB PPP X.25 Frame Relay ISDN
Physical Layer : WAN DSU/CSU RS-232 V.35 X.21 HSSI others (Modem) DTE Data Terminal Equipment End of the users device on the WAN link DCE Data Circuit-terminating Equipment End of the WAN providers side of the communication facility
Data Link Layer : WAN Protocols SDLC-Synchronous Data Link Control For IBM SNA networks;primary and secondary roles on link HDLC-High-level Data Link Control Default for Cisco Router-common WAN data link LAPB-Link Access Protocol,Balanced DTE-to-DCE data link for x.25;either side initiates a link Frame Relay-Simplified version of HDLC framing for higher speed,unacknowledged data communications PPP-Point-to-Point Protocol Part of TCP/IP stack for WAN links;can support ISDN (Modem) DSU/CSU
LAN-to-LAN Routing E1 Routing Table E0 Host Net 2,Host 5 Destination Network Outgoing Interface E0 T0 E Net 2,Host 5 Token Ring Host 5 to LANFrom LAN Network 1 T0 Network3 Network2
LAN-to-WAN Routing Token Ring Frame Relay From LAN to WAN to LAN Data Data Data Token Ring Data Data Frame Relay Data Data Ethernet Data A B
Layer Decapsulation telnettelnet FtpFtp SmtpSmtp tftptftp TCPUDP 617 IP Packets Frames Bits A TCP/IP Example UPPER LAYERS TRANSPORT NETWORK DATA LINK PHYSICAL Port Number Protocol Number TYPE,SAP,or Control Info MAC or WAN addressing
IP 協定介紹
TCP/IP Address Overview Unique addressing allows communication between end stations Path choice is based upon location Location is represented by an address Unix Host Company A
IP Addressing 32 Bits Network Host Bits 8Bits 8Bits 8Bits
IP Addresses Class A: Class B: Class C: N H H H N N N H N N H H N = Network number assigned by NIC H = Host number assigned by network administrator
IP Addresses (cont.) # Bits network # host # 1 0 network # host # network # host # Class A: Class B: Class C:
Recognizing Classes in IP Addresses (First Octet Rule) High Order Octet in Address Bits Decimal Class A B C
Broadcast Addresses (Directed broadcast) (Local network broadcast)
IP Datagram
HLEN: IP packet header 長度 Total length: IP packet 總長度 ( 包含表頭和資料區 ) Identification:IP packet 編號 Time to Live:IP packet 在網路上存留時間 ( 以秒為單位 ) Protocol: 上層的協定 17 ==> UDP 6 ==> TCP 1 ==> ICMP Padding: 補足未滿 32 位元的 IP header IP Datagram (Cont.)
Protocol Field TCP UDP 6 17 Transport Layer Internet Layer IP Protocol Numbers m Determines destination upper-layer protocol
ARP/RARP 協定介紹
m Map IP Ethernet m Local ARP I need the Ethernet address of I heard that broadcast, that’s me. Here is my Ethernet Address. IP : = ??? IP: = Ethernet: Address Resolution Protocol (ARP)
Host Y Broadcast ARP Request Host Z MAC ? Host Z Host z Broadcast ARP Request Host Z MAC ? Host Z Host Y MAC ARP Request Host Z MAC ? Host Y MAC ARP Request Router MAC ? Router A Example 1 : TCP/ IP destination local Example 2 : TCP/ IP destination local not local ARP finds the MAC address to use for a data link connection
Reverse ARP (RARP) m Map Ethernet IP m ARP and RARP are implemented directly on top of the data link layer Ethernet = IP = ??? Ethernet= IP = What is my IP address? I heard that broadcast. IP address is
TCP 協定介紹
Transport: 連線建立 RECEIVERSENDER Connection Established Synchronize Negotiate Connection Synchronize Acknowledge Data Transfer (Send Segments)
Send Segments with Flow Control RECEIVER SENDER Transmit Not Ready Ready Resume Transmission Stop Go Buffer full Process Segments Buffer OK
TCP Three-Way Handshake/Open Connection Host B Host A Receive SYN(seq = x) Send SYN (seq=y, ack=x+1) Receove ACK (ack=y+1) Send SYN (seq = x ) Receive SYN( seq=y, ack=x+1 ) Send ACK (ack = y+1)
TCP Segment 格式 #Bits 16 Source Port Dest Sequence Acknowledgment HLEN Reserved Code Port # # Bits Window Check- Urgent Option Data….. sum Pointer
TCP Port Numbers ……... SP DP Telnet Z Source Dest …. Port Port Host A Host Z Dest. port=23 Send packet to my Telnet application
TCP Sequence and Acknowledgment Numbers Source Dest. Sequence Acknowledgment Port Port # #... Source Dest. Seq. Ack Source Dest. Seq. Ack Source Dest. Seq. Ack I just sent # 10. I just got #10, now I need #11.
Port Numbers F T P T S D T S E M N F N L T S T M N P P P E T Application Layer TCP UDP Port Numbers Transport Layer
Currently assigned TCP port numbers
Bit (left to right) TCP Header Code field Meaning if bit set to 1 URG ACK PSH RST SYN FIN Urgent pointer field is valid Acknowledgement field is valid This segment requests a push Rest the connection Synchronize sequence numbers Sender has reaches end of its bye stream
TCP Simple Acknowledgment Window size = 1 Send 1 Receive ACK 2 Send 2 Receive ACK 3 Send 3 Receive ACK 4 Receive 1 Send ACK 2 Receive 2 Send ACK 3 Receive 3 Send ACK 4 SenderReceiver
TCP Sliding Window Send 1 Send 2 Send 3 Receive ACK 4 Send 4 Send 5 Send 6 Receive ACK 7 Window size = 3 Receive 1 Receive 2 Receive 3 Send ACK 4 Receive 4 Receive 5 Receive 6 Send ACK 7 Sender Receiver
Transport: Windowing SENDER RECEIVER Receive 1 Ack2 Receive 2 Ack3 Send 1 Send 2 Send 1 Send 2 Send 3 Receive 1 Receive 2 Receive 3 Ack4 Send 4 . Window size = 1 . Window size = 3
UDP 協定介紹
UDP Segment 格式 Source Destination Length Check- Data… Port Port sum # Bits mNo sequence or acknowledgement fields
A UDP datagram encapsulated in an IP datagram UDP HEADER UDP DATA AREA IP HEADER UDP DATA AREA FRAME HEADER FRAME DATA AREA
Currently assigned UDP ports