检测端口是否被监听

telnet

telnet ip port
telnet 127.0.0.1 3306

# 存在以下提示表示连接失败
# telnet: connect to address 127.0.0.1: Connection refused

curl

curl http://ip:port
curl http://10.10.10.10:3306

# 存在以下提示表示连接成功
# curl: (1) Received HTTP/0.9 when not allowed
# curl: (56) Recv failure: Connection reset by peer

# 存在以下提示表示连接失败
# curl: (7) Failed to connect to localhost port 3306: Connection refused

ssh

ssh -v ip -p port
ssh -v 10.10.10.10 -p 1522

# 存在以下提示表示连接成功
# debug1: Connection established

# 存在以下提示表示连接失败
# debug1: connect to address 10.10.10.10 port 1522: No route to host