Recently I needed to use Linux iptables NAT for port mapping,
but the interface machine only had one NIC and needed both internal and external network access,
so I used the method described below:
1. Assume internal network IP info:
address 192.168.100.6
netmask 255.255.255.0
gateway 192.168.100.1
2. Assume external network IP info:
address 192.168.200.188
netmask 255.255.255.0
gateway 192.168.200.1
3. Assume NIC is: eth0
4. Edit the Ubuntu IP config file:
#vim /etc/network/interfaces
Refer to the content below. Linux users will understand:
After editing, save with wq! and restart the NIC:
OK, done.