How to open a port in CentOS

Source: Internet
Author: User
In CentOS system usage, we will encounter many problems. For example, if the CentOS system is installed, only port 22 is enabled by default. if you want to open other ports, you need to open the required ports. For example, how do I enable http's default port 80? Next, we will introduce a method for you and hope you will have a good experience. First, we need to use the CentOS system, and we will encounter many problems. For example, if the CentOS system is installed, only port 22 is enabled by default. if you want to open other ports, you need to open the required ports. For example, how do I enable http's default port 80? Next, we will introduce a method for you and hope you will have a good experience.

First, Edit Iptables
Vi/etc/sysconfig/iptables
Vi/etc/sysconfig/iptables

Then add
-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport3001-j ACCEPT
-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport3001-j ACCEPT

Finally, the CentOS system needs to restart the service.
/Sbin/service iptables restart
/Sbin/service iptables restart

Check whether the port is open
/Sbin/iptables-L-n
In this way, we can open the port under the CentOS system. I hope you will have some gains.
Related Article

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.