How To Open Ports Via Command Line

Table of contents:

How To Open Ports Via Command Line
How To Open Ports Via Command Line

Video: How To Open Ports Via Command Line

Video: How To Open Ports Via Command Line
Video: PC with Windows 10, 8 7 Open or Close Ports with CMD. 2024, May
Anonim

In Microsoft Windows OS, remote opening of ports is performed using the specialized utility Netsh, which is designed to change the configuration of network parameters. You can access it through the command line.

How to open ports via command line
How to open ports via command line

Instructions

Step 1

Open the main menu of the Microsoft Windows operating system by clicking "Start". Select the "Run" line (for OS Windows up to XP) and enter the cmd value in the window that opens. If your operating system is Windows Vista or higher, then on the left side of the menu, find the search bar, in which enter the same command.

Step 2

Call the context menu of the command line by right-clicking. From the list that appears, select "Run as administrator" and enter: - netsh value (for OS Windows up to XP); - netsh advfirewall value (for Windows OS versions Vista or higher). The same value can also be entered in the interpreter text field teams.

Step 3

Do not forget that in order to open ports remotely, you need to have not just authorized access to the computer, but access with administrator rights. Log in with an administrator account and enter, for example, in Windows Server 2008, netsh advfirewall set machine win2008-2 at a command prompt. Press the Enter key.

Step 4

To open the port, write the following on the command line: netsh advfirewall firewall (or netsh) add rule name = application_name dir = in action = allowprotocol = TCP localport = portnumber After you have entered the required values, press Enter.

Step 5

Determine the base and current configuration of the IP address, gateway, subnet mask, and DNS server. To do this, enter netsg interface ip show config on the command line. Hit Enter. Check if these values are the same as previously set (for static IP addresses) and if the DNS server configuration has changed (for dynamic IP addresses).

Step 6

If you want to check the security level of the IP address and the availability of ports on your computer, use the Windows firewall enable / disable option. To do this, enter the following into the command line: netsh advfirewall set currentprofile state on or netsh advfirewall set currentprofile state off and press Enter.

Recommended: