Home  >  Article  >  Operation and Maintenance  >  how to close linux port

how to close linux port

藏色散人
藏色散人Original
2020-03-11 13:26:103648browse

how to close linux port

How to close the linux port?

How to open and close ports in Linux

1. Check which ports are open netstat -anp

2. Close the port number :

iptables -A OUTPUT -p tcp --dport 端口号-j DROP

3. Open the port number:

iptables -A INPUT -ptcp --dport  端口号-j ACCEPT

4. Save the settings

service iptables save

5. The following is how to use the Linux open port command.

  nc -lp 23 &(打开23端口,即telnet)
  netstat -an | grep 23 (查看是否打开23端口)

6. Linux open port command Each open port needs a corresponding listening program

Recommended Linux video tutorial, learning address: https://www .php.cn/course/list/33.html

The above is the detailed content of how to close linux port. 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