连接到公共路由服务器时,netcat 与 telnet 的不同行为

发布于 2024-09-15 01:32:56 字数 624 浏览 6 评论 0原文

当连接到公共路由服务器 bgp-view.tvnetwork.hu 并发出命令 show ip bgp 时,我观察到 netcat 和 telnet 之间存在不同的行为。

使用 Telnet 时,输出(通常有几万行长)会被截断,为了查看全部内容,您必须按空格键或 Enter 才能继续(如手册页)。当我与 netcat 连接时,它只是开始转储所有输出,并且在前几百行之后它会挂起。即使我明确声明我想使用命令 terminal length 100 在前 100 行之后暂停,netcat 也不会改变行为。

您知道为什么会发生这种情况以及如何解决吗? 我的操作系统是ubuntu 10.4,路由服务器运行Quagga(版本0.99.5)。对于其他类型的路由器(思科或瞻博网络),不会出现该问题。

谢谢。

附:我想将问题标记为路由服务器,但我无法创建新标签:(

编辑:

问题是 netcat 不协商窗口大小(请参阅下面的答案)。Netcat 的 - t 参数用于协商 telnet 选项,但它会回复否定(不或不会),因此问题是如何使 netcat 协商 telnet 选项。也许我会就此问题发布一个新问题。 。

I have observed a different behaviour between netcat and telnet when connecting to the public route server bgp-view.tvnetwork.hu and issuing the command show ip bgp.

Using Telnet the output (which is normally some tens of thousands lines long) is truncated and in order to view it all you have to press space or enter to continue (like the man pages). When I connect with netcat it just starts dumping all the output and after the first few hundred lines it hangs. Even if I state explicitly that I want to pause after the first 100 lines using the command terminal length 100 netcat doesn't change behaviour.

Do you have any idea why this happens and how it can be resolved?
My OS is ubuntu 10.4 and the route server runs Quagga (version 0.99.5). With other type of routers (cisco or juniper) that problem doesn't appear.

Thank you.

ps. I wanted to tag the question as route-server but I cannot create new tags :(

EDIT:

The problem is that netcat doesn't negotiate window size (see my answer bellow). Netcat's -t parameter is used to negotiate telnet options but it replies with negations (DON'T or WON'T) so the question is how to make netcat to negotiate telnet options. Maybe I'll post a new question for this matter.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

奈何桥上唱咆哮 2024-09-22 01:32:56

好吧,用wireshark解决了这个谜。

问题在于 telnet 选项的协商。
服务器从 telnet 客户端请求“协商窗口大小”,但客户端没有协商,即使使用 -t 选项,netcat 也会回复“不会协商窗口大小”< /em>。

我使用 apache commons 库创建了一个 java telnet 客户端,以使用 WindowSizeOptionHandler() 构造函数协商窗口大小,并且工作正常。现在我只需要找到如何使用 netcat 来做到这一点。

OK, mystery solved with wireshark.

The problem was the negotiation of telnet options.
The server requests from the telnet client "Do Negotiate About Window Size" but the client wasn't negotiating and even with the -t option netcat replies "Won't Negotiate About Window Size".

I created a java telnet client with the apache commons library to negotiate about the window size using the WindowSizeOptionHandler() constructor and it works fine. Now I just have to find how to do it with netcat.

硬不硬你别怂 2024-09-22 01:32:56

我在 Juniper 路由器上发现了与 SSH 1.5 类似的差异。当我实现网络拓扑工具时,我必须在 Java 中使用两个不同的 SSH 库才能正常工作。我从未完全诊断出这个问题,但看起来我的一个库的握手方式存在问题,而不是路由器上的 ssh 服务器期望事情完成的方式。在这种情况下,我的连接刚刚被断开。我必须使用四个库来支持三种协议:telnet、ssh 1.5 和 ssh 2.0。

如果这是路由器特定的问题,我一点也不感到惊讶。不幸的是,除了尝试不同的库或程序来实现您的目标之外,我没有任何有用的建议给您。如果您想解决实际问题,您可以观察数据包的处理情况。

谢谢,

-布莱恩-

I found a similar discrepancy with SSH 1.5, on juniper routers. When I was implementing a network topology tool, I had to use two different SSH libraries in Java to get things to work. I never completely diagnosed the problem, but it looked like there was an issue with how one of my libraries was handshaking, as opposed to how the ssh server on the router was expecting things to be done. For this case, my connections were just being dropped. I had to use four libraries to support three protocols : telnet, ssh 1.5 and ssh 2.0.

I would not be surprised at all if this is a router specific issue. Unfortunately, I don't have any useful suggestions for you other than to try a different library or program to accomplish your goals. If you feel like troubleshooting the actual issue, you could watch the packets go through.

Thanks,

-Brian-

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文