Computer Network interview focused on the essential knowledge

Classification of IP addresses, how to divide, and will address all kinds of support to calculate the number of hosts

  1. Class A addresses: the first is 0,1.0.0.1 ~~ 126.255.255.254; host No. 24
  2. Class B addresses: the first is 10,128.0.0.1 ~~ 191.255.255.254; host No. 16
  3. Class C addresses: the first is 110,192.0.0.1 ~~ 223.255.255.254; host No. 8
  4. Class D address (multicast address, also known as multicast address): the first is 1110,224.0.0.1 ~~ 239.255.255.254
  5. Class E addresses: This address is reserved, for the first 11110,240.0.0.1 ~~ 254.255.255.254

In which each layer is formed using data switching device

Here Insert Picture Description

  1. Gateway: an application layer, a transport layer (transport layer gateway to implement a network interconnection, the interconnection network is the most complicated set
    . Apparatus, only two different high-level interconnect structure gateway protocol network routers and the like are also, except that the
    interconnect layer may be a gateway for interconnecting a wide area network, LAN interconnection may also be used)
  2. Router: a network layer (routing, store and forward)
  3. Switch: data link layer, the network layer (MAC address information identifying the data packet, the MAC address into the
    row forwards, and these ports and the corresponding MAC address recorded in an address of its own internal table)
  4. Bridges: the data link layer (LAN connect the two together, the MAC address forwarding frame)
  5. Hub (Hub): physical layer (pure hardware, primarily used to connect a computer network terminal, etc.)
  6. Repeater: a physical layer (regenerating and retiming network signals at the bit level, making them capable of
    transmission over a longer distance network)

Detailed functions of the individual layers

Here Insert Picture Description

  1. Application layer (data): the process of determining the nature of the communication between the user needs to meet and provide a network and a user application
  2. Presentation layer (data): mainly to solve the problem of information support grammar express, such as encryption and decryption
  3. Session layer (data): providing a access authentication and session management, including the establishment and maintenance of communication between the application machine
    system, such as server authenticates the user login is completed by the session layer
  4. Transport layer (para): data communication between the host network users on different processes, reliable
    and unreliable transport, the transport layer error detection, flow control, etc.
  5. Network layer (Package): providing a logical address (the IP), routing the data from the source to the destination of
    the transmission
  6. Data link layer (frame): the upper layer data encapsulated in a frame, accessible medium, error detection and correction MAC address
  7. The physical layer (bit stream): transfer, a physical interface, a bit stream between electrical properties and the like devices

The respective protocol stack layer

Here Insert Picture Description
Here Insert Picture Description

Here Insert Picture Description

ICMP packet classification?

ICMP is divided into two categories, one category is ICMP query messages, the other is the ICMP error messages.
Here Insert Picture Description

Why should shake hands three times, four times and waved

3-way handshake
Here Insert Picture Description
Suppose client A, B is the server.

  • First, B is the LISTEN (listen) state, waiting for a client connection request.

  • A B sends a connection request packet, SYN = 1, ACK = 0, choose an initial sequence number of x.

  • B receives the connection request packet, if you agree to establish a connection, sending a connection confirmation packet, SYN = 1, ACK = 1, confirm the number x + 1, and also choose an initial number y to A.

  • A B receives the connection acknowledgment message, it should send a confirmation to B, confirmed number y + 1, sequence number x + 1.

  • A B After receiving confirmation of connection establishment.

3-way handshake: third handshake is to prevent failure of the connection request arrives at the server, the server to open a connection error.

  • Connection requests sent by the client if the stay in the network, it will be separated for a long time to receive the connection confirmation server sent back. The client waits for a time after the retransmission timeout, the request will be re-connected. But the retention of the connection request will eventually arrive at the server, if not three-way handshake, the server will open two connections. To stay connected to the connection request confirmation if third handshake, the client ignores the server sent no third handshake, so it will not open the connection again.

4th wave
Here Insert Picture Description
The following description does not discuss the sequence number and acknowledgment number, and serial number as an acknowledgment number of rules is relatively simple. ACK and not discussed, since the connection is established after the ACK is 1.

  • A transmission connection release message, FIN = 1.

  • B, after receipt of a confirmation, then TCP semi-closed state, but the transmission data B can not send data A to B to A.

  • When the connector B is no longer needed, transmits a connection release message, FIN = 1.

  • A sent the acknowledgment is received into the TIME-WAIT state, to release the connection after waiting for 2 MSL (maximum survival time packet).

  • After receiving confirmation B A connection release.

Fourth wave: the client sends a FIN packet after the connection is released, the server receives this message, entered the CLOSE-WAIT state. The state is to allow the server sends the data transfer has not been completed, after the transfer is complete, the server sends FIN connection release message.

TIME_WAIT

The client receives the server's FIN message after entering this state, this time not directly enter CLOSED state, we will have to wait a period of time 2MSL timer settings. There are two reasons to do so:

  • Ensure a final confirmation message can reach. If B not receive acknowledgment packets sent by A, it will resend the connection release request message, waiting for a period of time A handle this situation is to occur.

  • Wait a period of time in order to make this connection all packets for the duration of the generated disappeared from the network, so that the next new connection will not be the old connection request packet.

Cookies and Session of difference

  1. A cookie is a client browser to send a text string handle, and saved on the client hard disk, can be used
    between a session lasting WEB SITE maintain data
  2. session actually refers to the visitors reach a certain page from that time to leave until. Session which
    is actually using the Cookie information processing, when the user first has been requested, the server on the user's browser
    to create a Cookie on, when the end of this Session, in fact, means that the Cookie will expire
  3. cookie stored in the client data, session data is stored on the server side

Step one complete HTTP request experienced

  • For example: Enter the entire process is executed after www.baidu.com in the browser
    Here Insert Picture Description

TCP and UDP concept of mutual differences and the pros and cons

  1. Connection-oriented TCP, UDP facing no link
  2. For TCP packets, UDP byte stream and
  3. TCP provides reliable transport services (data order, accuracy), UDP an unreliable transport
  4. TCP protocol to transmit slow, fast transmission speed UDP protocol
  5. TCP protocol for system resources and more (large header overhead) required, UDP protocol requires less

What IP routing features are?

(1) IP-by-hop routing is performed.
IP does not know the full path for any purpose, provided only the next hop address.
(2) specify a router as a network, instead of specifying a router for each host.
This can reduce the routing table size.

TCP what ways to ensure reliability?

1) Application of TCP that data is divided into data blocks sent by the most suitable.
2) acknowledgment mechanism, after sending the message, wait for confirmation.
3) retransmission mechanism, no acknowledgment is received, the retransmitted data segment.
4) holding it and the header checksum of the data. Confirm the accuracy of the data.
5) ordering, discarding duplicate flow control.

TCP, UDP pseudo header Why is there?

UDP (TCP) and Test: The value of the error detection is UDP (TCP) data packet and the calculated pseudo header.
Pseudo header contains the source and destination IP addresses, and protocol values from IP datagram headers. IP datagram transfer network
comprising a UDP datagram.
Pseudo header and not sent on the network, the content pseudo header checksum contained avoid erroneously received erroneous destination
routing datagrams. Calculated checksum values and IP header checksum calculation method similar

Common port

Here Insert Picture Description

The more you know, the more you do not know.
Proper way without surgery, patients can still seek, there is no way to surgery, ending surgery.
If you have other questions, welcome message, we can discuss, learn together and progress together

He published 193 original articles · won praise 116 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_40722827/article/details/104873549