Home >Operation and Maintenance >Linux Operation and Maintenance >How to use iptables to open specified ports under linux
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.
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!