如何在9003上打开iptables中的udp?

问题描述 投票:-1回答:2

我在我的CentOS上设置了一个新的UDP服务器,我用户iptables。但是,如果我启动iptable,我无法连接我的服务器。

我像这样保存过滤器链:

但它不起作用;

我用nc -ul 9003来听这个端口;我用另一个nc send msg;但我不能得到我的msg

linux iptables
2个回答
0
投票

删除规则7,它应该工作。或者插入规则7以上的规则。我建议使用链策略来阻止不允许的每个流量。

如何删除iptable规则:

iptables -D INPUT (Rule Number)

如何插入iptable规则:

iptables -I INPUT (Rule Number) (Rule)

-1
投票

centos默认使用firewalld

firewall-cmd --zone=public --add-port=9003/udp --permanent
firewall-cmd --reload

但如果你正在使用iptables

iptables -A INPUT -p udp--dport 9003 -j ACCEPT
service iptables save
service iptables restart
© www.soinside.com 2019 - 2024. All rights reserved.