How to disable the firewall on CentOS7

Source: Internet
Author: User
In earlier versions, the command to disable services such as firewall is serviceiptablesstop/etc/init. d/iptablesstop in RHEL7. In fact, this service does not exist [root @ rhel7 ~]. # Cat/etc/redhat-releaseRedHatEnterpriseLinuxServerrel

In earlier versions, the command to disable services such as firewall is

Service iptables stop

/Etc/init. d/iptables stop

 

In RHEL7, there is actually no such service

[Root @ rhel7 ~] # Cat/etc/redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)
[Root @ rhel7 ~] # Service iptables stop
Redirecting to/bin/systemctl stop iptables. service
[Root @ rhel7 ~] #/Etc/init. d/iptables stop
-Bash:/etc/init. d/iptables: No such file or directory

 

Originally in RHEL7, systemctl was used to manage service programs, including service and chkconfig.

 

[Root @ rhel7 ~] # Systemctl list-unit-files | grep enabled
Cups. path enabled
Abrt-ccpp.service enabled
Abrt-oops.service enabled
Abrt-vmcore.service enabled
Abrt-xorg.service enabled
Abrtd. service enabled
Accounts-daemon.service enabled
Atd. service enabled
Auditd. service enabled
Avahi-daemon.service enabled
Bluetooth. service enabled
Chronyd. service enabled
Crond. service enabled
Cups. service enabled
Dbus-org.bluez.service enabled
Dbus-org.fedoraproject.FirewallD1.service enabled
Dbus-org.freedesktop.Avahi.service enabled
Dbus-org.freedesktop.ModemManager1.service enabled
Dbus-org.freedesktop.NetworkManager.service enabled
Dbus-org.freedesktop.nm-dispatcher.service enabled
Display-manager.service enabled
Dmraid-activation.service enabled
Firewalld. service enabled
Firstboot-graphical.service enabled
TPD. service enabled
Getty @. service enabled
Hypervkvpd. service enabled
Hypervvssd. service enabled
Irqbalance. service enabled
Iscsi. service enabled
Ksm. service enabled
Ksmtuned. service enabled
Libstoragemgmt. service enabled
Libmongod. service enabled
Lvm2-monitor.service enabled
Mdmonitor. service enabled
Microcode. service enabled
ModemManager. service enabled
Multipathd. service enabled
NetworkManager-dispatcher.service enabled
NetworkManager. service enabled
Nfs-lock.service enabled
Packagekit-offline-update.service enabled
Postfix. service enabled
Rhsmcertd. service enabled
Rngd. service enabled
Rpcbind. service enabled
Rsyslog. service enabled
Rtkit-daemon.service enabled
Smartd. service enabled
Spice-vdagentd.service enabled
Sshd. service enabled
Sysstat. service enabled
Systemd-readahead-collect.service enabled
Systemd-readahead-drop.service enabled
Systemd-readahead-replay.service enabled
Tuned. service enabled
Vmtoolsd. service enabled
Avahi-daemon.socket enabled
Cups. socket enabled
Dm-event.socket enabled
Iscsid. socket enabled
Iscsiuio. socket enabled
Lvm2-lvmetad.socket enabled
Rpcbind. socket enabled
Default.tar get enabled
Graphical.tar get enabled
Nfs.tar get enabled
Remote-fs.target enabled

 

Disable firewall

[Root @ rhel7 ~] # Systemctl stop firewalld. service
[Root @ rhel7 ~] # Systemctl disable firewalld. service
[Root @ rhel7 ~] # Systemctl status firewalld. service
Firewalld. service-firewalld-dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld. service; disabled)
Active: inactive (dead)

Jul 29 22:25:43 rhel7 systemd [1]: Started firewalld-dynamic firewall daemon.
Jul 29 22:43:29 rhel7 systemd [1]: Stopping firewalld-dynamic firewall daemon...
Jul 29 22:43:29 rhel7 systemd [1]: Stopped firewalld-dynamic firewall daemon.
Jul 29 22:44:14 rhel7 systemd [1]: Stopped firewalld-dynamic firewall daemon.
Jul 29 22:44:15 rhel7 systemd [1]: Stopped firewalld-dynamic firewall daemon.
Jul 29 22:44:19 rhel7 systemd [1]: Starting firewalld-dynamic firewall daemon...
Jul 29 22:44:19 rhel7 systemd [1]: Started firewalld-dynamic firewall daemon.
Jul 29 22:44:21 rhel7 systemd [1]: Stopping firewalld-dynamic firewall daemon...
Jul 29 22:44:21 rhel7 systemd [1]: Stopped firewalld-dynamic firewall daemon.
Jul 29 22:44:32 rhel7 systemd [1]: Stopped firewalld-dynamic firewall daemon.

 

Start a service: systemctl start firewalld. service
Disable a service: systemctl stop firewalld. service
Restart a service: systemctl restart firewalld. service
Displays the status of a service: systemctl status firewalld. service
Enable a service at startup: systemctl enable firewalld. service
Disable a service at startup: systemctl disable firewalld. service
Check if the service is started: systemctl is-enabled firewalld. service; echo $?
View the list of started Services: systemctl list-unit-files | grep enabled

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.