linux端口开放指定端口的一种方法

# 编辑/etc/sysconfig/iptables

1.编辑iptables:vi /etc/sysconfig/iptables
加入内容并保存:-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
2.重启服务:/etc/init.d/iptables restart 
3.查看端口是否开放:/sbin/iptables -L -n

查询端口是否有已存在进程用命令grep查询对应端口,如80为端口号

example:netstat -nalp|grep 80

猜你喜欢

转载自www.cnblogs.com/a1d4m/p/10051972.html
今日推荐