Tools: Update: Troubleshooting Datacenter: Resolving Apache Service Reachability On Server

Tools: Update: Troubleshooting Datacenter: Resolving Apache Service Reachability On Server

Investigating with Telnet

SSH Into Server

Resolving Port Binding Conflicts

Ensure Network Access

Final End-to-End Verification A server was supposed to be serving web content via Apache on port 5002, anyone trying to connect was met with a "No route to host" or "Connection refused" error. Here is a breakdown of how to investigate and eventually restore the service. The telnet command in Linux is a networking tool used to communicate with a remote host using the TELNET protocol. While it was originally designed for remote login and management, its lack of encryption (sending data like passwords in plain text) has made it largely obsolete for that purpose there. For secure remote access, always use the SSH (ssh) command instead.

Today, it is primarily used as a quick diagnostic tool to check if a specific TCP port is open and reachable on a remote server. The standard command structure is: hostname/Ip: The address of the remote server port: The target service port (e.g., 80 for HTTP). If omitted, it defaults to port 23. To Exit/Close, Type quit at the telnet> prompt and press Enter. To log into a remote server: A port binding conflict in Linux occurs when a service or application attempts to listen on a network port that is already in use by another process, preventing the new service from starting. Here is the technical workflow used to resolve binding conflicts. To Stop the service or kill the process ID Adjusting Network Access Rules using iptables. A running service does not guarantee external reachability if the system's firewall blocks incoming traffic. Explicitly add a rule to allow ingress TCP traffic on port 5002. This bridges the gap between the service being "up" and the service being "accessible." The final stage is the verification of the fix from an external source, typically the Jump Host (a secure intermediary server used to access and manage devices in a separate, secure, or private network zone). Using curl provides a definitive test of the entire communication stack. Investigate using telnet Identified and terminated the unauthorized process occupying port 5002, successfully releasing the port bind for the web service using ss. Re-initialized the Apache service after verifying configuration alignment, ensuring it was successfully listening on the designated port using systemctl. Updated the iptables configuration to explicitly permit external ingress traffic on port 5002, bridging the gap between local service activity and external accessibility. Confirmed full restoration of the communication path via curl from the jump host, verifying that the web server is once again reachable and performing as expected using curl. Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to ? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse

Code Block

Copy

telnet [hostname/server_ip] [port] telnet [hostname/server_ip] [port] telnet [hostname/server_ip] [port] ssh username@server_ip ssh username@server_ip ssh username@server_ip sudo systemctl status httpd sudo systemctl status httpd sudo systemctl status httpd sudo systemctl start httpd sudo systemctl start httpd sudo systemctl start httpd Address already in use [user@hostname ~]$ sudo ss -tulnp | grep 5002 tcp LISTEN 0 10 127.0.0.1:5002 0.0.0.0:* users:(("sendmail",pid=19948,fd=4)) [user@hostname ~]$ sudo ss -tulnp | grep 5002 tcp LISTEN 0 10 127.0.0.1:5002 0.0.0.0:* users:(("sendmail",pid=19948,fd=4)) [user@hostname ~]$ sudo ss -tulnp | grep 5002 tcp LISTEN 0 10 127.0.0.1:5002 0.0.0.0:* users:(("sendmail",pid=19948,fd=4)) sudo systemctl stop sendmail # If it won't stop, kill the PID manually: sudo kill -9 19948 sudo systemctl stop sendmail # If it won't stop, kill the PID manually: sudo kill -9 19948 sudo systemctl stop sendmail # If it won't stop, kill the PID manually: sudo kill -9 19948 sudo systemctl start httpd sudo systemctl start httpd sudo systemctl start httpd sudo systemctl restart httpd sudo systemctl restart httpd sudo systemctl restart httpd sudo iptables -I INPUT -p tcp --dport 5002 -j ACCEPT sudo iptables -I INPUT -p tcp --dport 5002 -j ACCEPT sudo iptables -I INPUT -p tcp --dport 5002 -j ACCEPT curl http://[hostname/server_ip]:port curl http://[hostname/server_ip]:port curl http://[hostname/server_ip]:port - hostname/Ip: The address of the remote server - port: The target service port (e.g., 80 for HTTP). If omitted, it defaults to port 23. - Check Apache Status using: - If Apache wasn't Running, Start it: - If The output revealed that another process was using port 5002, causing Apache to fail with the error Address already in use. - Scan for conflict: - Resolution: After identifying the conflicting Process ID (PID), terminate the process to release the bind, allowing the port to become available for its intended service (from the above sendmail is the service with pid=19948 that is conflicting with our Apache on host 5002). - Start or Restart Apache: - Final Test: Use the curl utility to request the server's URL - Result: A successful return of the site's HTML content confirms that the service is running, correctly bound to the port, and bypasses the firewall correctly - Investigate using telnet - Identified and terminated the unauthorized process occupying port 5002, successfully releasing the port bind for the web service using ss. - Re-initialized the Apache service after verifying configuration alignment, ensuring it was successfully listening on the designated port using systemctl. - Updated the iptables configuration to explicitly permit external ingress traffic on port 5002, bridging the gap between local service activity and external accessibility. - Confirmed full restoration of the communication path via curl from the jump host, verifying that the web server is once again reachable and performing as expected using curl.