发布时间:2020-02-19 10:23:07来源:阅读(985)
操作如下
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT #开启80端口
/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT #开启22端口
/etc/rc.d/init.d/iptables save #保存配置
/etc/rc.d/init.d/iptables restart #重启服务
查看已开放端口
/etc/init.d/iptables status
结果如下
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
3 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
你可以使用 lsof 命令来查看某一端口是否开放。查看端口可以这样来使用,我就以80端口为例: lsof -i:80 如果有显示说明已经开放了,如果没有显示说明没有开放。
关键字: linux
上一篇: linux下esc退不出vi
下一篇: centos7开放关闭防火墙端口
1495
1787
1402
1066
570
1111
1311
1817
1062
772
9912
6137
5683
5254
4722
4436
3605
3487
3486
3394