Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function ping #7

Open
Abecker37 opened this issue Feb 25, 2022 · 6 comments
Open

function ping #7

Abecker37 opened this issue Feb 25, 2022 · 6 comments

Comments

@Abecker37
Copy link

i want to use your script but the ping dont work. where is your function for the ping. im beginer in code
i have error connection refused when the function send request. but my firewall is configured for dont block the ping.
i can send ping via my bash command.

Thanks for your help
ABecker

@AndiSHFR
Copy link
Owner

Hello, in the current version there is no such a thing as a ping by means of an icmp packet.

The host test (thumbs up/thumbs down) is done by trying to connect to several ports via tcp.
The ports are 3389 (rdp), 22 (ssh), 80 (http) and 443 (https).

If at least one port successfully connects the host will be considered as up.
If all connection requests fail the host will be considered as down.

See line 247 in wake-on-lan.php

On the computer hosting the wake-on-lan.php script the web server must be allowed to make outgoing tcp connections on the ports mentioned above.

Could you provide a screenshot showing the "connection refused" message?

regards
Andi

@Abecker37
Copy link
Author

connection

@AndiSHFR
Copy link
Owner

I'm a bit confused. Where do you "see" this?
This is the result of the backend call and usually not visible to the user in the web browser.

Anyway, the connectivity test is done by trying to connect to the ports mentioned above.

The backend does this by calling fsockopen() (See line 258).

If the function returns with error "connection refused" this usually means that the requested tcp port is firewalled.
Please check if there are firewall rules in between the web server running wake-on-lan and the host to check.

As soon as the tcp connection could be established to any of the ports the loop will end and flag "isUp".

So if you finally see the message with property "isUp" set to false, then this means that none of the requested tcp ports could be connected.

@Abecker37
Copy link
Author

i see this in inspector. thanks for your help i send a pictures for explain where i see that
suite-co

@AndiSHFR
Copy link
Owner

AndiSHFR commented Mar 1, 2022

Ah, now it is clear. Thank you.

The only important information for the frontend is the property "isUp".
Please check that at least one of the tcp ports (3389, 22, 80, 443) can be connected on the remote host.

I have chosen these ports because the vast majority of my computers have either rdp, ssh and/or a web server.
If your hosts are different then you are welcome to extend the port list according to your needs.

i.e. i can imagine that a "database-only" host would have none of the above ports open.
So the test would basically fail for such a host.

@fbach3101
Copy link

For example, to check Windows Host joined to Active Directory, add following in line with port 3389 mentioned above:
'135' => '135 (RPC)'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants