1. Three-time Handshake protocol
In the TCP/IP protocol, the TCP protocol provides a reliable connection service with a three-time handshake to establish a connection.
First handshake: When a connection is established, the client sends a SYN packet (SYN=J) to the server and enters the Syn_send state, waiting for the server to confirm;
Second handshake: The server receives the SYN packet, it must confirm the customer's syn(ack=j+1), and also send itself a SYN packet (syn=k), that is, the syn+ack packet, when the server enters the SYN_RECV state;
Third handshake: The client receives the server's Syn+ack packet, sends the acknowledgment packet ACK(ack=k+1) to the server, the packet is sent, the client and the server enter the established state, and the handshake is completed three times.
2. TCP/IP four layer
Application layer: Http,ftp,dns,telnet
Transport Layer: TCP,UDP
Network interconnect layer: IP
Network interface layer: Ethernet, WIFI, etc.
OSI seven-layer model
7 |
Application Layer |
such as HTTP, SMTP, SNMP, FTP, Telnet, SIP, SSH, NFS, RTSP, XMPP, Whois, ENRP |
6 |
Presentation Layer |
such as XDR, ASN.1, SMB, AFP, NCP |
5 |
Session Layer |
For example ASAP, TLS, SSH, ISO 8327/ccitt x.225, RPC, NetBIOS, ASP, Winsock, BSD sockets |
4 |
Transport Layer |
such as TCP, UDP, RTP, SCTP, SPX, ATP, IL |
3 |
Network layer |
such as IP, ICMP, IGMP, IPX, BGP, OSPF, RIP, IGRP, EIGRP, ARP, RARP, x. |
2 |
Data Link Layer |
such as Ethernet, Token Ring, HDLC, Frame Relay, ISDN, ATM, IEEE 802.11, FDDI, PPP |
1 |
Physical Layer |
such as line, radio, optical |
3. IP Address classification
IP address is a four-segment eight-bit binary number, IP is divided into a,b,c,d,e five types of address
Class A high-end for 0, from 1.x.y.z-126.x.y.z;
Class B high-end for 10, from 128.x.y.z-191.x.y.z;
Class C high-end for 110, from 192.x.y.z-223.x.y.z;
Class D High-end 1110 is the reserved IP address;
Class E high-end 1111, is the IP address for scientific research
Where 255 is the broadcast address and 127 is the internal loopback function
4. Knowledge of subnet masks
IP Address: your physical IP addresses;
SUBNET Mask: The meaning of "subnet mask"
Default gateway: defaults to gateways;
What is a subnet mask
You must know something about the IP address, right? We know that the TCP/IP protocol that is widely used in the Internet is to differentiate between different hosts by using IPs. If you've ever had a TCP/IP protocol set up, then you're bound to encounter the term subnet mask (subnetmask), so do you know what a subnet mask is? What role does it have?
We know that the IP address is a 4-byte (total 32bit) number, divided into 4 segments, 8 bits per segment, and periods separated by a period. For ease of expression and recognition, the IP address is expressed in decimal form such as 210.52.207.2, each paragraph can represent the maximum number of decimal not more than 255. The IP address consists of two parts, the network number (Netgworkid) and the host number (HostID). The network number identifies a subnet on the internet, and the host number identifies a host in the subnet. The decomposition of the Internet address into two domains brings an important advantage: When an IP packet arrives from one network to another, the selection path can be based on the network instead of the host. This advantage is particularly noticeable in large networks because the routing table stores only network information rather than host information, which can greatly simplify the routing table. The IP address is divided into a, B, and C three classes based on the number of network and host numbers:
Class A IP address: Use 7-bit (bit) to identify the network number, 24-bit identification of the host number, the first one is "0″, that is, the Class A address is a value between 1~126." A Class A address is typically provided for large networks, with a total of only 126 possible class A networks, each of which can connect up to 16777214 hosts per Class A network.
Class B IP address: Use 14 bits to identify the network number, 16 bits to identify the host number, and the previous two bits are "10″." The first paragraph of the Class B address is between 128~191, and the first and second paragraphs together represent the network number. Class B addresses are available for medium-sized networks, with around 16,000 class B networks worldwide, and each class B network can connect up to 65534 hosts.
Class C IP address: Use 21 bits to identify the network number, 8 bits to identify the host number, and the previous three bits are "110″." The first paragraph of the Class C address has a value between 192~223, the first, second, and third paragraphs together to represent the network number. the last segment identifies the host number on the network. Class C addresses are suitable for small networks such as campus networks, and each class C network can have up to 254 hosts.
From the above introduction we know that the IP address is the network number and host number to indicate the host on the network, only in a network number under the computer can be "direct" interoperability, different network number of the computer to be through the gateway to exchange. But such a division appears and is very inflexible in some cases. For this reason, the IP network is also allowed to be partitioned into smaller networks called subnets (Subnet), which creates a subnet mask. The function of the subnet mask is to determine whether any two IP addresses belong to the same subnet, when only the computer on the same subnet can be "directly" interoperable. So how do you determine the subnet mask?
In front of the Ip address sub-network number and host number, to divide a network into multiple subnets, so the network number will occupy the original master, such as for a class C address, it uses 21 bits to identify the network number, to divide it into 2 subnets will need to occupy 1 bits of the original host identity bit. At this point the network number bit becomes 22 bits and the host label becomes 7 bits . similarly borrowing 2 host bits can divide a class C network into 4 subnets ... How does the computer know if the network is divided into subnets? This can be seen from the subnet mask. The subnet mask is as 32bit as the IP address, and the subnet mask is determined by using "1″" for all corresponding bits that identify the network number in the IP address, and the corresponding bit to the host number is 0″. such as a Class C IP address divided into 2 subnets with 22 bits to identify the network number, its subnet mask is: 1111111111111111 1111111110000000 is 255.255.255.128. So we can see that the default subnet mask for Class A addresses is the 255.0.0.0,b class of 255.255.0.0,c class 255.255.255.0. The following table is the Class C address subnetting and related subnet masks:
Number of subnet-subnet-netmask hosts available hosts
1 255.255.255.128 128 126
2 255.255.255.192 64 62
3 255.255.255.224 32 30
4 255.255.255.240 16 14
5 255.255.255.248 8 6
6 255.255.255.252 4 2
You may notice that the table above is divided by the number of hosts and the number of hosts available two , which is why? because, when all host bits of the address are "0″", this address is the line (or subnet) address, and when all host bits are "1″" is the broadcast address (255).
We can also use a variable-length mask (VLSM), which means that a network can be configured with a different mask. This is done to make it easier to divide a network into multiple subnets. In the absence of VLSM, a network can use only one subnet mask, which limits the number of hosts in the given subnet number condition. For example, you are assigned a class C address that has a network number of 192.168.10.0, and you now need to divide it into three subnets, one of which has 100 hosts, and two hosts for the rest of the seven subnets. We know that a class C address has 254 available addresses, so how do you choose a subnet mask? From the table above, we find that this problem cannot be solved when we use a subnet mask in all subnets. At this point vlsm comes in handy, we can use the 255.255.255.128 mask on the subnet of 100 hosts, which can use 192.168.10.0 to 192.168.10.127 128 IP addresses, where the host number is 126. We'll take the rest of the 192.168.10.128 to 192.168.10.255. The 128 IP addresses are divided into two subnets with a subnet mask of 255.255.255.192. The address of one of the subnets is from 192.168.10.128 to 192.168.10.191, and the address of the other subnet is from 192.168.10.192 to 192.168.10.255. The subnet mask for 255.255.255.192 has 62 available host addresses for each subnet, which is required. It can be seen that the reasonable use of the subnet mask can make the IP address easier to manage and control.
(1) First, each host establishes an ARP list in its own ARP buffer to represent the correspondence between the IP address and the MAC address.
(2) When the source host to send data, first check the ARP list for the corresponding IP address of the destination host MAC address, if there is, then send data directly, if not, send ARP packets to all hosts of this network segment, the packet includes: source host IP address, source host MAC address, The IP address of the destination host.
(3) When all hosts on this network receive the ARP packet, first check whether the IP address in the packet is its own IP address, if not, ignore the packet, if it is, first remove the source host's IP and MAC address from the packet is written to the ARP list, if it already exists, overwrite, Then write your MAC address to the ARP response packet and tell the source host that it is the MAC address it wants to find.
(4) After the source host receives the ARP response package. Writes the IP and MAC addresses of the destination host to the ARP list and uses this information to send the data. If the source host has not received an ARP response packet, it indicates that the ARP query failed.
TCP/IP Related summary