如何测试Linux主机/服务器之间的连接?

How to easily and quickly test the connection between two nodes on Linux? This should be specific to protocol and port.

如何在Linux上轻松快速地测试两个节点之间的连接 ? 这应该特定于协议和端口。

We can use nc (netcat) to test the connection between two servers.

我们可以使用nc(netcat)来测试两个服务器之间的连接。

For example, to test whether TCP port 1048 can be used on the server (IP 10.0.3.48 as an example) side:

例如,要测试是否可以在服务器端使用TCP端口1048(以IP 10.0.3.48为例):

On the server:

在服务器上:

$ nc -l 1048

On the client

在客户端上

$ nc 10.0.3.48 1048

If it can connect to the server, type something into it. If the server can also see it, the connection has no problem.
For testing UDP connection, we can simply add the ‘-u’ option to nc:
On server:

如果它可以连接到服务器,请在其中输入内容。 如果服务器也可以看到它,则说明连接没有问题。
为了测试UDP连接,我们可以简单地在nc中添加'-u'选项:
在服务器上:

$ nc -u -l 1048

On client:

在客户端上:

$ nc -u 10.0.3.48 1048

To check the ports which have programs listening to:

要检查程序正在监听的端口:

$ netstat -putln

More using examples of nc in “TCP/IP connection testing with nc (netcat)”: http://www.xinotes.org/notes/note/1080/

在“使用nc(netcat)进行TCP / IP连接测试”中使用nc的更多示例: http : //www.xinotes.org/notes/note/1080/

Answered by SA.
由SA回答。

翻译自: https://www.systutorials.com/how-to-test-the-connections-between-linux-hosts-servers/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值