Common firewall commands in CentOS 7
Common firewall commands
Enable services in the region
Firewall-cmd -- permanent [-- zone = This will permanently enable services in the region. If no region is specified, the default region is used. A service in the disabled Area
The CentOS 7 system turns on the firewall by default and does not open ports such as 80 and 8080.Therefore, after configuring Tomcat and Nginx today, they will not be able to access each other properlyAccess 80 and 8080 ports are reported: 502 error. (Bad Gateway) query the data to know the cause of the firewall.The search learned the following command:Systemctl
Turn on the Redis port and modify the firewall configuration file Vi/etc/sysconfig/iptablesJoin Port Configuration-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 6379-j ACCEPT-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 6379:7000-j ACCEPT//Open ports between 6379 and 7000Service Iptables SaveService Iptables RestartCentOS 7.0 defaults
[Email protected] ~]# service FIREWALLD restartRedirecting To/bin/systemctl restart Firewalld.serviceJob for Firewalld.service failed because the control process exited with error code. See "Systemctl Status Firewalld.service" and "Journalctl-xe" for details.[Email protected] ~]# Systemctl firewalld restartUnknown operation ' Firewalld '.[[Email protected] ~]# service FIREWALLD stopRedirecting To/bin/systemctl Stop Firewalld.service[[Email protected]
First, configure the firewall, open 80 ports, 3306 ports
CentOS 7.0 uses firewall as a firewall by default, and this is iptables firewall instead.
1. Close firewall:
#停止firewall服务System
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
Disable the default firewall in CentOS 7.0 and enable the iptables firewall.
Operating System Environment: CentOS Linux release 7.0.1406 (Core) 64-bitCentOS 7.0 uses firewall as the firewall by default. Here we change it to iptabl
Disable the CentOS 6 and CentOS 7 firewalls.
CentOS6.5 view the Firewall Status:
1
[Linuxidc @ localhost ~] $ Service iptable status
Display result:
1 2 3 4 5
[Linuxidc @ localhost ~] $ Service iptable status Redirecting to/bin/systemctl status iptable. service ● iptable. service Loaded: n
Enable iptables firewall for CentOS and iptables for centos
In fact, these things should be clearly written as soon as they are completed. They have been written for a long time. Maybe they have not been written in some places. I hope to see the kids shoes for help and I will update them again, if any error occurs, please criticize and correct it.
I used iptables
Set up an FTP server on centos 7 and set up ftp on centos 7Note: This article refers to the CSDN blogger xiaocia's article 《Build an FTP server on CentOS7To verify the feasibility. However, there is one drawback:
After linux is restarted, ftp cannot be accessed. I have also provided correction methods for this. For details, refer to section
/iptables stop
You can also directly modify the Firewall Configuration:
Configure the firewall and enable port 80 and port 3306.
Vim/etc/sysconfig/iptables
-A input-M state -- state new-m tcp-p tcp -- dport 80-J accept # Allow port 80 to pass the Firewall
-A input-M state -- state new-m tcp-p tcp -- dport 3306-
1. Iptables configuration file ¶
The default configuration file in the Rhel/centos/fedora Linux distribution is:
The/etc/sysconfig/iptables– system execution script activates the firewall function by reading the file.2. Basic operations: displaying default rules ¶
In the Command Line window, enter the following directive:
Iptables--line-numbers-n-LWhere the –line-numbers parameter is preceded by a numbe
Share common linux commands on centos 7 and centos 7
I. Preface
Linux is vast and sea-like, and the linux knowledge required for server deployment is not much. The following is a common command for deploying projects on centOS7 ECs for linux development, as a simple summary.
Ii. File Processing
1. Display
Ls (ls: list)
Enter the command./mysqld -- initialize -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data
Generate a data Directory, which indicates that the database has been initialized successfully.
And the root user of mysql generates a temporary password: (record the temporary password XXX)
2. Database Encryption
Enter the command./mysql_ssl_rsa_setup -- datadir =/usr/local/mysql/data
3. Start mysql
Enter the command./mysqld_safe -- user = mysql ( indicates submitting to t
Enable, disable, and open the specified port of the CentOS 6.2 firewall. d/iptables stop: View 114 again at www.2cto.com. 80. *. *: 8080 (ip: 8080) was successful. However, it seems that security risks are greatly increased ...... Use/etc/init. d/iptables status to view the firewall information. The opened port is disp
configure the iptables firewall in CentOS. Let's learn how to configure it!
I mentioned in my blog that firewall configuration is never recommended.
Set the firewall in Linux. Take CentOS as an example to open the iptables configuration file:
Vi/etc/sysconfig/iptables
Run
Getting started with Linux: Enable the port on CentOS or RHEL Firewall
Q: I am running a web page or file server on CentOS and want to remotely access the server. Therefore, I need to change the firewall rules to allow access to a TCP port on the system. So, how can I enable the TCP/UDP port on the
statusTemporarily disable the Firewall:/Etc/init. d/iptables stopRestart iptables:/Etc/init. d/iptables restart
Problem: If the firewall cannot be started, the status is not running. Check whether the/etc/sysconfig/iptables firewall initialization file exists. If not, initialize the Firewall:
Step 2: Log on to the
Reprinted from: https://linux.cn/article-4243-1.htmlIf you want to provide services on the server, Enterprise Linux distributions such as CentOS or Rhel contain built-in powerful firewalls, which are strictly the default firewall rules. Therefore, if you install any custom services (such as Web servers, NFS, and Samba), then their traffic is likely to be blocked by fire
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.