Please describe the seven-layer network model
The physical layer, data link layer, network layer, transport layer, session layer, presentation layer, application layer
1) physical layer: using a physical transmission medium is connected to the data link layer, transparent transmission bit stream
2) Data Link Layer: various control protocols, the physical channel errors become error-free, reliable data link capable of transmitting the data frame
3) The network layer provides routing and addressing functions, so that the two end systems can be interconnected and determine the best path, and the ability of certain congestion control and flow control.
4) Transport Layer: provides reliable end to end flow control and error to the user, ensure the correct transmission of data packets. Role of the transport layer is to shield the details of the underlying data to the communication level, namely the user packets transparently
5) Session Layer: task is to provide a method and used to establish connections to the presentation layer of the two entities.
6) Presentation Layer: its commands and data from the application layer interprets the various grammatical meaning given appropriate, and according to a certain transmission format to the session layer
7) application layer: Application layer service and protocol provided by the user are: file services, directory services, file transfer services (FTP), remote login service (Telnet), e-mail service (E-mail), print services, security services , network management services, database services, etc.
Does ping work in which floor, how many ports?
through ICMP ping, work in the network layer, no ports. It is based on transport layer port.
The difference between the network layer and transport layer?
- The network layer provides communication services to different hosts, and the transport layer provides communication services for different applications in different hosts
- The network layer header packets only for error detection, and the entire transport layer packet error detection
Each layer of the protocol is as follows:
Physical layer: RJ45, CLOCK, IEEE802.3 (repeaters, hubs)
Data Link: PPP, FR, HDLC, VLAN, MAC (bridges, switches)
Network layer: IP, ICMP, ARP, RARP, OSPF, IPX, RIP, IGRP, (router)
Transport Layer: TCP, UDP, SPX
Session layer: NFS, SQL, NETBIOS, RPC
Presentation Layer: JPEG, MPEG, ASII
Application Layer: FTP, DNS, Telnet, SMTP, HTTP, WWW, NFS
Please describe the three-way handshake and fourth wave?
The first handshake: connection is established, the client sends syn packets (syn = j) to the server, and enters the SYN_SENT state, waiting for the server to confirm; the SYN: synchronization sequence number (Synchronize Sequence Numbers).
Second handshake: server receives syn packets, must confirm the customer SYN (ack = j + 1) , while themselves sends a SYN packet (syn = k), i.e., SYN + ACK packet, then the server enters a state SYN_RECV;
Third handshake: the client receives the SYN + ACK packet to the server, the server sends an acknowledgment packet ACK (ack = k + 1) , this packet is sent, the client and server into the ESTABLISHED (TCP connection succeeds) state, complete the three handshake.
Complete three-way handshake, the client and the server begins transmitting data, in the process, there are some important concepts:
No connection queue
In the three-way handshake protocol, the server is not connected to maintain a queue, the team as each client's SYN packet (syn = j) creation of an entry, the entry indicates that the server SYN packet has been received, a confirmation to the customer, the customer is waiting the acknowledgment packet. These entries are connected to the server identified in SYN_RECV state, when the server receives the client's confirmation packet, delete the entry, the server into the ESTABLISHED state.
Four waving
Closing a TCP connection: Improved three-way handshake
For a connection has been established using a modified TCP three-way handshake to release the connection (using a FIN with the marked segment). Step closing TCP connections as follows:
The first step, when the application notifies the host A is TCP data has already been sent, sending TCP FIN segment with a tag attached to the host B (FIN represents English finish).
The second step, after the host B receives the FIN segment does not immediately respond to the host with a FIN segment A, but sends an acknowledgment ACK sequence number Xianxiang host A, while notifying its own corresponding application: Partner Close connection (first object is to prevent transmission of ACK during this time, the other FIN segment retransmission).
The third step, the application host B told TCP: I want to completely close the connection, TCP sends a FIN segment to the host A.
A fourth step, the host A receives the FIN segment, transmits ACK to the host B represents a complete release of the connection.
Why use three-way handshake, the two can not I?
ip route commonly used method:
Add a default route: ip route add default via gateways
Add the target host routes: ip route add the target host via a gateway
Add destination network routing: ip route add destination network / mask Gateway
Empty Routing Table: ip route flush
To delete a route: ip route to find this route, the entire line of copy , ip route del this line
Check the link status: ip link
Check the specified card information: ip addr show device
Start the interface: ip link set up the card name
Disable Interface: ip linl set down the card name
To add a ens33 IP: ip addr add 1.1.1.1/8 dev ens33
Delete IP: ip addr del 1.1.1.1/8 dev ens33
Increase the NIC Alias: ip addr add 3.3.3.3/24 dev lo label lo: 1
Delete Alias: ip addr del add 3.3.3.3/24 dev lo label lo: 1
Restart the network:
CentOS6: service network restart (Special: service NetworkManager restart try to turn it off, it and network conflict)
CentOS7: systemctl restart network