常用的命令要背住,要专业。不能你是啥都百度,啥都知道,就是记不住。
1、版本
[root@roidb01 ~]# uname -a
Linux roidb01 3.10.0-123.el7.x86_64 #1 SMP Mon May 5 11:16:57 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@roidb01 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)
[root@roidb01 ~]#
2、常规操作
[root@roidb01 ~]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
Active: inactive (dead) ##关闭状态
Feb 19 06:48:42 roidb01 systemd[1]: Starting firewalld - dynamic firewall daemon...
Feb 19 06:48:43 roidb01 systemd[1]: Started firewalld - dynamic firewall daemon.
Feb 19 06:50:19 roidb01 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Feb 19 06:50:19 roidb01 systemd[1]: Stopped firewalld - dynamic firewall daemon.
Feb 19 06:50:40 roidb01 systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@roidb01 ~]#
##打开防火墙操作
[root@roidb01 ~]# systemctl enable firewalld
ln -s '/usr/lib/systemd/system/firewalld.service' '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
ln -s '/usr/lib/systemd/system/firewalld.service' '/etc/systemd/system/basic.target.wants/firewalld.service'
[root@roidb01 ~]#
[root@roidb01 ~]# systemctl start firewalld
[root@roidb01 ~]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
Active: active (running) since Mon 2018-02-19 08:00:45 CST; 7s ago
Main PID: 18764 (firewalld)
CGroup: /system.slice/firewalld.service
└─18764 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
Feb 19 08:00:45 roidb01 systemd[1]: Started firewalld - dynamic firewall daemon.
[root@roidb01 ~]#
###关闭防火墙操作
[root@roidb01 ~]# systemctl stop firewalld
[root@roidb01 ~]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
Active: inactive (dead) since Mon 2018-02-19 08:01:47 CST; 8s ago
Process: 18764 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 18764 (code=exited, status=0/SUCCESS)
Feb 19 08:00:45 roidb01 systemd[1]: Started firewalld - dynamic firewall daemon.
Feb 19 08:01:46 roidb01 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Feb 19 08:01:47 roidb01 systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@roidb01 ~]# systemctl disable firewalld
rm '/etc/systemd/system/basic.target.wants/firewalld.service'
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
[root@roidb01 ~]#
[root@roidb01 ~]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
Active: inactive (dead)
Feb 19 06:48:42 roidb01 systemd[1]: Starting firewalld - dynamic firewall daemon...
Feb 19 06:48:43 roidb01 systemd[1]: Started firewalld - dynamic firewall daemon.
Feb 19 06:50:19 roidb01 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Feb 19 06:50:19 roidb01 systemd[1]: Stopped firewalld - dynamic firewall daemon.
Feb 19 06:50:40 roidb01 systemd[1]: Stopped firewalld - dynamic firewall daemon.
Feb 19 08:00:43 roidb01 systemd[1]: Starting firewalld - dynamic firewall daemon...
Feb 19 08:00:45 roidb01 systemd[1]: Started firewalld - dynamic firewall daemon.
Feb 19 08:01:46 roidb01 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Feb 19 08:01:47 roidb01 systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@roidb01 ~]#
本文转自 roidba 51CTO博客,原文链接:http://blog.51cto.com/roidba/2071857,如需转载请自行联系原作者