Home  >  Article  >  What is the cmd command to open a port?

What is the cmd command to open a port?

藏色散人
藏色散人Original
2020-03-04 08:55:4224344browse

What is the cmd command to open a port?

What is the cmd command to open a port?

View port

To view the port in Windows 2000/XP/Server 2003, you can use the Netstat command:

Click " Start → Run", type "cmd" and press Enter to open the command prompt window. Type "netstat -a -n" in the command prompt and press the Enter key to see the port number and status of the TCP and UDP connections displayed in numerical form.

Netstat command usage

Command format: Netstat -a -e -n -o -s-an

-a means to display all activities TCP connections and the TCP and UDP ports that the computer listens on.

-e means displaying the number of bytes sent and received by Ethernet, the number of data packets, etc.

-n indicates that only the addresses and port numbers of all active TCP connections are displayed in numerical form.

-o means display active TCP connections and include the process ID (PID) of each connection.

-s means displaying statistical information of various connections by protocol, including port numbers.

-an View all open ports

Close the port

For example, to close port 25 of the SMTP service in Windows 2000/XP, you can do this : First open the "Control Panel", double-click "Administrative Tools", and then double-click "Services". Then find and double-click the "Simple Mail Transfer Protocol (SMTP)" service in the service window that opens, click the "Stop" button to stop the service, then select "Disabled" in the "Startup Type", and finally click "OK" ” button. In this way, closing the SMTP service is equivalent to closing the corresponding port.

Open the port

If you want to open the port, just select "Automatic" in the "Startup type", click the "OK" button, and then open the service. Click the "Start" button in "Service Status" to enable the port. Finally, click the "OK" button.

Tip: There is no "Service" option in Windows 98. You can use the firewall's rule setting function to close/open the port.

The above is the detailed content of What is the cmd command to open a 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