linux系统服务之防火墙

linux系统服务之防火墙

1、防火墙:防范一些网络攻击。有软件防火墙、硬件防火墙之分。

linux系统服务之防火墙

2、查看防火墙:

[[email protected] ~]# ps -ef | grep firewalld
root 1085 1 0 10:24 ? 00:00:01 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
root 8465 7616 0 13:55 pts/0 00:00:00 grep --color=auto firewalld
[[email protected] ~]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
Active: active (running) since 六 2020-02-29 10:25:04 CST; 3h 30min ago
linux系统服务之防火墙
3、firewalld 服务启动/重启/关闭:
#systemctl start/restart/stop firewalld
#/etc/init.d/firewalld start/stop/restart
linux系统服务之防火墙
4、firewalld 查看规则
查看firewalld规则明细
linux系统服务之防火墙
5、简单设置防护墙规则
例如:需要允许80端口通过防火墙,则规则设置如下:
#iptables -I INPUT -p tcp --dport 80 -j ACCEPT #允许访问80端口
iptables:主命令
-I:表示将规则放在最前面
-A:add添加规则
INPUT:进站请求{出站output}
-P:protocol,指定协议(icmp/tcp/udp)
–dport :指定端口号
-J:指定行为结果,允许(accept)/禁止(reject)
linux系统服务之防火墙
注意将规则保存,要不然重启服务器失效
linux系统服务之防火墙