![为什么linux防火墙关了 端口不通,第1张 为什么linux防火墙关了 端口不通,第1张](/aiimages/%E4%B8%BA%E4%BB%80%E4%B9%88linux%E9%98%B2%E7%81%AB%E5%A2%99%E5%85%B3%E4%BA%86+%E7%AB%AF%E5%8F%A3%E4%B8%8D%E9%80%9A.png)
) 重启后
生效 开启: chkconfig iptables on
关闭: chkconfig iptables off 2) 即时生效,重启后失效 开启: service iptables start 关闭: service iptables stop 查看iptables文件vim /etc/sysconfig/iptables redhat部分-----------1:
端口开放/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT 2:保存修改/etc/rc.d/init.d/iptables save 3: 重启服务/etc/rc.d/init.d/iptables restart 4:查看端口状态/etc/init.d/iptables status 结果如下Chain INPUT (policy ACCEPT)num target prot opt source destination 1ACCEPT tcp -- 0.0.0.0/00.0.0.0/0 tcp dpt:2181 2ACCEPT tcp -- 0.0.0.0/00.0.0.0/0 tcp dpt:6379 3ACCEPT tcp -- 0.0.0.0/00.0.0.0/0 tcp dpt:8080 4ACCEPT all -- 0.0.0.0/00.0.0.0/0 state RELATED,ESTABLISHED 5ACCEPT icmp -- 0.0.0.0/00.0.0.0/0 6ACCEPT all -- 0.0.0.0/00.0.0.0/0 7ACCEPT tcp -- 0.0.0.0/00.0.0.0/0 state NEW tcp dpt:22 8REJECT all -- 0.0.0.0/00.0.0.0/0 reject-with icmp-host-prohibitedChain FORWARD (policy ACCEPT)num target prot opt source destination 1REJECT all -- 0.0.0.0/00.0.0.0/0 reject-with icmp-host-prohibitedChain OUTPUT (policy ACCEPT)num target prot opt source destination5:删除端口(2表示上面的num列)/sbin/iptables -D INPUT 2 centos7部分-----------开启端口firewall-cmd --zone=public --add-port=80/tcp --permanent --zone #作用域--add-port=80/tcp #添加端口,格式为:端口/通讯协议--permanent #永久生效,没有此参数重启后失效重新加载防火墙firewall-cmd --reload 检查修改是否生效firewall-cmd --zone= public --query-port=80/tcp 删除某端口firewall-cmd --zone= public --remove-port=80/tcp firewall-cmd --zone=public --remove-service=http我个人认为,我们可以在中学毕业后学习。首先是计算机经验,然后,如果你不喜欢无聊的书,我建议你听一下 haobin 的 c 语言介绍,我听这个介绍,它更容易理解,关键是输入更多的代码,然后你可以进一步阅读更多的经典书籍,比如标准的编程习惯,高质量的 c 语言编程,经典的 c 专家编程,c 和指针,等等。C 语言的书,真的经得起时间的考验真的不多... 一点经验。关键不知道不要放弃,百度或者,问老师或者,记住,你永远不会是第一个遇到这个问题的人。你的iptables设置没有?
或者你没有使用 iptalbles 你有没有完全关闭SELinux
一般在配置firewall的时候把SELinux 完全关闭,这样容易查询问题,如果关闭可以查看《Linux就该这么学》第10章节 SELinux安全子系统
评论列表(0条)