Preface When answering questions about computer networks during interviews, it is very common for candidates to explain the TCP three-way handshake, four-way wave, or the details of the OSI seven-layer model. When asked about how data packets are transmitted on the network, such as IP routing, ARP addressing, the difference between switches and routers, the conversion between private IP and global IP, etc., they can only remain silent. This article will sort out the detailed process of sending data packets from one host to another in the network, including network devices such as modems, repeaters, network cards, switches, routers, and IP protocol-related technologies such as DNS, ARP, DHCP, NAT, ICMP, etc.
equipment Building a network environment involves a variety of cables and network equipment. Since we need to understand data transmission, we must first understand the media of data transmission. As shown in the figure, host A sends data packets to host B, which need to pass through switches, routers and other devices. However, at the physical layer (Layer 1 of the OSI model), modems and repeaters are also required. 1. Modem When setting up broadband in a modern home network, you can see the modem (English: Modem) connected to the router, which we generally affectionately call a "cat". A modem is an electronic device that converts digital signals generated by a computer into analog signals for transmission, and demodulates received analog signals to obtain digital signals. In the past, people used telephone modems to access the Internet via telephone lines. Now, we use fiber optic modems to access the Internet, which are used to convert digital signals into fiber optic signals. 2. Repeater Like modems, repeaters also work at the physical layer. Their function is to adjust and amplify the waveform of the electrical or optical signal transmitted through the cable and then transmit it to another cable. In short, a repeater is a device that amplifies and sends weakened signals. 3. Network card A network card is a must for a computer to access the Internet, and most computers now have built-in network cards. A network card, also known as a network adapter or LAN card, is a piece of computer hardware designed to allow computers to communicate on a computer network. Because it has a MAC address, it belongs to Layer 2 (Data Link Layer) of the OSI model. The MAC address of the computer or the host we are talking about is actually the MAC address of the network card. As shown in the figure below, Mac computers can view the current computer's MAC address in "System Preferences - Network - Wi-Fi - Advanced - Hardware". 4. Switch A switch is a network device that receives and forwards data to a target device through message exchange. In short, a switch receives data packets, checks the destination address of the data packet to select a route, and forwards the data packet to the next-hop router. It should be clear that the switch does not modify the data packet, it is only responsible for forwarding the data packet. A switch is also called a bridge or a layer 2 switch. The so-called layer 2 means working at the data link layer. This means that when the switch forwards a data packet, it does not know or need to know the IP address of the source host and the destination host, but only needs to know their MAC address. How a switch works: The CPU inside the switch will form a MAC table by matching the MAC address and port when each port is successfully connected. When a switch is installed and configured, its working process is as follows:
5. Router A router can connect different data links, such as connecting two Ethernet networks. Nowadays, the broadband routers that people use to connect to the Internet at home or in the office are also a type of router. A router is a device that connects two networks and forwards packets at the third layer of the OSI model, the network layer. The switch processes based on the physical address (MAC address) and refers to the MAC table, while the router processes based on the IP address and refers to a table called the routing control table. Routing control table: The address used when sending a data packet is the IP address of the network layer. However, the IP address alone is not enough to send the data packet to the destination address on the other end. In the process of data transmission, information such as "specifying the next router or host" is also required in order to actually send it to the destination address. The routing control table is where this information is stored. Hosts and routers that implement IP communication must have such a table. It is based on this table that they can send data packets. There are two ways to form the routing control table: one is manual setting by the administrator, and the other is automatic refresh when the router exchanges information with other routers. The former is also called static routing control, and the latter is called dynamic routing control. In order for dynamic routing to refresh the routing table in a timely manner, routing protocols must be set up between interconnected routers on the network to ensure normal reading of routing control information. The routing control table records the network address and the address of the router to which the packet should be sent next. When sending an IP packet, the destination address in the IP packet header must be determined first, and then the record with the same network address as the address is found in the routing control table. The IP packet is forwarded to the corresponding next router based on the record. If there are multiple records of the same network address in the routing control table, the one that best matches is selected. The so-called best match means the one with the most identical digits. For example, the network address 172.20.100.52 matches both 172.20/16 and 172.20.100/24. In this case, 172.20.100/24, which has the longest match, should be selected. The default route is a record that any address in the routing table can match. The default route is usually marked as 0.0.0.0/0 or default. The 0.0.0.0/0 here does not mean that the IP address is 0.0.0.0. In order to avoid people mistakenly thinking that 0.0.0.0 is an IP address, the suffix is /0. |
<<: Why is 5G considered the criterion for the Internet of Things era?
At the 2018 Global Network Technology Conference,...
We have seen WiFi undergo rapid changes, and in 2...
Today, Huawei Software Development Cloud entered ...
Today we're taking a look at home network har...
London, UK, May 17, 2021 - The Global Mobile Supp...
Verizon Business recently launched its first comm...
Hello everyone, I am Zhibeijun. It is the last da...
At present, the domestic network operation and ma...
Throughout 2019, there are actually two important...
As enterprises develop their network strategies a...
Using the same 5G network, some users can watch h...
[[390976]] Compared with China Telecom and China ...
Singapore will shut down its 3G network in July n...
Competition among domestic cloud server vendors i...