Basic knowledge of TCP/IP

Source: Internet
Author: User
Tags traceroute command

TCP/IP basic Knowledge Network TCP/IP Introduction

This article is the basic knowledge of TCP/IP protocol, focusing on the content of TCP/IP protocol cluster, the role of TCP, UDP, IP three common network protocols related to the basic knowledge.

content

The TCP/IP protocol cluster is developed by the OSI seven layer model, and there are several advantages to the OSI Interconnect Reference Model:
1, to solve the problem of interconnection of the equipment of different manufacturers: that is, compatibility considerations;
2, the hierarchical structure of the independence of strong, strong scalability;
3, unified standards can facilitate learning;

TCP/IP model
The relationship between the TCP/IP model and the OSI model is as follows:

Comments

1, the application layer: With the OSI application layer, presentation layer, session layer, the main role is to provide users with access to the application of the network interface;
2, the Transport layer: Also known as host to the host layer, and the OSI transport layer corresponds to, specified the control Network layer protocol, defines the data transmission mode is TCP or UDP, the establishment of two devices end-to-end connection, transport layer and data link layer have defined the flow control and error control mechanism, The difference is that the data Link layer protocol emphasizes the control of traffic on the data link, that is, the physical media traffic that connects two devices, while the transport layer controls the traffic on the logical link, that is, the end-to-end connection of the two devices, which may span a chain of data links;
3, the network layer: defines the packet format and address format, the main role is IP addressing and routing.
4, Access layer: Including the data link layer and the physical layer, the data link layer defines how to access and share media, how to identify the device on the media is a two-layer addressing (MAC address) and how to complete the data frame before sending data on the media, the common two-layer protocol is: Ethernet, PPP, HDLC, Frame Relay, ATM, etc. The physical layer defines a physical medium-related protocol: the Electronic/Optical protocol (voltage, light intensity, coding, signal Waveform) mechanical protocol (dimensions, metal components of conductors) functional protocol (description of what to do) procedural protocol (describes how to do this: 1 indicates a voltage less than -3v)

TCP protocol

Explain

Transmission Control Protocol (TCP): a reliable, connection-oriented service. That is, it provides a connection that is similar to a point to dot.

Mechanism

1, the use of serial numbers to mark the packet;
2, the use of confirmation, calibration and timer system and retransmission mechanism to provide reliability;
3. The sliding window mechanism adjusts the traffic of the packet: reduces the possibility of losing packets due to the receiver buffer being full.

Message

Comments

1. Source Port and Destination port: Each length is 16 bits, the source and destination application is specified for the encapsulated data, and the port number of the application plus the IP address of the host where the application is located is collectively called the socket. The network socket is uniquely identified for each application.
(Supplement: Common port number corresponding to the service: FTP:TCP21; telnet:tcp23; SMTP:TCP25; bgp:tcp179; DNS:TCP/UDP53; tftp:udp69; snmp:udp161; rip:udp520;)
2. Serial Number: The field length is 32 bits, which determines the location of the encapsulated data in the data stream sent by the sender;
3, the confirmation number: The length is 32 bits, determined the source point next time expects to receive from the target serial number, implicitly confirms receives this number the last packet;
4, Header length: 4 bits in length, specifies the length of the header in 32-bit words.
5, Reserved: 4 bits in length, usually set to 0;
6, Mark: 8 bit, for flow and connection control. From left to right in turn are: CWR, ECE, URG, ACK, PSH, RST, SYN, FIN;
7, Window Size: field length 16 bits, mainly used for flow control. The window size indicates the size of the receiving buffer;
8, Checksum: the length of 16 bits, the header and the encapsulated data to verify;
9. Emergency pointer: Used only when the Urg mark is placed. 16 bits are added to the serial number to indicate the end of the emergency data;
10, Optional: Used to indicate the TCP send process requirements of the option, the most commonly available option is the maximum segment length, to inform the recipient sender is willing to receive the maximum segment length, in order to ensure that the length of the message is a multiple of 32 eight-bit groups, use 0 to populate the remaining parts of the field.

UDP protocol

Explain

User Datagram Protocol (UDP): is a non-connected, best-effort data forwarding service.

Advantages

Not taking the time to establish a connection, send data directly, that is, the cost is small, you can send small data volume of the application to achieve better performance advantages.

Message

Comments

1. Source port and Destination port: 16 bits each, specifying source and destination applications for encapsulated data
2, UDP Length: The length of the whole segment in the eight-bit group, including the total length of the data segment;
3, Checksum: Length of 16 bits, checksum is optional field, not used when all set to 0

IP protocol

Explain

IP: The most common network layer protocol, is an unreliable, best-effort forwarding, can be combined with four layer and two layer to ensure reliable transmission of data;

IP Addressing

1, IP address length of 32 bits, dotted decimal notation, used to identify the logical address of the device; The IPV4 address includes both the network number and the host number, and the network number uniquely identifies a physical link or logical link, and the host number uniquely identifies the specific device connected on that link. This hierarchical approach to address design helps to quickly find, maintain, and save addresses;
Add: Subnet mask: Network bit is all 1, host bit is all 0, by continuous 1 and continuous 0 composition
broadcast address: The network bit is unchanged, the host bit is all 1.
Network number: The network bit is unchanged, the host bit is all 0.
2, IPV4 address classification:
Class A: First bit fixed is 0, 1 to 126, subnet mask 255.0.0.0
Class B: The first two are not fixed to 10,128 to 191, subnet mask 255.255.0.0
Class C: first three bits fixed to 110,192 to 223, subnet mask 255.255.255.0
Class D Address: The first four bits are fixed to 1110,224 to 239, multicast address, no subnet mask;
Class E Address: The first four bits are fixed at 11110,240 to 255 for scientific research and retention.
Special Address: Address not available, Include: Local loopback address: 127.0.0.1; Local link address: 169.254 begins with a subnet mask of 255.255.0.0; Network address: That is, the network bit is unchanged, the host bit is 0 address; broadcast address: Network bit is unchanged, the host bit is 1, can be transmitted on three layer devices; Restricted broadcast address: Network and host bits are all 1 The 255.255.255.255, which terminates at layer three devices (routers).
private Address: From the public address to extract some address as a private address, private address will not be allocated, can not be used in the network, in order to communicate in networks, must be combined with NAT, the private network address to the public address conversion;
a similar to have address: 10.0.0.0 to 10.255.255.255
Class B Private Address: 172.16.0.0 to 172.31.255.255
Class C Private address: 192.168.0.0 to 192.168.255.0
3, Sub-network division and subnet summary
Subnetting : The variable-eldest-son netmask of the main-class network is divided; How to use: borrow;
Subnet Summary: To summarize multiple network addresses into one network address; method: Take the same bit, go to different bits;

Message

Comments

1, Version: 4 bits, 0100 means ipv4,0110 represents IPV6.
2. Header length: 4 bits, which indicates the length of the IP header for 32 bits of length. The minimum IP packet length is 20 bytes and can be extended to 60 bytes (15*4).
3, the service type TOS:DSCP6 bit +ECN2 bit 6-bit DSCP can define up to 64 different service classes, ecn=11 indicates congestion display, the TOS field in the IP header is reserved, generally used in QoS to set the priority of the message;
4, the total length: 16 bits, using the IP packet length minus the IP header length, you can determine the size of the data payload. The maximum IP packet length is 65535;
5, identifier: 16 bits in length, usually used with the tag field and the Shard offset field for the fragment of the packet. If the original length of the packet exceeds the maximum transmission unit of the data link to be passed by the packet, it is necessary to fragment processing of the packet, and the device will mark the identity field of each packet of the Shard so that the receiving device can recognize the segment belonging to a packet;
6, Mark: Length is 3 bits, reserved bit, no division (DF), more division (MF); If df=1 indicates that the router cannot fragment the packet, mf=0 represents the last fragmented message;
7. Shard Offset: 13 bits in length, in 8-bit group, to indicate the offset of the starting point of the segment relative to the starting point of the message, so that the receiver can reorganize the packet in the correct order;
8, time-To-Live (TTL): 8-bit, when the packet is transmitted along the router one by one, the TTL will be reduced by 1, when ttl=0, the router will discard the packet and send an error report to the source point, this method can prevent the packet from being transported without stopping, the proposed default is 64 ; You can use the traceroute command to view the routers that pass through the packet transmission;
9, protocol: 8-bit, specifies the type of information in the packet. Common protocol number: 1-ICMP;6-TCP;17-UDP;47-GRE;88-EIGRP;89-OSPF;
10, the head checksum: 16 bits, does not contain the encapsulated data part, because the TTL decreases in the transmission process, therefore each router must recalculate the checksum;
11. Source Address and Destination address: 32-bit IP address;
12. Optional: variable length fields, including information generated by source points and other router-joined information, commonly used for testing, common optional fields are: Loose source routing, strict source routing, record routing, timestamp;
13, padding: By adding a 32-bit after the optional field, ensure that the header length is 32-bit integer times;

Recommended Readings
    • The first volume of TCP/IP routing technology

Basic knowledge of TCP/IP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.