Concept
Gateways are in two systems that use different communication protocols, data format structures, languages or systems, computer systems or other devices that act as converters, gateways and bridges are not the same, bridges only pass data between two systems, do not perform conversion operations, the gateway repackage information, or change the syntax of the data. To conform to the requirements of the destination system, the gateway can also be the connection point of the internal network and the external network, the device takes out information from the main device, checks the address, and passes them to the next router or host system, working at the OSI application layer
A system that acts as a gateway requires two network cards to connect to different networks, such as
Ifconfig 172.16.64.0 netmask 255.255.192.0 eth0 indicates that all packets going to the 172.16.64.0 network are sent through the eth0 NIC
Ifconfig 172.16.128.0 netmask 255.255.192.0 eth1 indicates that all packets going to the 172.16.128.0 network are sent through the eth1 NIC
Finally, you need to turn on the IP forwarding function of the system (default is 0 off)
Echo 1 >/proc/sys/net/ipv4/ip_forward
Linux Gateways and routing