<title>TCP and IP</title> TCP and iptable of Contents
- OSI Layer 7
- Application layer, APDU, and user interaction
- Presentation layer, PPDU
- Session layer, SPDU
- Transport layer, TPDU
- Network layer, message
- Data link layer, frame
- Physical layer, bit
- Classification and private IP
- Gateway Gateways
- Package Encapsulation
- Decomposition demultiplexing
- Customer-Server model
- Link Layer
- IP messages
- Links to TCP
OSI 7 Layer Application layer, APDU, and user interaction
User interface, User services, such as browser
Presentation layer, PPDU
Convert user-recognized data into a computer-recognized language (binary)
Encryption, compression
Session layer, SPDU
Corresponding session management, synchronization (determine if network delivery is required), if not required to save to disk, do not need to the transport layer
Transport layer, TPDU
TCP Reliable
UDP fast, unreliable
Decide to use TCP,UDP
Error detection
Determine the port number: Determine the service, such as WWW (80), receive FTP (110), send mail (25)
TCP Packet packet: Message segment
UDP Packet packet: Datagram
TCP and UDP can also be referred to as message segments
TCP: Blocking controls (congestion control)
Prevents any TCP link from flooding the link and switching devices between communication hosts with excessive traffic
Equal Share network link broadband
UDP: Non-adjustable, non-adjustable possible problems
UDP in multimedia applications, if everyone starts streaming high bit rate without any congestion control, routers have a large number of packet overflow, so that almost no UDP packet can be successfully transmitted through the source to the destination path
If it is TCP protocol, it can be effectively congested.
Network layer, message
IP address, IP address of the sender, IP address of the pickup
The path has a number of bars, determines the transmission path, through which nodes, the router
IP protocol, Internet protocol, unreliable, sending packets from the source IP to the destination IP
ICMP protocol, Internet Internet Control Message Protocol (ping)
IGMP Protocol, Internet Group Management Protocol
Data link layer, frame
Framing, packaging, MAC address of the sender, MAC address of the pickup, error detection and correction
MAC address for LAN communication only, not for WAN
Address Resolution Protocol: ARP protocol
ARP: translates IP address into network card address (MAC address)
Physical layer, bit
The device driver and the network interface card in the computer. (Handling physical interface details), Ethernet protocol
Pass data to others
Receive data that someone else has sent
Classification and private IP
1.0.0.0--126.255.255.255127.0.0.1128.0.0-- 191.255.255.255192.0.0 --223.255.255.255
10.0.0.0--10.255.255.255172.16.0.0-- 172.31.255.255192.168.0.0--192.168.255.255
Gateway Gateways
MAC: NIC Hardware address, 48-bit, LAN communication
The switch does not know the IP, only the MAC (link layer), the switch network, the same network segment
Gateways: Routers, which are used to access different network segments
Package Encapsulation
The application uses TCP to transmit data, and the data is fed into the protocol stack, passing through each layer one after the other until it is sent to the network as a stream of bits.
Each layer adds some header information to the data received (there may be trailer information).
TCP-to-IP data units are referred to as TCP packet segment, UDP-transmitted data is called a UDP datagram, and UDP datagram
The data unit that IP transmits to the network interface layer is called IP datagram datagram
Bit streams transmitted over Ethernet are called frame frames
User Data--TCP message--IP datagram--Ethernet frame
Decomposition demultiplexing
When an encapsulated Ethernet data frame is received, the data begins to rise from the bottom of the protocol stack, removing the added headers
Customer-Server model
Recurring server:
- Waiting for the arrival of a customer request
- Process Customer Requests
- Send a response to the customer who sent the request
- Waiting for the arrival of a customer request ... Repeat
The disadvantage is that when the server processes a customer request, it cannot wait for a customer request to arrive.
and hairstyle server:
- Waiting for the arrival of a customer request
- Start a new server to process the client's request while concurrently waiting for the customer's request
Link Layer
- Sending and receiving IP datagrams for IP modules
- Sending ARP requests and receiving ARP responses for the ARP module
- Send RARP request and receive RARP response for RARP
IP messages
Suppose we want to send a bunch of data, first encapsulated into TCP packets, mainly used to determine the port number, the TCP message is encapsulated into the IP report
The maximum length of an IP datagram is 2^16-1 = 65535 (bytes)
Data portion of the TCP segment = maximum IP datagram length-ip header of the datagram-tcp message segment = 65535-20-20 = 65495 (bytes)
MTU: If the IP packet is too large, greater than the MTU (default 1500), then the IP message will be split again, and then routed forward
Links to TCP
C:client
S:server
Three-time handshake
- C sends a SYN signal to S that I want to access your
- S sends an ACK acknowledgement to C and sends a SYN to ask if C is ready.
- C sends an ACK acknowledgement to S
C---> S (SYN) Status: SYN_RCVDC <---s (ack + SYN) Status: Syn_sentc---> S (ACK) status: Established
Wave 4 times
- C sends a FIN to S that says I want to close
- S sends an ACK to C
- S sends a FIN to C, which means I have to close
- C sends an ACK acknowledgement to S
c---> S (FIN1) status: There are two status fin_wait_1 (appearing before C accept), fin_wait_2c <---s (ACK) Status: TIME_WAITC <---s (FIN2) c7/> Status: CLOSE_WAITC---> S (ACK) Status: Last_ack
TCP and IP