首页 > 编程知识 正文

如何打开端口,如何打开19811端口

时间:2023-05-03 15:07:51 阅读:284529 作者:2614

iptables 打开端口

How to open a port, say 3389, in iptables to allow incoming traffics to it?

如何在iptables中打开一个端口(例如3389),以允许传入流量到该端口?

There are several cases for this question: ipv4 or ipv6 or both, TCP or UDP or both and which interface?

这个问题有几种情况:ipv4或ipv6或两者,TCP或UDP或两者,以及哪个接口?

For simplicity, I give commands to allow all (ipv4 and ipv6, TCP and UDP from all interfaces) using port 3389 as an example. You may choose which ones to be used. For other ports, replace 3389 with the port you want to open.

为简单起见,我以端口3389为例给出命令以允许所有命令(所有接口的ipv4和ipv6,TCP和UDP)。 您可以选择要使用的那些。 对于其他端口,将3389替换为要打开的端口。

# allow TCP ipv4iptables -I INPUT -p tcp --dport 3389 -j ACCEPT# allow UDP ipv4iptables -I INPUT -p udp --dport 3389 -j ACCEPT# allow TCP ipv6ip6tables -I INPUT -p tcp --dport 3389 -j ACCEPT# allow UDP ipv6ip6tables -I INPUT -p udp --dport 3389 -j ACCEPT

Note that the rules are in memory only after these commands and will be lost after Linux reboots. If you would like to make it permanent (take effect after reboot), please check How to make iptables/ip6tables configurations permanent across reboot on CentOS 7 Linux? .

请注意,只有在执行这些命令后,规则才会在内存中 ,并且在Linux重新引导后将丢失。 如果您想使其永久( 重新启动后生效),请检查如何在CentOS 7 Linux上重新启动时使iptables / ip6tables配置永久? 。

翻译自: https://www.systutorials.com/how-to-open-a-port-in-iptables/

iptables 打开端口

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。