Summary of the methods for opening ports in Linux and the summary of opening ports in linux

Source: Internet
Author: User

Summary of the methods for opening ports in Linux and the summary of opening ports in linux

Open Port method:

Method 1: Command Line
? ? ? ? ? ? ? ? 1. Open PORT command:/sbin/iptables-I INPUT-p tcp -- dport 8080-j ACCEPT
? ? ? ? ? ? ? ? 2. save:/etc/rc. d/init. d/iptables save
? ? ? ? ? ? ? ? 3. restart the service:/etc/init. d/iptables restart
? ? ? ? ? ? ? ? 4. Check whether the port is open:/sbin/iptables-L-n
? ??

? Method 2: directly edit the/etc/sysconfig/iptables File
? ? ? ? ? ? ? ? 1. Edit the/etc/sysconfig/iptables file: vi/etc/sysconfig/iptables
? ? ? ? ? ? ? ? ? ? Add content and save:-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 8080-j ACCEPT
? ? ? ? ? ? ? ? 2. restart the service:/etc/init. d/iptables restart
? ? ? ? ? ? ? ? 3. Check whether the port is open:/sbin/iptables-L-n

However, I couldn't save it all the time. I found that iptables save is not required to directly modify the file on the internet, and I restarted iptables to reload the configuration. Iptables save writes the current iptables to/etc/sysconfig/iptables. I don't need to save the restart directly, so I suggest using method 2.

?

Run the following command to check whether the port has a process daemon: grep, for example, 80 is the port number.
For example, netstat-NCLP | grep 80

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.