What's new

Is curl the new ping?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

thelonelycoder

Part of the Furniture
From Wikipedia https://en.wikipedia.org/wiki/Ping_(networking_utility):
ping is a computer network administration software utility used to test the reachability of a host on an Internet Protocol (IP) network. It is available for virtually all operating systems that have networking capability, including most embedded network administration software.

To test the reach ability, my a$$.
For a time now, the amtm Entware installer failed the ping test to mirrors.bfsu.edu.cn from Switzerland. At times the test went through but mostly it failed.
I have no restrictions on my routers for domains in China, nor does my excellent and nerdy ISP restrict it in any way - the one with a nerd mode toggle on their website: init7.

It bugged me but I never checked deeper as I have other things on my plate that are more pressing. Well, until now.
Yesterday, GitHub user Cryolitia made a pull request for amtm: https://github.com/decoderman/amtm/pull/30 and it really started to bother me that his change did not resolve the GFW (Great Firewall) problem.
Turns out it's not the GFW that blocks pings - they simply do not answer to ping.

I understand that some hosts have reasons not to respond to ping. But being an educational website you would expect they would freely allow it.
Their reason may be those ping flood attacks that hacker kids use these days to bring servers down? Who knows.

To solve my problem I decided to go the safe route and now use curl to determine if a web server is up and ready to serve in amtm.
curl acts and behaves just like any browser request to web servers:
Code:
tlc@GT-BE98-A804:/tmp/home/root# curl -IsL https://www.google.com | head -n 1 | grep 'OK\|Found'
HTTP/1.1 200 OK
With a redirect (curl -L) to one of the three mirrors behind mirrors.cernet.edu.cn, this looks like so:
Code:
tlc@GT-BE98-A804:/tmp/home/root# curl -IsL https://mirrors.cernet.edu.cn/entware | head -n 1 | grep 'OK\|Found'
HTTP/1.1 302 Found

In conclusion, curl IS the new safe ping command.

I will release an amtm update as soon as testing is finished.
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top