Linux Open Ports

Source: Internet
Author: User

It is important to note that the firewall is managed by iptables in CentOS 6 and the firewall is managed by FIREWALLD in CentOS 7.

1. In CentOS 7

Use the following command

Firewall-cmd [--zone=<zone>]--add-port=<port>[-<port>]/<protocol> [--timeout=<seconds ;]

As an example,

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

Explain:

--zone Scope

--ADD-PROT=8080/TCP Port/Communication protocol

--permanent is permanently active and will not expire if this parameter is not restarted

Executing the command prompt success indicates that the add succeeds, at this point if the query will find that port 8080 is not released because the firewall needs to be restarted

2. In CentOS 6:

If you are accustomed to iptables, you can also install Iptables-service in CentOS 7

Yum Install iptables-Services#  set boot systemctl enable iptables

Also take open 8080 port as an example

Execute vim /etc/sysconfig/iptables command

Add in File

-A input-p tcp-m state–state new-m tcp–dport 8080-j ACCEPT

Restart Iptables When you are finished modifying

Service Iptables Restart

Execute iptables-l command to view firewall rules

Linux Open Ports

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.