centos7 iptables 端口转发 求助 重谢 重谢

madrocket 2020-02-04 07:47:56
服务器A(IP1) 发起http请求(http请求的源头,iptables也装在本机)
服务器B(IP2) 原目的地
服务器C(IP3) 转发后的目的地

服务器A上安装了iptables


在服务器A 上执行命令:curl ip2:port2

希望服务器C能收到请求

于是我做了如下操作:

命令1:iptables -t nat -A OUT -d ip2 -p tcp --dport 8105 -j DNAT --to-destination ip3:8105

结果报错
iptables: No chain/target/match by that name.




更换命令为:(OUT-->PREROUTING )
命令2:iptables -t nat -A PREROUTING -d ip2 -p tcp --dport 8105 -j DNAT --to-destination ip3:8105
没有报错

于是我执行:curl ip2:port2,并没有转发到ip3:port3



问题:
一:命令1报错原因是什么呢?

二:报错如何解决呢?

三:如何设置目的地ip和端口的转发呢?


由于特殊需要,iptables只能安装在服务器A上,不能更改iptables的安装机器



...全文
94 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

18,784

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 专题技术讨论区
社区管理员
  • 专题技术讨论区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧