kholofelo Maloma
kholofelo Maloma

Reputation: 1003

Is there a way to check if a certain port is open on server?

Just as you'd ping an IP of to a server to check if it is up, can we also check if, on that running server, a port is active/open?

this just comes from my head,but can you be more specific in your ping statement?

 `ping 127.0.0.1:7004`

I know this command is not allowed, but is there a way to check for this in Linux and Windows?

Upvotes: 8

Views: 39945

Answers (5)

arbilgin
arbilgin

Reputation: 1

$ docker run -it --rm --network host networkstatic/nmap localhost

Upvotes: 0

Michail Gede
Michail Gede

Reputation: 41

As telnet is disabled by most corporate customers, i found that powershell command on windows machines for TCP quite useful: New-Object System.Net.Sockets.TcpClient("server", port)

Upvotes: 3

bratkartoffel
bratkartoffel

Reputation: 1177

For TCP-Ports you can simple use telnet or nc to establish a connection. If it succeeds, the port is open.

But as UDP is stateless you cannot check that simple for an open port. You have to know which service is behind this port and know how to send a valid packet so you get an answer.

Upvotes: 0

Amit
Amit

Reputation: 13364

That depends upon your access to system (client or server), You can use either of two options,

  1. Server side you can use netstat -an to check which ports are listening
  2. From outside use just telnet host port, if it is not working on linux machines try telnet host:port.

Upvotes: 6

pcnate
pcnate

Reputation: 1774

If you are willing and able to install software, you can use nmap

nmap -p 7004 127.0.0.1

Or if it is internet facing, use a web service such as http://www.yougetsignal.com/tools/open-ports/

Upvotes: 9

Related Questions