CentOS 7.0 firewall and centos7.0 Firewall

Source: Internet
Author: User

CentOS 7.0 firewall and centos7.0 Firewall

CentOS 7.0 uses a firewall by default.

In addition, common firewalls include iptables firewalls.

Official firewall documentation: https: // Firewall

Firewall Configuration: firewalld Configuration
Stored in Various XML files in/usr/lib/firewalld/and/etc/firewalld.

1. Basic operations

Service firewalld restart service firewalld start enable service firewalld stop disable

2. view the Firewall Service Status

systemctl status firewall

View the Firewall Status

firewall-cmd --state

View firewall rules

firewall-cmd --list-all

Install the firewall command:

yum install firewalld firewalld-config

Common firewall port enabling commands:

firewall-cmd --zone=public --add-port=80/tcp --permanentfirewall-cmd --zone=public --add-port=443/tcp --permanentfirewall-cmd --zone=public --add-port=22/tcp --permanentfirewall-cmd --zone=public --add-port=21/tcp --permanentfirewall-cmd --zone=public --add-port=53/udp --permanent

Common firewall port shutdown commands:

firewall-cmd --zone=public --remove-port=80/tcp --permanentfirewall-cmd --zone=public --remove-port=443/tcp --permanentfirewall-cmd --zone=public --remove-port=22/tcp --permanentfirewall-cmd --zone=public --remove-port=21/tcp --permanentfirewall-cmd --zone=public --remove-port=53/udp --permanent

Batch add port range

firewall-cmd --zone=public --add-port=4400-4600/udp --permanentfirewall-cmd --zone=public --add-port=4400-4600/tcp --permanent

Enable the firewall command:

systemctl start firewalld.service

Restart firewall command:

Firewall-cmd -- reload or service firewalld restart

View the port list:

firewall-cmd --permanent --list-port

Disable Firewall

systemctl stop firewalld

Set startup

systemctl enable firewalld

Stop and disable startup

sytemctl disable firewalld

View status

Systemctl status firewalld or firewall-cmd -- state

3. How to add a port

Firwall-cmd -- permanent -- add-port = 9527/tcp 1, firwall-cmd: A tool provided by Linux to operate firewall; 2, -- permanent: indicates that the setting is persistent; 3. -- add-port: identifies the added port;
Reload takes effect. Set firewall-cmd -- reload.

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.