TH4. Telnet vs Ping - DevWithNehaCloud/Oracle-Cloud-Infrastructure-wiki GitHub Wiki
Telnet vs Ping in OCI
Overview
In OCI Networking troubleshooting, both Ping and Telnet are important tools, but both have different purposes.
| Feature | Ping | Telnet |
|---|---|---|
| Purpose | Checks network connectivity | Checks specific port/service connectivity |
| Protocol Used | ICMP | TCP |
| Checks | Whether the server is reachable | Whether a specific service port is open |
| Port Required | No | Yes |
| Common Usage | Basic network testing | Service/port testing |
| OCI Requirement | ICMP must be allowed | TCP port must be allowed |
1. Ping in OCI
What is Ping?
The ping command is used to check whether the destination server or IP address is reachable over the network.
It sends ICMP Echo Request packets and waits for a response.
OCI Example of Ping
Suppose:
- Instance A IP:
10.0.0.10 - Instance B IP:
10.0.1.20
From Instance A:
ping 10.0.1.20
Successful Ping Output
PING 10.0.1.20 (10.0.1.20) 56(84) bytes of data.
64 bytes from 10.0.1.20: icmp_seq=1 ttl=64 time=1.23 ms
64 bytes from 10.0.1.20: icmp_seq=2 ttl=64 time=1.10 ms
Meaning
- Network connectivity exists
- Routing is correct
- ICMP traffic is allowed
Ping Failure Example
Destination Host Unreachable
OR
Request timed out
Possible Reasons
- Security List blocks ICMP
- Route Table issue
- Instance is down
- Wrong subnet configuration
- Firewall blocks ICMP
OCI Requirement for Ping
ICMP must be allowed in:
- Security List
- NSG (Network Security Group)
- OS Firewall
Example Security Rule
| Source | Protocol | Type |
|---|---|---|
| 0.0.0.0/0 | ICMP | Echo Request |
2. Telnet in OCI
What is Telnet?
The telnet command is used to check connectivity to a specific TCP port.
It verifies whether a particular service is reachable.
OCI Example of Telnet
Suppose:
- Web Server IP:
10.0.1.20 - SSH Port:
22
Command:
telnet 10.0.1.20 22
Successful Telnet Output
Trying 10.0.1.20...
Connected to 10.0.1.20.
Escape character is '^]'.
SSH-2.0-OpenSSH_8.0
Meaning
- Server is reachable
- TCP Port 22 is open
- SSH service is running
Failed Telnet Output
Connection refused
OR
Unable to connect to remote host
Possible Reasons
- Port blocked in Security List/NSG
- Service is not running
- OS firewall blocks the port
- Wrong routing configuration
OCI Requirement for Telnet
TCP Port must be allowed in:
- Security List
- NSG
- OS Firewall
Example Rule
| Source | Protocol | Port |
|---|---|---|
| 0.0.0.0/0 | TCP | 22 |
Real OCI Troubleshooting Scenario
Scenario
You are unable to SSH into an OCI instance.
Step 1: Check Ping
ping 10.0.1.20
If Ping Fails
Possible Issues:
- Network issue
- Route Table issue
- ICMP blocked
If Ping Succeeds
Meaning:
- Network path is working correctly
Step 2: Check Telnet on Port 22
telnet 10.0.1.20 22
If Telnet Fails
Possible Issues:
- SSH Port blocked
- SSH Service stopped
- Firewall issue
If Telnet Succeeds
Meaning:
- Port is accessible
- SSH service is reachable
Key Difference Summary
| Ping | Telnet |
|---|---|
| Checks server reachability | Checks service/port reachability |
| Uses ICMP | Uses TCP |
| No port required | Port required |
| Can work even if service is down | Requires service to be running |
| Used for network troubleshooting | Used for application/service troubleshooting |
Simple Real-Life Analogy
| Tool | Analogy |
|---|---|
| Ping | Checking whether the house exists |
| Telnet | Checking whether a specific room door is open |
Conclusion
In OCI:
- Ping is used to verify basic network connectivity.
- Telnet is used to verify specific service port accessibility.
Both tools are very useful for troubleshooting:
- Security Lists
- NSGs
- Route Tables
- Gateways
- Firewalls
- Service Availability