Linux防火墙和端口的关闭与开启
2018-03-11 23:44
281 查看
CentOS 是通过iptables来管理防护墙的对于防火墙的开启与关闭命令在网络上随处可见,我就简单的理一下,本文主要介绍开启和关闭端口
重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off
即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop
$ sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
$ sudo firewall-cmd --reload
$ firewall-cmd --list-all
CentOS/RHEL 6
$ sudo iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
$ sudo service iptables save
$ sudo system-config-firewall-tui
[root@localhost michael]# service iptables start
iptables: Applying firewall rules: [ OK ]
[root@localhost michael]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6379
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6379
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
4 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
5 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
7 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
在CentOS 6、 7两个不同的版本上开启端口的方法是不同的
开启一个端口CentOS/RHEL 7
[root@localhost michael]#
未完待续。。。。。。。。。。。。。
重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off
即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop
$ sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
$ sudo firewall-cmd --reload
$ firewall-cmd --list-all
CentOS/RHEL 6
$ sudo iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
$ sudo service iptables save
$ sudo system-config-firewall-tui
[root@localhost michael]# service iptables start
iptables: Applying firewall rules: [ OK ]
[root@localhost michael]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6379
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6379
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
4 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
5 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
7 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
在CentOS 6、 7两个不同的版本上开启端口的方法是不同的
开启一个端口CentOS/RHEL 7
[root@localhost michael]#
未完待续。。。。。。。。。。。。。
相关文章推荐
- Linux防火墙(Iptables)的开启与关闭
- linux如何开启关闭端口
- 怎样查找开启Windows 2003 Server 的端口和如何关闭端口
- 关闭selinux和防火墙开启状态增加3306端口
- 腾讯云服务器默认是关闭端口的,开启端口设置操作
- Linux防火墙(Iptables)的开启与关闭
- centOS防火墙中端口的开启和关闭
- 什么是端口,怎样查看端口,关闭/开启端口,各种端口的作用
- Linux防火墙(Iptables)的开启与关闭
- Linux防火墙(Iptables)的开启与关闭
- CentOS开启关闭端口方法
- CentOS防火墙开启、关闭以及开放指定端口
- linux 系统ssh端口的开启及关闭与系统硬件的查看
- 树莓派上开启、关闭、查看指定端口
- Linux防火墙(Iptables)的开启与关闭
- Linux防火墙(Iptables)的开启与关闭
- 关闭或开启Linux上的iptables防火墙,SSH端口
- 如何关闭你要关闭的端口或开启你要开启的端口
- 关闭或开启Linux上的iptables防火墙,SSH端口(转)
- linux开启防火墙端口和查看,开启相关和关闭端口号