我有5臺計算機的小本地網絡。我的提供商給了我真正的IP地址(194.187 ...),但網絡中的計算機無法看到它。所以我必須在我的路由器上(使用linux系統)重定向,這將重定向真實IP地址(194.187 ...)到我在提供商網絡(10.12.205.26)中提供的IP地址。如何使用iptables重定向ip地址
如何在我的路由器上使用iptables執行此操作。謝謝。
我有5臺計算機的小本地網絡。我的提供商給了我真正的IP地址(194.187 ...),但網絡中的計算機無法看到它。所以我必須在我的路由器上(使用linux系統)重定向,這將重定向真實IP地址(194.187 ...)到我在提供商網絡(10.12.205.26)中提供的IP地址。如何使用iptables重定向ip地址
如何在我的路由器上使用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...
讓我更好地理解。您希望所有指向您的公共(靜態)IP地址的流量都將重定向到您的專用局域網中的一個IP? 5臺計算機之一的IP是10.12.205.26嗎? –
沒有10.12.205.26是我的路由器在提供商的網絡的IP – andreyd