1. 如何测试端口通不通
1、使用telnet判断
telnet是windows标准服务,可以直接用;如果是linux机器,需要安装telnet.
用法: telnet ip port
1)先用telnet连接不存在的端口
[root@localhost ~]# telnet 10.0.250.3 80
Trying 10.0.250.3...
telnet: connect to address 10.0.250.3: Connection refused #直接提示连接被拒绝
2)再连接存在的端口
[root@localhost ~]# telnet localhost 22
Trying ::1...
Connected to localhost. #看到Connected就连接成功了
Escape character is '^]'.
SSH-2.0-OpenSSH_5.3
a
Protocol mismatch.
Connection closed by foreign host.
2、使用ssh判断
ssh是linux的标准配置并且最常用,可以用来判断端口吗?
用法: ssh -v -p port username@ip
-v 调试模式(会打印日志).
-p 指定端口
username可以随意
1)连接不存在端口
[root@localhost ~]# ssh 10.0.250.3 -p 80
ssh: connect to host 10.0.250.3 port 80: Connection refused
[root@localhost ~]# ssh 10.0.250.3 -p 80 -v
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 10.0.250.3 [10.0.250.3] port 80.
debug1: connect to address 10.0.250.3 port 80: Connection refused
ssh: connect to host 10.0.250.3 port 80: Connection refused
2)连接存在的端口
[root@localhost ~]# ssh ... -p
a
^]
^C
[root@localhost ~]# ssh ... -p -v
OpenSSH_.p, OpenSSL ..e-fips Feb
debug: Reading configuration data /etc/ssh/ssh_config
debug: Applying options for *
debug: Connecting to ... [...] port .
debug: Connection established.
debug: permanently_set_uid: /
debug: identity file /root/.ssh/identity type -
debug: identity file /root/.ssh/identity-cert type -
debug: identity file /root/.ssh/id_rsa type -
debug: identity file /root/.ssh/id_rsa-cert type -
debug: identity file /root/.ssh/id_dsa type -
debug: identity file /root/.ssh/id_dsa-cert type -
a
^C
不用-v选项也可以咯
3、使用wget判断
wget是linux下的下载工具,需要先安装.
用法: wget ip:port
1)连接不存在的端口
[root@localhost ~]# wget ...:
---- ::-- http://.../
Connecting to ...:... failed: Connection refused.
2)连接存在的端口
[root@localhost ~]# wget ...:
---- ::-- http://...:/
Connecting to ...:... connected.
HTTP request sent, awaiting response...
2. 如何检测远程ip上的端口是否开启
1、安装telnet组件。进入控制面板里面的程序,接着进入打开或关闭windows功能,把telnet客户端和telnet服务器勾选上,这样就安装好了telnet组件了。
3. 怎样判断服务器的端口是否打开
WINDOWS下查看端口方法:
在命令提示符状态下键入“netstat -a -n”,按下回车键后就可以看到以数字形式显示的TCP和UDP连接的端口号及状态。
Netstat命令用法如下:
命令格式:Netstat -a -e -n -o -s-an
-a 表示显示所有活动的TCP连接以及计算机监听的TCP和UDP端口。
-e 表示显示以太网发送和接收的字节数、数据包数等。
-n 表示只以数字形式显示所有活动的TCP连接的地址和端口号。
-o 表示显示活动的TCP连接并包括每个连接的进程ID(PID)。
-s 表示按协议显示各种连接的统计信息,包括端口号。
-an 查看所有开放的端口
LINUX下查看端口方法:
建议用nmap查看,“nmap 127.0.0.1”若没安装可 yum nmap安装
4. ubuntu怎么查看ssh端口
在 etc/ssh 下面有个 ssh_config的文件
使用vim或者vi打开
里面有个port 这里就是ssh对外开放的端口
如果前面有#代表这个使用的是默认端口
如果不想使用默认端口把井号去掉Port xxxx顶头写就行了
注意:Port一定要顶头,不能有空格
5. 如何修改Linux服务器ssh端口
ssh 服务器软件配置文件在 /etc/ssh/ 目录下 步骤如下
1.进入到此目录
# cd /etc/ssh
2.编辑其配置文件sshd_config
# vim sshd_config
3.在里边找到一行 #Port 22 此行很靠前,几乎就在文件的开头处不远,将此行的#号去掉
然后就是后边加你想要改成为的端口号 我这里就改成了2343
Port 2343
4.重新启动 sshd服务
# servicd sshd restart
5.到此ssh端口更改为2343
注意连接ssh时要相应更改端口号
如 ssh 192.168.11.122 2343
6. 如何查看linux中的ssh端口开启状态
需要准备的材料分别是:电脑、linux连接工具。
1、首先连接上linux主机,进入等待输入指令的linux命令行状态。
7. 如何用linux查看服务器器的端口
在Linux中查找服务的端口
方法1:使用grep命令
要使用grep命令在Linux中查找指定服务的默认端口号,只需运行:
$grep<port>/etc/services
例如,要查找SSH服务的默认端口,只需运行:
$grep ssh/etc/services
就这么简单。此命令应该适用于大多数Linux发行版。以下是我的Arch Linux测试机中的示例输出:
ssh 22/tcp
ssh 22/udp
ssh 22/sctp
sshell 614/tcp
sshell 614/udp
netconf-ssh 830/tcp
netconf-ssh 830/udp
sdo-ssh 3897/tcp
sdo-ssh 3897/udp
netconf-ch-ssh 4334/tcp
snmpssh 5161/tcp
snmpssh-trap 5162/tcp
tl1-ssh 6252/tcp
tl1-ssh 6252/udp
ssh-mgmt 17235/tcp
ssh-mgmt 17235/udp
正如你在上面的输出中所看到的,SSH服务的默认端口号是22。
让我们找到Apache Web服务器的端口号。为此,命令是:
$grep http/etc/services
#http://www.iana.org/assignments/port-numbers
http 80/tcp www www-http#WorldWideWeb HTTP
http 80/udp www www-http#HyperText Transfer Protocol
http 80/sctp#HyperText Transfer Protocol
https 443/tcp#http protocol over TLS/SSL
https 443/udp#http protocol over TLS/SSL
https 443/sctp#http protocol over TLS/SSL
gss-http 488/tcp
gss-http 488/udp
webcache 8080/tcp http-alt#WWW caching service
webcache 8080/udp http-alt#WWW caching service
[...]
FTP端口号是什么?这很简单!
$grep ftp/etc/services
ftp-data 20/tcp
ftp-data 20/udp
#21 is registered to ftp,but also used by fsp
ftp 21/tcp
ftp 21/udp fsp fspd
tftp 69/tcp
[...]
方法2:使用getent命令
如你所见,上面的命令显示指定搜索词“ssh”、“http”和“ftp”的所有端口名称和数字。这意味着,你将获得与给定搜索词匹配的所有端口名称的相当长的输出。
但是,你可以使用getent命令精确输出结果,如下所示:
$getent services ssh
ssh 22/tcp
$getent services http
http 80/tcp www www-http
$getent services ftp
ftp 21/tcp
如果你不知道端口名称,但是知道端口号,那么你只需将端口名称替换为数字:
$getent services 80
http 80/tcp
要显示所有端口名称和端口号,只需运行:
$getent services
8. 如何检测(远程)主机上的某个端口是否开启
1.安装Telnet组件。转到程序控制面板,然后转到打开或关闭窗口功能,Telnet客户端和Telnet服务器勾选,从而安装Telnet组件。
9. 如何查看linux开放ssh端口
查看linux开放ssh端口具体步骤如下:
1.首先查看一下当前linux是否已经安装SSH软件包,使用 rpm -qa|grep ssh。
注意事项:SSH端口默认是22,如果要修改直接编辑22端口注意前面的“#”要去掉,然后保存重启。
10. 如何查看服务器所开放的端口
1、首先打开电脑之后,在键盘上按下组合键 win+r 打开运行对话框,如下图所示。