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:
Today, we'll delve into the relationship between RS-485 and Modbus to help you better understand the connection between these two components. The Open Systems Interconnection (OSI) model attempts to represent the various layers of a communication...
View detailsOn 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 detailsAs a technical support specialist at Yeaplink, I'm excited to present a detailed assessment of our SR520 4G LTE industrial router. This cutting-edge device represents a significant advancement in industrial connectivity solutions. Let's explore th...
View detailsToday, let's talk about common network faults and troubleshooting strategies that network engineers encounter in their daily work. The six faults mentioned next are undoubtedly familiar to everyone. If you can resolve them, congratulations, you ar...
View detailsMo