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