Computer Network interview questions, computer network questions

Source: Internet
Author: User
Tags ftp protocol traceroute command

Computer Network interview questions, computer network questions

1,OSI Layer-7 protocol,Layer-4 TCP/IP protocol,Five-Layer Protocol mentioned in instructor Xie xiiren's online textbookComparison


Note:

(1) OSI's layer-7 protocol is only a theoretical protocol, which is not actually used.

(2) the architecture of the layer-4 TCP/IP protocol in practice.

(3) The five-layer protocol mentioned in Xie's old textbook is only a compromise to better explain the concept.

2. OSI Layer-7 protocol

(1) Layer 7 and Application Layer

<0> purpose: to directly provide services for the user's application process.

<1> services provided at the application layer: file transmission (FTP protocol), World Wide Web applications (HTTP protocol), and email information processing (SMTP protocol.

<2> common protocols: HTTP, HTTPS, FTP, TELNET, SSH, SMTP, POP3, etc.

<3> note: the application layer is not a special application running on the network, but a service provided for the user's application process.

(2) layer 6 and presentation layer

<0> role: responsible for data encoding and conversion, ensuring that the information sent by the application layer of one system can be read (recognized) by the application layer of another system ).

<1> specific functions: data compression, decompression, encryption, and decryption. Data is converted into different formats based on different application purposes (represented by various file extensions)

(3) layer 5 and Session Layer

<0> function: establishes, maintains, controls, and cancels sessions for two nodes (both parties) in the network.

(4) Layer 4, transport layer (Transport Layer)

<0> function: provides services for communication between processes on two hosts.

<1> specific roles: responsible for data splitting (Transfer end) and data combination (receiving end), controlling data traffic, and debugging and error handling to ensure smooth communication.

<2> common protocols: TCP and UDP

Note:

1. The data to be transmitted is integral on the upper layer, and is separated at the transport layer. The split data is called segments.

2. Three handshakes, connection-oriented and non-connection-oriented services, and traffic control all occur at this layer.

(5) Layer 3, Network Layer

<0> function: determines how to transmit the data of the sender to the receiver (PATH)

<1> data unit: IP datagram or group.

<2> important protocols: IP, ARP, RARP, ICMP, and IGMP

Note: The network layer only provides simple, flexible, connectionless, and maximum-possible delivery of the datagram service, making the router easier.

1. The network does not need to establish a connection when sending the group.

2. Each group is sent independently and has nothing to do with the front and back groups.

3. During the transfer process, the transmitted group may be faulty, lost, duplicated, or out of order, and the delivery time limit of the group is not guaranteed.

Note: The network layer does not guarantee reliable communication, but can be handled by the transport layer (error handling, traffic control, etc ).

(6) Layer 2 and data link layer

<0> role: Manage the BIT data at the first layer and transmit the correct data to a route without transmission errors.

<1> data unit: Frame

<2> important protocols: Point-to-Point Protocol (PPP) and CSMA/CD protocols (one-to-many Broadcast Communication)

Note:

1. The data link layer focuses on howUnreliable physical lineFor reliable data transmission.

2. In the OSI model, the data link layer provides reliable transmission services, that is, retransmission and validation mechanisms. However, in practical applications, the data link layer of TCP/IP does not require reliable transmission. Reliable transmission with transport layer control.

(7) Layer 1, Physical Layer

<0> role: Responsible for transparently transmitting bit streams on the network

<1> specific functions: how to transmit bit streams on various media, that is, how to determine the characteristics related to the transmission media interface.

<1> data unit: bit stream

Note: The Physical Layer focuses on howVarious mediaInstead of transmitting media.

2. What protocols does the network layer have?

(0) IP protocol:

Purpose: locate a path based on the destination IP address and transmit the data of the sender to the receiver.

(1) ARP: Address Resolution Protocol

Purpose: locate the physical address of the Peer based on the IP address of the peer.

(2) RARP: Reverse Address Resolution Protocol

Purpose: locate the IP address of the Peer based on the hardware address of the peer.

(3) ICMP Protocol: Internet Control Message Protocol)

Purpose: Send a message when a datagram is sent incorrectly.

(4) IGMP Protocol: Internet Group Management Protocol

Role: send multicast protocol

(5) OSPF protocol: Open Shortest Path First

Purpose: Find a shortest path for sending data.

3. What is the purpose of the ping command? What protocol is used?

<1> purpose: test the connectivity between two hosts.

<2> UseNetwork Layer Protocol ICMPProtocol

Note: The ping command directly uses the network layer protocol instead of the transport layer protocol (TCP and UDP.

4. Which layer of the network does the ICMP protocol have? Role?

(1) ICMP protocol works at the network layer

(2) Purpose:Forward IP datagram effectivelyAndImprove the chance of successful delivery.

(3) role:

<1> simply put, the reason is given when an error occurs in IP address datagram forwarding.

<2> specifically, when an error occurs when the router or host sends an IP datagram, the router or host sends the cause to the source node.

Note: ICMP is a network-layer self-detection function used to detect whether information has arrived at the destination. If not, provide the reason.

(4) how to send data: send data using IP datagram as the carrier

Specifically, the data field of the ICMP error message: the first eight bytes of the IP datagram header and data field (including the port number and sending serial number)

(5) category:

<1> ICMP Error Report packets -- all are composedFaulty host or router foundSend to source.

1) inaccessible end point: the target host cannot be found

2) source point suppression: network congestion

3) The time exceeds: the TTL of the received datagram is 0 (the datagram is not received within the specified time)

4) parameter problem: a problem occurs in the datagram header.

5) route change: If the Optimal Path to the destination address does not pass through the default route, you must change the table phases in the route table.

<2> ICMP Query Packets

1) Send back requests and answers: network performance detection, no connection

2) timestamp request and answer: Ask a host or route to answer the current time. Used for synchronization.

(6) Application of ICMP protocol:

<1> ping Command: Judge the connectivity between two hosts.

Principle: Target HostSendSend and Reply packetsThen, you can check it based on the reply of the target host.

<2> Traceroute command: obtains the path from the source point to the end point.

Principle: Send a series of IP datagram to the target host. The IP datagram contains a UDP datagram that cannot be delivered (the port is invalid ).

Specifically, there are two types of datagram.

Working principle: Traceroute sends a series of IP datagram to the target host from the source host. The datagram encapsulates a UDP User Datagram that cannot be delivered.

<1> the ttl of the first datagram P1 is set to 1. When P1 reaches the first router R1 in the path, router R1 accepts it first, and then drops the TTL value by 1. Since TTL is equal to zero, R1 discards P1 andSends an ICMP packet to the source host that exceeds the error report time.

<2> the source host then sends the second datagram P2 and sets TTL to 2. P2 first arrives at router R1, R1 first accepts it, drops TTL by 1, and then forwards it to router R2. When R2 receives P2, the TTL is 1, but the TTL changes to zero after the value is reduced by 1. R2 discards P2 andSend an ICMP message to the source host that exceeds the error report time.This will continue.

<3> when the last datagram arrives at the target host, the TTL of the datagram is 1. The host does not forward data packets or reduce the TTL value by 1. However, because the IP datagram encapsulates the UDP user datagram of the transport layer that cannot be deliveredThe target host must send an ICMP Destination inaccessibility Error Report to the source host.. In this way, the source host achieves its own goal, because the ICMP messages sent from these routers and the destination host provide the routing information that the source host wants to know-the IP address of the router passing through the destination host, and the round-trip time of each router.

5. Differences Between TCP and UDP

<1> TCP provides connection-oriented and reliable data stream transmission.

<2> UDP provides non-connection-oriented and unreliable data stream transmission.

In short, TCP focuses on data security, while UDP data transmission is faster, but the security is average.

6. Working Principle of ARP (Address Resolution Protocol)

(1)First, each host creates an ARP list in its ARP buffer (ARP Cache) to indicate the correspondence between the IP address and the MAC address.

(2)When the source host needs to send a packet to the target host, it first checks whether the MAC address corresponding to this IP address exists in its ARP list,

<1> If yes, the packet is directly sent to this MAC address;

<2> If NO, initiate an ARP request broadcast packet to the primary network segment to query the MAC address of the target host. This ARP request packet includes the IP address of the source host, the hardware address, and the IP address of the target host.

(3)When all hosts in the network receive this ARP request, they will check whether the destination IP address in the packet is consistent with their own IP address.

<1> ignore this packet if they are different;

<2> If the same,The host first adds the MAC address and IP address of the sender to its ARP list. If the IP address already exists in the ARP table, it overwritesThen, send an ARP response packet to the source host and tell the target host that it is the MAC address;

(4)After the source host receives the ARP response packet, it adds the IP address and MAC address of the target host to its ARP list and uses this information to start data transmission. If the source host has not received the ARP response packet, ARP query fails.

7. How does TCP ensure error retransmission?

(1) when the recipient receives an incorrect group, it directly discards it without any operation.

(2) The senderSpecified Time (greater than the average round-trip latency)If no validation group is received, the request is automatically retransmitted.

(3) Of course, in order to let the other party know which group has a problem, the serial number is also compiled for the group.

8. IP Protocol Error Detection:

(1) Which part is detected? The IP protocol only detects the IP datagram header and does not detect the data part.

(2) who will detect it? Each time the datagram passes through a vro, the Router performs an error detection.

(3) What should I do after an error?If the router finds a datagram error, it directly discards it.

(4) how to detect? Do not use complex CRC checks, and use header checks in IP datagram.

Method: A group of 16 binary codes is used to calculate the sum of backcodes.

(5) detection process:

<1> Sender: divides the IP datagram header into a 16-bit sequence, and then calculates the inverse code in the sum for each sequence. And put the reverse code of the sum into the header for verification.

<2> receiver (router): divides the IP datagram header into a 16-bit sequence, and then calculates the inverse code in the sum for each sequence. And then add it to the first checksum. If it is 0, it is normal. If the value is not 0, an error occurs.

9. UDP Protocol Error Detection:

(1) Which part is detected? UDP protocol detects the entire User Datagram (header + Data Part)

(2) who will detect it? ByTarget HostDetection

(3) What should I do after an error?If a datagram error is found on the target host, it is discarded directly.

(4) how to detect? Does not use complex CRC checks, similar to IP datagram detection methods.

Method:Pseudo header + Data part + full 0 bytes + 16 binary groups, And then calculate the sum of the anticode.

Reasons for using the pseudo-header: it is only used for verification.

The pseudo-header includes the source IP address, destination IP address, UDP protocol number, and UDP length. The pseudo-header allows UDP to check whether the data has arrived at the destination correctly twice.

Note:

<1> the pseudo header does not need to be uploaded or transmitted.

<2> because the Detected part may not be an even number of bytes, it cannot be split into a 16-bit sequence. In this case, you can insert a full byte of 0.

(5) detection process:

<1> Sender: divides the part to be detected into a 16-bit sequence, and then sums the reverse codes of each sequence. And put the reverse code of the sum into the header for verification.

<2> receiver: divide the part to be detected into 16-bit sequences, and then calculate the inverse code in the summation for each sequence. And then add it to the first checksum. If it is 0, it is normal. If the value is not 0, an error occurs.

10. TCP protocol error detection:

(1) Which part is detected? TCP protocol DetectionUser Datagram (header + Data Part)

(2) who will detect it? ByTarget HostDetection

(3) What should I do after an error?If a datagram error is found on the target host, it is discarded directly.

(4) how to detect? Does not use complex CRC checks, similar to IP datagram detection methods.

Method:Pseudo header + Data part + full 0 bytes + 16 binary groups, And then calculate the sum of the anticode.

Reasons for using the pseudo-header: it is only used for verification.

The pseudo-header includes the source IP address, destination IP address, TCP protocol number, TCP length, and other information, so that TCP checks whether data has arrived at the destination correctly.

Note:

<1> the pseudo header does not need to be uploaded or transmitted.

<2> because the Detected part may not be an even number of bytes, it cannot be split into a 16-bit sequence. In this case, you can insert a full byte of 0.

(5) detection process:

<1> Sender: divides the part to be detected into a 16-bit sequence, and then sums the reverse codes of each sequence. And put the reverse code of the sum into the header for verification.

<2> receiver: divide the part to be detected into 16-bit sequences, and then calculate the inverse code in the summation for each sequence. And then add it to the first checksum. If it is 0, it is normal. If the value is not 0, an error occurs.

Memory:

(1) The IP protocol only detects the header, while TCP and UDP checks the entire header and data, including the pseudo header.

(2) IP, UDP, and TCP will be discarded directly after an error is detected. However, TCP requires retransmission.

(3) UDP and TCP have the same error detection method.

Copyright Disclaimer: you are welcome to reprint it. I hope you can add the original article address while reprinting it. Thank you for your cooperation.

Related Article

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.