发布时间:2020-02-19 10:23:07来源:阅读(1010)
操作如下
/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开放关闭防火墙端口
1102
1551
2240
1032
1947
1131
1723
1635
2073
1053
9994
6172
5719
5294
4775
4475
3660
3524
3521
3430