PowerShell 测试连接 -TimeToLive 错误? [英] PowerShell Test-Connection -TimeToLive error?

查看:38
本文介绍了PowerShell 测试连接 -TimeToLive 错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道发生了什么,但每次输入以下命令时:

I don't know what happened, but everytime I enter the following command:

Test-Connection -ComputerName TARGET -TimeToLive 6

我收到以下错误:

Test-Connection : Testing connection to computer 'TARGET' failed: Problem with some part of the filterspec or providerspecific buffer in general
At line:1 char:16
+ Test-Connection <<<<  -ComputerName TARGET -TimeToLive 6
    + CategoryInfo          : ResourceUnavailable: (TARGET:String) [Test-Connection], PingException
    + FullyQualifiedErrorId : TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand

有趣的是,如果我没有 -TimeToLive 参数,例如:

Funnily enough, if I don't the -TimeToLive parameter, e.g.:

Test-Connection -ComputerName TARGET
Test-Connection -ComputerName TARGET -Count 2

命令按预期工作!并且做 Get-Help Test-Connection 诱人地表明 -TimeToLive确实一个有效参数.

The commands work as expected! And doing Get-Help Test-Connection tantalizingly shows that -TimeToLive is indeed a valid parameter.

我哪里做错了?

推荐答案

每个发出的 IP 数据包都有一个 TTL 字段,该字段设置为相对较高的数字(在 LAN 中 ping 的情况下为 128).当数据包穿过网络时,它经过的每个路由器的 TTL 字段都会减 1;当 TTL 下降到 0 时,数据包被路由器丢弃.IP 规范说 TTL 应设置为 60(尽管 ping 数据包为 255).这样做的主要目的是使数据包不会永远存在于网络上,并且在被视为丢失"时最终会死亡.

Every IP packet that gets sent out has a TTL field which is set to a relatively high number (in the case of ping in a LAN is 128). As the packet traverses the network, the TTL field gets decreased by one by each router it goes through; when the TTL drops to 0, the packet is discarded by the router. The IP spec says that the TTL should be set to 60 (though it's 255 for ping packets). The main purpose of this is so that a packet doesn't live forever on the network and will eventually die when it is deemed "lost."

在您的 LAN 中,6 的 TTL 可能不足以到达目的地.

It's possible that in you LAN a TTL of 6 isn't enougth to reach the destination.

在我的环境中,只有在两跳子网上ping 1 的TTL 会返回您的错误,这是正确的,我只有一个用于多个vlan 的核心路由器/交换机和一个本地路由器,每个不同的子网/域.

In my environment only a TTL of 1 pinging on two hop subnet return your error, and is right, I have only one core router/switch for multiple vlans and a local router each differnet subnet/domain.

这篇关于PowerShell 测试连接 -TimeToLive 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆