我们现在有2台服务器1台服务器有内外网IP, 另一台服务器只有内网IP, 想要访问内网的服务器就需要将内网的端口映射到外网上.
server 1:
外网IP 10.0.0.1
内网IP 20.0.0.1
server 2:
内网IP 20.0.0.2
我们现在需要将 server2的内网端口22映射到server1的外网端口30022上
首先我们清空现有的链表
$ iptables -F
$ iptables -X
$ iptables -Z
然后我们做端口映射
$ iptables -t nat PREROUTING -d 10.0.0.1 -p tcp --dport 30022 -j DNAT --to 20.0.0.2:22
$ iptables -t nat POSTROUTING -d 20.0.0.2 -p tcp --dport 22 -j SNAT --to 20.0.0.1
$ iptables save
现在我们可以通过 10.0.0.1 的 30022 端口来远程访问server2了
TPLink TLWDR4320 无线路由器IP带宽控制功能分配带宽设置方法
SQL Server 2008及更高版本数据库恢复做法之日志尾部备份实用指南
TPLink TLWDR4320 无线路由器控制管控小孩上网行为设置
TPLink TLWDR4320 无线路由器打印服务器设置指南
TPLink TLWDR8620 52 无线路由器当作交换机使用教程
TPLink TLWDR8620 52 无线路由器映射服务器到外网操作方法