SEARCH
— 葡萄酒 | 威士忌 | 白兰地 | 啤酒 —
— 葡萄酒 | 威士忌 | 白兰地 | 啤酒 —
In the previous articles, we were mainly focusing on internal networks (interested readers can follow the author to view the articles). But the world is vast, and we always want to explore it. In the network world, how do we connect from an internal network to an external network? This is where a gateway comes into play. Let’s first look at the following command:
ip route add 10.168.10.0/20 via 10.173.23.1 dev eth0
Those familiar with this command should know that it is used to configure a route in the router’s routing table. If you are not familiar with it, don’t worry, you can continue reading. Here, I mentioned routers, routing tables, and gateways. So, what is the relationship between a gateway, a router, and a routing table? First, let’s clarify that a router is a Layer 3 physical device that serves as a gateway. Therefore, we usually refer to a router as a gateway. However, a router has several ports, each connecting to a different target LAN. The routing table defines which port to use for forwarding to which LAN and what the next hop IP is. So, this combination of devices and routing rules meets our need to connect from an internal network to an external network. To understand its working principle, we need to start with the MAC header and IP header. Suppose there is a host A in LAN A that wants to access host B in LAN B.
We know that the MAC header and IP header formats of network data packets are as follows. Each forwarding of the request packet needs to contain the following content: The MAC header first contains the destination address, then the source MAC address, followed by the protocol type. The IP header usually contains the version type (typically IPv4), TOS, LLS, etc. We mainly focus on the source IP address and the destination IP address.
This routing method seems quite clear, right? It works fine when different LANs are in different network segments, but LANs are mutually unaware. It is quite possible that the IP addresses of machines in two LANs are exactly the same. For example, the IP address of Machine A is 192.168.1.100, and the IP address of Machine B is also 192.168.1.100. If data is sent in the above manner, it looks like sending data to itself.
At this point, we need to use a router with NAT (Network Address Translation) functionality. NAT’s full name is Network Address Translation. Its main forwarding principle is to convert the source internal network IP to a public IP during forwarding, allowing communication with the external network. It hides the internal network from the external network, so at least one public IP is needed for communication with the external network, greatly alleviating the shortage of IP resources. There are three main types of NAT:
On electrical installation or maintenance sites, some electricians can instantly determine the required cable size based on the power, leaving many novice electricians in awe. Today, we'll delve into the reason behind this.
View detailsAt Yeaplink, we frequently encounter questions about industrial router standards and specifications.These standards ensure reliable operation in harsh industrial environments.Let me break down the key standards that make industrial routers differe...
View detailsIn today's era of industrial Internet of Things (IIoT), the demand for stable and reliable network connections in industrial settings is ever-increasing. Industrial 4G routers with SIM slots play a crucial role in connecting industrial equipment t...
View detailsIn network communication, the smooth transmission of data packets is the foundation for ensuring a seamless user experience.
View detailsMo