常用的命令要背住,要专业。不能你是啥都百度,啥都知道,就是记不住。
1、版本
[[email protected] ~]# 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
[[email protected] ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)
[[email protected] ~]#
2、常规操作
[[email protected] ~]# 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.
[[email protected] ~]#
##打开防火墙操作
[[email protected] ~]# 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‘
[[email protected] ~]#
[[email protected] ~]# systemctl start 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 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.
[[email protected] ~]#
###关闭防火墙操作
[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# 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.
[[email protected] ~]# systemctl disable firewalld
rm ‘/etc/systemd/system/basic.target.wants/firewalld.service‘
rm ‘/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service‘
[[email protected] ~]#
[[email protected] ~]# 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.
[[email protected] ~]#
原文地址:http://blog.51cto.com/roidba/2071857
时间: 2024-11-04 09:46:16