如何使用iptables重定向ip地址



我有5台计算机的小型本地网络。我的提供商给了我真实的ip地址(194.187…),但网络中的计算机看不到它。所以我必须在我的路由器上进行重定向(使用linux系统),它会将真实的ip地址(194.17…)重定向到我在提供商的网络中的ip地址上(10.12.205.26)。

如何在路由器上使用iptables执行此操作。谢谢

我希望这对你有用:

   Add (prerouting,postrouting) rules in you NAT table using
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source ip_address
iptables -t nat -A PREROUTING -i eth0 -j DNAT --to-destination ip_address
    and then use :
    iptables -t nat -A PREROUTING -d 194.187... -j DNAT --to-destination 10.12.205.26
    iptables -t nat -A POSTROUTING -s 10.12.205.26 -j SNAT --to-source 194.187...

最新更新