2015-04-23 33 views
0

我面临一个非常糟糕的问题,我在网络概念中很可悲。当我尝试使用tcp协议连接到系统时,我遇到了问题,但如果在一段时间后连接到同一个系统,我将获得成功。了解linux中的netstat -na命令

方案: 我断开与目标环境中,显然没有建立到目标的连接是通过使用下面的命令netstat的 证实-na | grep按10.11.12.13 我发起一个新的请求 的netstat -na | grep的10.11.12.13我得到这在下面

TCP 0 182 :: FFFF给出了失败:127.0.0.1:1234 :: FFFF:10.11.12.13:8444 ESTABLISHED

我尝试在一段时间后使用相同的请求重新启动 netstat -na | grep 10.11.12.13我在ESTABLISHED模式下看到连接。

我只在第二个第三列netstat结果中发现了差异,这个结果用值182表示,我没有看到我的请求成功。我想知道这182代表什么。

+0

你的意思是,即使在连接失败的情况下,你会看到'ESTABLISHED'? – Prabhu

+0

我的意思是那个我不明白的东西。它显示ESTABLISHED,但它显示的值为182.所以我的问题是这182代表什么? –

回答

0

考虑一下:

[[email protected] openssl]# netstat -na| more 
Active Internet connections (servers and established) 
Proto Recv-Q Send-Q Local Address    Foreign Address    State 

您可以看到的说明的列在netstat输出的开头。

1st:协议名称。在你的情况下,TCP

第二:Recv-Q。应用程序在Local Address尚未从TCP缓冲区提取的数据字节数。在你的情况下,它是零

第3:发送问。应用程序给予TCP的数据字节数,以及未由对等TCP确认的数据字节数。正是这种在你的情况是182

+0

虽然我没有得到解决我的问题,但你的解释回答我的要求我张贴:)谢谢帕布 –

0

这可以帮助你了解几个位:

http://www.auditmypc.com/tcp-port-182.asp

Linux手册页

When a network error occurs, TCP tries to resend the packet. If it doesn't succeed after some time, either ETIMEDOUT or 
    the last received error on this connection is reported. 

    Some applications require a quicker error notification. This can be enabled with the IPPROTO_IP level IP_RECVERR socket 
    option. When this option is enabled, all incoming errors are immediately passed to the user program. Use this option 
    with care — it makes TCP less tolerant to routing changes and other normal network conditions. 
0

详细了解使用netstat命令这里是它的选项:

-a:所有端口 -t:端口TCP -u:端口UDP -l:侦听端口 -n:IP地址,而域名解析 -p:名称的程序和它相关的PID

所以:

- 要显示所有端口(TCP & UDP),PID与关联该方案的名称:

$ netstat -paunt 

-To显示所有侦听端口(TCP),PID与节目的相关联的名称:(我们也可以与grep命令筛选)

$ sudo netstat -plnt | grep ':80' 

我希望它会有帮助:)