-
重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off -
即时生效,重启后失效
开启: 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
1 ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:2181
2 ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:6379
3 ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
4 ACCEPT all – 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
5 ACCEPT icmp – 0.0.0.0/0 0.0.0.0/0
6 ACCEPT all – 0.0.0.0/0 0.0.0.0/0
7 ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
8 REJECT all – 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all – 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
5:删除端口(2表示上面的num列)
/sbin/iptables -D INPUT 2
继续阅读与本文标签相同的文章
马上消费金融荣登“智能风控兵器谱TOP20”榜单
一图读懂《2019微信知识产权保护报告》
-
猫和老鼠:5种药水效果可以叠加吗?这2种药水效果会有冲突!
2026-05-18栏目: 教程
-
自媒体教程,深度剖析平台的推荐机制原理,了解怎么获取高流量
2026-05-18栏目: 教程
-
宽带故障怎么办?教你几招,轻松解决!
2026-05-18栏目: 教程
-
Python 3.8刚刚发布!一分钟了解新版本的强大功能!
2026-05-18栏目: 教程
-
《中国工夫》聚焦“中国智造”
2026-05-18栏目: 教程
