To view the services and ports used by a cloud server, you can follow these steps:
Check Running Services:
Use commands like netstat, ss, or lsof on the server to list active connections and listening ports.
netstat:netstat -tuln
This shows all listening TCP and UDP ports.ss (modern alternative):ss -tuln
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
Firewall Rules:
Check firewall configurations (e.g., iptables or firewalld) to see allowed ports:
iptables -L -n
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.
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.