当前位置:首页 » 操作系统 » linux端口无法连接

linux端口无法连接

发布时间: 2023-08-08 03:44:02

① 两台linux服务器端口不通怎么解决

准备环境

启动一个web服务器,提供端口.

?

1
2

[wyq@localhost ~]$ python -m SimpleHTTPServer 8080
Serving HTTP on 0.0.0.0 port 8080 ...

用其它web服务器提供端口也一样,由于python比较方便,这里就用它

1、使用telnet判断

telnet是windows标准服务,可以直接用;如果是linux机器,需要安装telnet.

用法: telnet ip port

1)先用telnet连接不存在的端口

?

1
2
3

[root@localhost ~]# telnet 10.0.250.3 80
Trying 10.0.250.3...
telnet: connect to address 10.0.250.3: Connection refused #直接提示连接被拒绝

2)再连接存在的端口

?

1
2
3
4
5
6
7
8

[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)连接不存在端口

?

1
2
3
4
5
6
7
8
9

[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)连接存在的端口

?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

[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)连接不存在的端口

?

1
2
3

[root@localhost ~]# wget ...:
---- ::-- http://.../
Connecting to ...:... failed: Connection refused.

2)连接存在的端口

?

1
2
3
4

[root@localhost ~]# wget ...:
---- ::-- http://...:/
Connecting to ...:... connected.
HTTP request sent, awaiting response...

4、使用端口扫描工具

?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

[root@localhost ~]# nmap ... -p
Starting Nmap . ( http://nmap.org ) at -- : CST
Nmap scan report for ...
Host is up (.s latency).
PORT STATE SERVICE
/tcp closed http
MAC Address: B:A::CF:FD:D (Unknown)
Nmap done: IP address ( host up) scanned in . seconds
[root@localhost ~]# nmap ... -p
Starting Nmap . ( http://nmap.org ) at -- : CST
Nmap scan report for ...
Host is up (.s latency).
PORT STATE SERVICE
/tcp open http-proxy
MAC Address: B:A::CF:FD:D (Unknown)
Nmap done: IP address ( host up) scanned in . seconds
[root@localhost ~]# nmap ...
Starting Nmap . ( http://nmap.org ) at -- : CST
Nmap scan report for ...
Host is up (.s latency).
Not shown: closed ports
PORT STATE SERVICE
/tcp open ssh
/tcp open rpcbind
/tcp open http-proxy
/tcp open unknown
MAC Address: B:A::CF:FD:D (Unknown)
Nmap done: IP address ( host up) scanned in . seconds

总结

提供端口服务,则使用了tcp协议,上面是以web服务器为例。如果服务器是更简单的tcp服务器,三个工具同样适用.

三个工具的共同点是:1.以tcp协议为基础;2.能访问指定端口. 遵循这两点可以找到很多工具.
一般在windows下使用telnet比较方便,linux下个人就比较喜欢用wget.

② linux端口不通怎么排查

ping IP检查网络连通性
telnet IP+端口检查端口是否可访问
traceroute IP检查路由是否正常
iptables -nL检查防火墙配置
tcpmp抓包用wireshark分析
基本就是这些工具了,一项项排查吧

③ linux虚拟机无法添加端口设置怎么办

1、查看哪些端口被打开netstat -anp。

2、关闭端口号:iptables -AINPUT -ptcp --drop 端口号-jDROP,iptables -AOUTPUT -ptcp --dport

端口号-jDROP。

3、打开端口号:iptables -AINPUT -ptcp --dport 端口号-jACCEPT。

4、以下是linux打开端口命令的使用方法。nc -lp22&(打开22端口,即telnet),netstat -an| grep 22 (查看是否打开22端口)。

5、linux打开端口命令每一个打开的端口。

关闭端口号:iptables -AINPUT -ptcp --drop 端口号-jDROP,iptables -AOUTPUT -ptcp --dport

端口号-jDROP。

(3)linux端口无法连接扩展阅读:

liunx常见端口详细说明 :

1、端口:7

服务:Echo

说明:能看到许多人搜索Fraggle放大器时,发送到X.X.X.0和X.X.X.255的信息。

2、端口:21

服务:FTP

说明:FTP服务器所开放的端口,用于上传、下载。最常见的攻击者用于寻找打开anonymous的FTP服务器的方法。这些服务器带有可读写的目录。木马Doly Trojan、Fore、Invisible FTP、WebEx、WinCrash和Blade Runner所开放的端口。

3、端口:22

服务:Ssh

说明:PcAnywhere建立的TCP和这一端口的连接可能是为了寻找ssh。这一服务有许多弱点,如果配置成特定的模式,许多使用RSAREF库的版本就歼简扮会有不少的漏洞

存在。

4、端口:23

服务:Telnet

说明:远程登录,入侵者在搜索远程登录UNIX的服务。大多数情况下扫描这一端口是为了找到机器运行的操作系统。还有使用其他技术,入侵者也会找到密码。木马Tiny Telnet Server就开放这个端口。

5、端口:25

服务:SMTP

说明:SMTP服务器所开放的端口,用于发送邮件。入侵者寻找SMTP服务器是为了传递他们的SPAM。入侵者的帐户被关闭,他们需要连接到高带宽的E-MAIL服务器上,将简单的信息传递到不同的地址。木马Antigen、Email Password Sender、Haebu Coceda、Shtrilitz Stealth、WinPC、WinSpy都开放这个端口。

6、端口:53

服务:Domain Name Server(DNS)

说明:DNS服务器所开放的端口,入侵者可能是试图进行区域传递(TCP),欺骗DNS(UDP)或隐藏其他的通信。因此防火墙常常过滤或记录此端口。

7、端口:80

服务:HTTP

说明:用于网页浏览。木马Executor开放此端口。

8、端口:102

服务:Message transfer agent(MTA)-X.400 over TCP/IP

说明:消息传输代理。

9、端口:110

服务:pop3

说明:POP3(Post Office Protocol

服务器开放此端口,用于接收邮件,客户端访问服务器端的邮件服务。POP3服务有许多公认的弱点。关于用户名咐团和密码交换缓冲区溢出的弱点至少有20个,这意味着入侵者可以在真正登陆前进入系统。成功登陆后还有其他缓冲区溢出错误。

10、端口:137、138、139

服务:NETBIOS Name Service

说明:其中137、138是UDP端口,当通氏灶过网上邻居传输文件时用这个端口。而139端口:通过这个端口进入的连接试图获得NetBIOS/SMB服务。这个协议被用于windows文件和打印机共享和SAMBA。还有WINS Regisrtation也用它。

11、端口:143

服务:Interim Mail Access Protocol v2

说明:和POP3的安全问题一样,许多IMAP服务器存在有缓冲区溢出漏洞。

记住:一种LINUX蠕虫(admv0rm)会通过这个端口繁殖,因此许多这个端口的扫描来自不知情的已经被感染的用户。当REDHAT在他们的LINUX发布版本中默认允许IMAP后,这些漏洞变的很流行。这一端口还被用于IMAP2,但并不流行。

12、端口:161

服务:SNMP

说明:SNMP允许远程管理设备。所有配置和运行信息的储存在数据库中,通过SNMP可获得这些信息。许多管理员的错误配置将被暴露在Internet。Cackers将试图使用默认的密码public、private访问系统。他们可能会试验所有可能的组合。

SNMP包可能会被错误的指向用户的网络。

13、端口:389

服务:LDAP、ILS

说明:轻型目录访问协议和NetMeeting Internet Locator Server共用这一端口 。

14、端口:443

服务:Https

说明:网页浏览端口,能提供加密和通过安全端口传输的另一种HTTP。

15、端口:993

服务:IMAP

说明:SSL(Secure Sockets layer)

16、端口:1433

服务:SQL

说明:Microsoft的SQL服务开放的端口。

17、端口:1503

服务:NetMeeting T.120

说明:NetMeeting T.120

18、端口:1720

服务:NetMeeting

说明:NetMeeting H.233 call Setup。

19、端口:1731

服务:NetMeeting Audio Call Control

说明:NetMeeting音频调用控制。

20、端口:3389

服务:超级终端

说明:WINDOWS 2000终端开放此端口。

21、端口:4000

服务:QQ客户端

说明:腾讯QQ客户端开放此端口。

22、端口:5631

服务:pcAnywere

说明:有时会看到很多这个端口的扫描,这依赖于用户所在的位置。当用户打开pcAnywere时,它会自动扫描局域网C类网以寻找可能的代理(这里的代理是指agent而不是proxy)。入侵者也会寻找开放这种服务的计算机。所以应该查看这种扫描的源地址。一些搜寻pcAnywere的扫描包常含端口22的UDP数据包。

23、端口:6970

服务:RealAudio

说明:RealAudio客户将从服务器的6970-7170的UDP端口接收音频数据流。这是由TCP-7070端口外向控制连接设置的。

24、端口:7323

服务:[NULL]

说明:Sygate服务器端。

25、端口:8000

服务:OICQ

说明:腾讯QQ服务器端开放此端口。

26、端口:8010

服务:Wingate

说明:Wingate代理开放此端口。

27、端口:8080

服务:代理端口

说明:WWW代理开放此端口。

④ linux服务器的80端口不通,防火墙已经放行,然后怎么操作

1,关闭IPtables防火墙,关闭selinux
2,查看防火墙等网安设备的规则及日志,看是否有拦截或过滤。
3,查检服务器的系统变量,有可能是由这些变量导致的,尝试把这些变量删除或注释。
如下变量:
默认情况下 sysctl.conf 文件里面是没有配置变量的。
vim /etc/sysctl.conf
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.core.netdev_max_backlog = 32768
net.core.somaxconn = 262144
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.netfilter.nf_conntrack_max = 655360
kernel.ctrl-alt-del = 1

⑤ LINUX 为什么telnet无法连接! telnet localhost 本地连接不上,被拒绝。 telnet,telnet-server,xinetd已装

LINUX 中telnet无法连接是设置错误造成的,解决方法如下:

1、查看telnet 服务,chkcconfig -list查看, 多了telnet服务, 默认关闭。

热点内容
一加保存的密码在哪里 发布:2025-03-12 01:13:06 浏览:88
微信第三方平台源码 发布:2025-03-12 01:12:21 浏览:780
服务器关闭怎么补偿 发布:2025-03-12 01:01:26 浏览:333
c语言复数的四则运算 发布:2025-03-12 01:01:22 浏览:802
我的世界电脑版新的服务器 发布:2025-03-12 01:00:27 浏览:378
网站数据库设置 发布:2025-03-12 00:52:13 浏览:310
安卓是哪个企业 发布:2025-03-12 00:41:23 浏览:91
javascript还是php 发布:2025-03-12 00:41:12 浏览:697
微博抽奖算法 发布:2025-03-12 00:41:10 浏览:112
抖音的麦克风在哪里打开安卓版 发布:2025-03-12 00:35:15 浏览:122