linux network address translation (NAT)

Source address conversion (intranet access to extranet)

Insert picture description here

When sending IP packets, convert the address of the internal network (source address) to the Eth1 address of the external network (12.34.56.78)
Insert picture description here
Insert picture description here
eth1 is the network card (export)
and then delete the first rule : (or change the above -A For -I)
iptables -t nat -D POSTROUTING 1

Target address conversion (extranet access to intranet)

Insert picture description here

When sending IP packets, convert the address of the external network (destination address) to the host address of the internal network (192.168.1.1) and
add the conversion rule.
Add the PREROUTING rule.
Insert picture description here
Add the FORWORD rule:
iptables -F PREROUTING

Guess you like

Origin blog.csdn.net/weixin_42478365/article/details/113759111
Recommended