Technology Encyclopedia Home >How to view the services and ports that a cloud server is using?

How to view the services and ports that a cloud server is using?

To view the services and ports used by a cloud server, you can follow these steps:

  1. Check Running Services:
    Use commands like netstat, ss, or lsof on the server to list active connections and listening ports.

    • Example with netstat:
      netstat -tuln
      
      This shows all listening TCP and UDP ports.
    • Example with ss (modern alternative):
      ss -tuln
      
  2. Identify Services:
    Cross-reference the port numbers with known services (e.g., port 80 for HTTP, 443 for HTTPS). Use lsof to see which process is using a port:

    lsof -i :80
    
  3. Firewall Rules:
    Check firewall configurations (e.g., iptables or firewalld) to see allowed ports:

    iptables -L -n
    
  4. Cloud Provider Tools:
    Use the cloud server’s management console or CLI to inspect security groups or network rules. For example, Tencent Cloud provides the Security Group feature under the CVM (Cloud Virtual Machine) console, where you can view and manage inbound/outbound rules for ports.

  5. Monitoring Tools:
    Deploy monitoring tools like nmap (from another machine) to scan the server’s open ports:

    nmap <server_ip>
    

For Tencent Cloud users, the CVM Console and Security Group settings provide a centralized way to manage and view port configurations. Additionally, Cloud Monitor can help track service and port usage metrics.