做网站银川,常熟seo关键词优化公司,随州seo,wordpress 本地 域名绑定前段时间有人问uos没有telnet#xff0c;又找不到包。 追问了一下为什么非要安装telnet#xff0c;答复是要测试对端的端口号。
这里简单介绍一下#xff0c;测试端口号的方法有很多#xff0c;telent只是在windows上经常使用#xff0c;linux已很少安装并使用该命令又找不到包。 追问了一下为什么非要安装telnet答复是要测试对端的端口号。
这里简单介绍一下测试端口号的方法有很多telent只是在windows上经常使用linux已很少安装并使用该命令因为telnet本身是非加密传输早已被ssh替代。
下面介绍一下linux测试对端端口是否启用的方法 我们先找2台测试虚拟机 A虚拟机172.20.20.10 B虚拟机172.20.20.20
一、我们首先使用nc命令在A虚拟机上启用要测试的端口
rootmaster:~# nc -l 9090
二、查看A虚拟机的9090端口是否监听
rootmaster:~# ss -ntlp
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:* users:((systemd-resolve,pid828,fd14))
LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:((sshd,pid894,fd3))
LISTEN 0 1 0.0.0.0:9090 0.0.0.0:* users:((nc,pid3791,fd3))
LISTEN 0 4096 127.0.0.1:32907 0.0.0.0:* users:((containerd,pid861,fd14))
LISTEN 0 128 [::]:22 [::]:* users:((sshd,pid894,fd4))
rootmaster:~# ps -ef|grep 3791
root 3791 2890 0 01:18 pts/0 00:00:00 nc -l 9090
root 3855 2960 0 01:20 pts/1 00:00:00 grep --colorauto 3791
rootmaster:~# 三、使用ssh命令在B虚拟机测试对方9090端口是否启用 可以看到下面输入结果中的 Connection established. 说明端口连接成功。 rootwork1:~# ssh -v 172.20.20.10 -p 9090
OpenSSH_8.9p1 Ubuntu-3ubuntu0.1, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 172.20.20.10 [172.20.20.10] port 9090.
debug1: Connection established.
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
四、回到A虚拟机查看nc命令的状态也能看的出连接建立成功
rootmaster:~# nc -l 9090SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.1