Home  >  Article  >  Operation and Maintenance  >  How to use iptables to open specified ports under linux

How to use iptables to open specified ports under linux

王林
王林Original
2020-07-06 09:47:4018908browse

The method to use iptables to open a specified port under Linux is: 1. Execute the [/sbin/iptables -I INPUT -p tcp --dport 8000 -j ACCEPT] command to open the port; 2. Restart the service; 3. Check whether the port is open.

How to use iptables to open specified ports under linux

Open the network port that allows external access through the following command:

Open port 8000

/sbin/iptables -I INPUT -p tcp --dport 8000 -j ACCEPT

Save the configuration

/etc/rc.d/init.d/iptables save

Restart the service

/etc/rc.d/init.d/iptables restart

Check whether the port is open

/etc/init.d/iptables status

The above is the detailed content of How to use iptables to open specified ports under linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn