1 First change the net.ipv4.ip_forward=0 in the/etc/sysctl.conf configuration file to net.ipv4.ip_forward=1
then execute the SYSCTL-P/etc/sysctl.conf mission order to take effect.
2 Configuring IP spoofing for Firewalls
iptables-t nat-a postrouting-o eth0-j Masquerade
3 If you want a server within the internal network to be externally accessible, you can use the-j DNAT target of the prerouting chain within the NAT to specify that the destination IP address and port forwarding request be connected to the internal server. For example, if you want to forward incoming HTTP requests to a dedicated Apache HTTP Server server System on 172.11.0.21, run the following command
iptables-t nat-a prerouting-i eth0-p tcp--dport 80-j DNAT \
--to 172.11.0.21:80
4 This rule allows incoming 80-port requests to be forwarded from the firewall to the 172.11.0.21 server.
iptables-a forward-i eth0-p tcp--dport 80-d 172.11.0.21-j ACCEPT
Configuring Linux Server request forwarding using Iptables