linux – 如何通过iptables允许传出连接?
发布时间:2020-05-28 04:17:34 所属栏目:Linux 来源:互联网
导读:我有两台服务器.第一个程序需要与端口2194上的第二个进行通信. 我知道它不起作用,因为当我这样做时: root@server1 [~]# telnet myserver2.com 2194Trying 123.123.123.98...telnet: connect to address 123.123.123.98: Connection timed outtelnet: Unable
我有两台服务器.第一个程序需要与端口2194上的第二个进行通信. 我知道它不起作用,因为当我这样做时: root@server1 [~]# telnet myserver2.com 2194 Trying 123.123.123.98... telnet: connect to address 123.123.123.98: Connection timed out telnet: Unable to connect to remote host: Connection timed out server1# iptables -L -n Chain INPUT (policy DROP) ... ... Chain FORWARD (policy DROP) target prot opt source destination Chain OUTPUT (policy DROP) ... Chain LOCALINPUT (1 references) target prot opt source destination ... Chain LOCALOUTPUT (1 references) target prot opt source destination ... Chain LOGDROPIN (1 references) target prot opt source destination DROP all -- 0.0.0.0/0 0.0.0.0/0 Chain LOGDROPOUT (1 references) target prot opt source destination DROP all -- 0.0.0.0/0 0.0.0.0/0 解决方法要允许在TCP端口2194上从server1到server2的传出连接,请在server1上使用此连接:iptables -A OUTPUT -p tcp -d <server2ip> --dport 2194 -j ACCEPT 要允许在TCP端口2194上从server1到server2的传入连接,请在server2上使用此连接: iptables -A INPUT -p tcp -s <server1ip> --dport 2194 -j ACCEPT (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- c – 同时写入两个流
- linux – Iptables:“ – p udp –state ESTABLISHED”
- linux – 从grep输出中删除字符
- 如何在linux ubuntu上配置PHP CLI以作为www-data运行?
- linux – 在ubuntu中安装octave包
- nginx django 出现413 Request Entity Too Large(请求实体过
- linux – bash脚本应该使用sudo还是假设sudo?
- linux – 使用Puppet管理iptables
- linux – Logrotate:旋转非日志文件?
- linux – 如何在所有文件和所有目录中递归地找到一个单词