CentOS7.1 configure the firewall

Source: Internet
Author: User
// View firewalld [root @ wode006sysconfig] # systemctlstatusfirewalld. servicefirewalld. service-firewalld-dynamicfirewalldaemonLoaded: loaded (/usr/lib/systemd/syst

// View firewalld

[Root @ wode006 sysconfig] # systemctl status firewalld. service

Firewalld. service-firewalld-dynamic firewall daemon

Loaded: loaded (/usr/lib/systemd/system/firewalld. service; enabled)

Active: active (running) since 4 15:19:05 CST; 1 day 10 h ago

Main PID: 901 (firewalld)

CGroup:/system. slice/firewalld. service

Capacity-901/usr/bin/python-Es/usr/sbin/firewalld -- nofork -- nopid

 

July 02 15:19:04 wode006 systemd [1]: Starting firewalld-dynamic firewall .....

July 02 15:19:05 wode006 systemd [1]: Started firewalld-dynamic firewall d... n.

Hint: Some lines were ellipsized, use-l to show in full.

[Root @ wode006 sysconfig] #

 

// Disable firewalld

[Root @ wode006 sysconfig] # systemctl stop firewalld. service

[Root @ wode006 sysconfig] # systemctl status firewalld. service

Firewalld. service-firewalld-dynamic firewall daemon

Loaded: loaded (/usr/lib/systemd/system/firewalld. service; enabled)

Active: inactive (dead) since six 01:29:24 CST; 2 s ago

Main PID: 901 (code = exited, status = 0/SUCCESS)

 

July 02 15:19:04 wode006 systemd [1]: Starting firewalld-dynamic firewall .....

July 02 15:19:05 wode006 systemd [1]: Started firewalld-dynamic firewall d... n.

July 04 01:29:23 wode006 systemd [1]: Stopping firewalld-dynamic firewall .....

July 04 01:29:24 wode006 systemd [1]: Stopped firewalld-dynamic firewall d... n.

Hint: Some lines were ellipsized, use-l to show in full.

[Root @ wode006 sysconfig] #

 

// Disable firewalld startup

[Root @ wode006 sysconfig] # systemctl disable firewalld. service

Rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'

Rm '/etc/systemd/system/basic.tar get. wants/firewalld. service'

[Root @ wode006 sysconfig] # systemctl status firewalld. service

Firewalld. service-firewalld-dynamic firewall daemon

Loaded: loaded (/usr/lib/systemd/system/firewalld. service; disabled)

Active: inactive (dead)

 

July 02 15:19:04 wode006 systemd [1]: Starting firewalld-dynamic firewall .....

July 02 15:19:05 wode006 systemd [1]: Started firewalld-dynamic firewall d... n.

July 04 01:29:23 wode006 systemd [1]: Stopping firewalld-dynamic firewall .....

July 04 01:29:24 wode006 systemd [1]: Stopped firewalld-dynamic firewall d... n.

Hint: Some lines were ellipsized, use-l to show in full.

[Root @ wode006 sysconfig] #

 

// Install iptables

[Root @ wode006 sysconfig] # yum install iptables-services

Loaded plug-ins: fastestmirror, langpacks

Repository base is listed more than once in the configuration

Repository updates is listed more than once in the configuration

Repository extras is listed more than once in the configuration

Repository centosplus is listed more than once in the configuration

Repository base is listed more than once in the configuration

Repository updates is listed more than once in the configuration

Repository extras is listed more than once in the configuration

Repository centosplus is listed more than once in the configuration

Loading mirror speeds from cached hostfile

Resolving dependency

--> Checking the transaction

---> The package iptables-services.x86_64.0.1.4.21-13.el7 will be installed

--> Dependency resolved

 

// Configure iptables

[Root @ wode006 sysconfig] # vi/etc/sysconfig/iptables

[Root @ wode006 sysconfig] #

# Allowed ssh

-A input-p tcp-m state -- state NEW-m tcp -- dport 22-j ACCEPT

 

 

// Restart the firewall

[Root @ wode006 sysconfig] # service iptables restart

Redirecting to/bin/systemctl restart iptables. service

[Root @ wode006 sysconfig] # systemctl restart iptables. service

[Root @ wode006 sysconfig] #

 
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.