question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test-Connection is related to /usr/bin/ping?

See original GitHub issue

is depends on Can’t change.

Test-Connection does not work at all if in linux distribution /usr/bin/ping or /bin/ping has suid.

Steps to reproduce


stat -c %a /usr/bin/ping    # test stat of ping
Test-Connection localhost   # Status is Timeout
ping -c 4 localhost         # Fine

Expected behavior

Working Test-Connection

Actual behavior

 > Test-Connection localhost

   Destination: localhost

Ping Source           Address                   Latency BufferSize Status
                                                   (ms)        (B)
---- ------           -------                   ------- ---------- ------
   1 mymsi            *                               *          * TimedOut
   2 mymsi            *                               *          * TimedOut
   3 mymsi            *                               *          * TimedOut
   4 mymsi            *                               *          * TimedOut


 > Test-Connection google.com         
Test-Connection: Testing connection to computer 'google.com' failed: An exception occurred during a Ping request.
Test-Connection: Testing connection to computer 'google.com' failed: An exception occurred during a Ping request.
Test-Connection: Testing connection to computer 'google.com' failed: An exception occurred during a Ping request.
Test-Connection: Testing connection to computer 'google.com' failed: An exception occurred during a Ping request.

 > Get-Error   

Exception             : 
    Type           : System.Net.NetworkInformation.PingException
    Message        : Testing connection to computer 'google.com' failed: An exception occurred during a Ping request.
    InnerException : 
        Type       : System.Net.NetworkInformation.PingException
        TargetSite : 
            Name          : MoveNext
            DeclaringType : System.Net.NetworkInformation.Ping+<SendWithPingUtilityAsync>d__76, System.Net.Ping, Version=5.0.0.0, Culture=neutral, PublicKeyToke
n=b03f5f7f11d50a3a
            MemberType    : Method
            Module        : System.Net.Ping.dll
        StackTrace : 
   at System.Net.NetworkInformation.Ping.SendWithPingUtilityAsync(IPAddress address, Byte[] buffer, Int32 timeout, PingOptions options)
   at System.Net.NetworkInformation.Ping.SendPingAsyncCore(IPAddress address, Byte[] buffer, Int32 timeout, PingOptions options)
   at System.Net.NetworkInformation.Ping.SendPingAsyncInternal(IPAddress address, Int32 timeout, Byte[] buffer, PingOptions options)
        Message    : An exception occurred during a Ping request.
        Source     : System.Net.Ping
        HResult    : -2146233079
    HResult        : -2146233079
TargetObject          : google.com
CategoryInfo          : ResourceUnavailable: (google.com:String) [Test-Connection], PingException
FullyQualifiedErrorId : TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand
InvocationInfo        : 
    MyCommand        : Test-Connection
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 49
    Line             : Test-Connection google.com
    PositionMessage  : At line:1 char:1
                       + Test-Connection google.com
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Test-Connection
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : 


Environment data


Name                           Value
----                           -----
PSVersion                      7.1.2
PSEdition                      Core
GitCommitId                    7.1.2
OS                             Linux 5.10.15-172.current #1 SMP PREEMPT Fri Feb 12 16:35:57 UTC 2021
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0


# Any Linux distribution there `*bin/ping` has suid (4755)

ping

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
vexx32commented, Mar 8, 2021

The response you get from the ping.Send() method is the same as the test-connection one there; Test-Connection just formats it a bit before outputting it, more or less.

But yeah, I think this is a .NET issue and the issue should be filed over there instead. Not really sure what they were thinking, having a dependence on a native util that doesn’t even give the information that their PingReply object claims to provide. 😕

1reaction
vexx32commented, Mar 8, 2021

That makes a lot of sense as to why pings on Unix are so tricky to work with. Sigh. Would have been a lot more usable in a number of respects if they’d written a proper ping util into .NET instead of trying to reuse an on-box utility like that. 😔

Read more comments on GitHub >

github_iconTop Results From Across the Web

e22624.pdf
This software and related documentation are provided under a license agreement containing restrictions on ... connection, click Test Connection.
Read more >
SLES 12 SP5 | Security and Hardening Guide
This manual introduces the basic concepts of system security on SUSE Linux Enterprise Server. It covers extensive documentation about the authentication ...
Read more >
Security and Hardening Guide
Try to keep the most important network-related packages up-to-date ... To check whether the LDAP connection works, click Test Connection.
Read more >
Oracle Enterprise Manager Grid Control Basic Installation Guide
This software and related documentation are provided under a license agreement containing restrictions on ... To test the connection, click Test Connection.
Read more >
Oracle 10g Enterprise Manager Grid Control Installation ...
U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and ... and click Test Connection to verify the monitoring credentials.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found