What is the command to ping a TCP port?
In order to help you understand the answer to your question, we must sit through a quick crash course on the OSI Model. – I call it, OSI Crash Course 101 :)
The OSI model is a 'virtual' model which helps us describe how computers and their protocols communicate between each other and what steps are required to be taken in order to construct a message and send it to the receiving end.
The OSI model is broken into 7 layers, or levels if you like:
---------------- | Application | <- Layer 7 ---------------- | Presentation | <- Layer 6 ---------------- | Session | <- Layer 5 ---------------- | Transport | <- Layer 4 (TCP,UDP) – Ports work on this level ---------------- | Network | <- Layer 3 (IP, ICMP) – 'Ping' works on this level ---------------- | Datalink | <- Layer 2 (ARP) ---------------- | Physical | <- Layer 1 ----------------
While I really can't draw, I'm sure you get the idea of the above diagram:)
Some protocols, I.E., TCP, UDP, work on the same layer, while others on different layers I.E., ICMP, IP, ARP, etc.
It is important here to understand that the layers these protocols work on are not random, but due to the way data communications work, as all of them require a few steps to be completed before certain data can be exchanged.
For example, if you wanted to read a page off searchnetworking.com, you need to know the IP Address of the server, before you can send the HTTP (Port 80) request to the Web server and download the page.
The Network layer is where we define an IP Address while, as it would be logical. The Port number, which allows you to select the service you need (HTTP), is located on Layer 4 - The Transport layer.
It is logical to firstly need to identify where you need to send you request (in other words, which IP Address), and then tell the host what service you require (http - port 80).
Now that you have a fair idea how IP Address and Ports work on the OSI Model, I can address your answer!
The 'Ping' command is a function the Internet Control Message Protocol (ICMP). A host cannot 'ping' a TCP port, simply because the ICMP protocol works on the Network Layer and does not 'communicate' in any way with the layer above, which is where your port is defined.
You can ping and IP Address, but not a port.
There are special programs to help you 'see' if a port is active or 'listening', these are the so called 'Port Scanners', where you define the IP Address and port number (or port range, I.E., ports 1 to 1024) which you would like to scan, and the program will scan these ports to see which one is open.
When such programs are scanning ports, they do not ping them, but simply try to establish a connection to them by sending a packet with the tcp 'SYN' flag set, which will cause the remote host to respond in the case the port is active.
I should state that in order to understand how all the above works, you must understand the OSI Model.
If you would like to read more about the OSI model and its protocols, simply visit www.Firewall.cx. The colorful diagrams and step by step analysis will help you with the learning process.
OSI Crash course 101 is now officially complete !
Dig Deeper on Network Infrastructure
Related Q&A from Chris Partsenidis
Expert Chris Partsenidis explains what iPerf is and how iPerf commands can help you measure your network's bandwidth, delay, jitter and potential for... Continue Reading
SFP ports enable Gigabit switches to connect to a wide variety of fiber and Ethernet cables in order to extend switching functionality throughout the... Continue Reading
Learn how to understand the difference between bit rate and baud rate in this expert answer. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.