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:
For network engineers, it is essential to be familiar with and master routing troubleshooting ideas and techniques.
View detailsThe ease of setup for industrial routers directly impacts the user experience. In this article, we'll explore Yeaplink's cost-effective industrial routers - the SR500 4G and SR800 5G models. These routers combine simple configuration with excellen...
View detailsPacket loss in cross-border transfers is a common challenge. In addition to adopting general methods to avoid issues, using a one-stop file transfer solution like Raysync can easily solve network packet loss problems, improving the efficiency and ...
View detailsHey, industrial leaders! Today, let's talk about a topic that's both cool and practical - industrial autonomous driving! But don't think this is just about little carts strolling around the factory; we're talking about big guys that can "parkour" ...
View detailsMo