Disabling a Linux ECS Firewall and Adding a Port Exception on a Linux ECS Firewall
Scenarios
This section describes how to disable a Linux ECS firewall and add a port exception on a Linux ECS firewall.
Enabling a firewall and configuring a security group protect your ECSs. If you disable a firewall, exercise caution when you enable ports in the security group.
Disabling a Firewall
Run the following command to disable the firewall based on the ECS OS:
Adding a Port Exception on a Firewall
- CentOS 6
- CentOS 7
- Start the firewall.
systemctl start firewalld.service
Check whether the firewall is enabled.
firewall-cmd --state
Information similar to the following is displayed:
[root@ecs-centos7 ~]# firewall-cmd --state running
- For example, to add TCP port 23, run the following command:
firewall-cmd --zone=public --add-port=23/tcp --permanent
The configuration is correct if the command output is as follows:
[root@ecs-centos7 ~]# firewall-cmd --zone=public --add-port=23/tcp --permanent success
- Reload the policy configuration for the new configuration to take effect.
- Run the following command to view all enabled ports:
[root@ecs-centos7 ~]# firewall-cmd --list-ports 23/tcp
- (Optional) Configure the firewall to automatically start upon ECS startup.
systemctl enable firewalld.service
Check whether automatic firewall startup is enabled.
systemctl is-enabled firewalld.service;echo $?
The configuration is correct if the command output is as follows:
[root@ecs-centos7 ~]# systemctl is-enabled firewalld.service;echo $? enabled 0
To disable automatic firewall startup, run the following command:
systemctl disable firewalld.service
- Start the firewall.
Last Article: Disabling a Windows ECS Firewall and Adding a Port Exception on a Windows ECS Firewall
Next Article: Installing IIS
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.