CentOS 7 Open Port and centos Open Port

Source: Internet
Author: User

CentOS 7 Open Port and centos Open Port

After CentOS is upgraded to 7, iptables cannot be used to control the Linuxs port, because CentOS 7 uses firewalld instead of the original iptables. The following describes how to use firewalld to open a Linux Port:

1. check whether a port is open
[Root @ localhost bin] # firewall-cmd -- query-port = 8080/tcpno
2. Enable a port permanently

Firewall-cmd -- zone = public -- add-port = 8080/tcp -- permanent

[Root @ localhost bin] # firewall-cmd -- add-port = 8080/tcp -- permanentsuccess

Or:

[Root @ localhost bin] # firewall-cmd -- zone = public -- add-port = 8080/tcp -- permanent
3. open multiple ports at the same time
[Root @ localhost taotao] # firewall-cmd -- zone = public -- add-port = 30000-30999/tcp -- permanent [root @ localhost taotao] # firewall-cmd -- reload

Command description:

-- Zone # Scope

-- Add-port = 80/tcp # add a port in the format of port/communication protocol

-- Permanent # takes effect permanently. If this parameter is not set, it becomes invalid after restart.

4. Restart the Firewall

[Root @ localhost bin] # firewall-cmd -- reloadsuccess

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.