57

I'm using a Debian 9 image on a virtual machine. The ping command is not installed. When I run:

sudo apt-get install ping

It asks me:

Package ping is a virtual package provided by:
  iputils-ping 3:20161105-1
  inetutils-ping 2:1.9.4-2+b1
You should explicitly select one to install.

Why is there two ping utilities? What are the differences between them? Is there some guidelines to choose one version over the other? What are the implications of this choice? Will all scripts and programs be compatible with both versions?

Ortomala Lokni
  • 4,665
  • 3
  • 31
  • 58

4 Answers4

46

iputils’s ping supports quite a few more features than inetutilsping, e.g. IPv6 (which inetutils implements in a separate binary, ping6), broadcast pings, quality of service bits... The linked manpages provide details.

iputilsping supports all the options available on inetutilsping, so scripts written for the latter will work fine with the former. The reverse is not true: scripts using iputils-specific options won’t work with inetutils.

As far as why both exist, inetutils is the GNU networking utilities, targeting a variety of operating systems and providing lots of different networking tools; iputils is Linux-specific and includes fewer utilities. So typically you’d combine both to obtain complete coverage and support for Linux-specific features, on Linux, and only use inetutils on non-Linux systems.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
  • Thank you for your answer. You say that typically you combine both to obtain complete coverage but as both implement the virtual package ping, If I install one the other is removed. How do you combine them? – Ortomala Lokni Oct 25 '17 at 14:09
  • @Ortomala I meant that you combine both sets of utilities: for example, `ftp` from `inetutils`, `ping` from `iputils`, etc. (That part of my answer wasn’t focused on `ping` specifically.) – Stephen Kitt Oct 25 '17 at 14:18
13

inetutils-ping is the portable GNU implementation, which is used on non-Linux Debian systems (such as Debian GNU/kFreeBSD).

iputils-ping is Linux only, but does have more features. If you are using Linux, you probably want iputils version of ping.

sebasth
  • 14,332
  • 4
  • 50
  • 68
  • 1
    I learned from @StephenKitt's answer that `iputils-ping` supports ipv6 with same binary (`ipv6` is a symlink), while `inetutils-ping` provides a separate `ping6` binary. Both support *ipv6*, but the symbolic links aren't visible from packages.debian.org file listings. – sebasth Oct 25 '17 at 13:02
  • i have tested the `ping` from both packages . `ping6` seems to work only when installing the `inetutils-ping` thx again – GAD3R Oct 25 '17 at 13:08
  • @GAD3R What do you need the `ping6` command for, if `ping` from `iputils-ping` supports both protocols? You can force it to use only either protocol with the `-4` and `-6` switches, should the need arise. – Johan Myréen Oct 25 '17 at 13:35
  • 1
    @GAD3R that’s weird, `iputils-ping` installs a `ping6` symlink, so you should be able to `ping6 ::` without installing `inetutils-ping` at all (and I can, on the systems I’ve checked this on). – Stephen Kitt Oct 25 '17 at 14:20
3

iputils-ping performs DNS reverse lookup via PTR query. You will have to wait for a timeout if there is no response from your DNS server.

inetutils-ping performs way more better in this situation.

youfu
  • 241
  • 1
  • 8
  • Both implementations by default try to resolve IP addresses into names using reverse DNS lookups and require the `-n` option to disable this behavior. Would you explain, how exactly `inetutils-ping` performs better? – Sebastian Schrader Mar 13 '22 at 00:26
  • 1
    @SebastianSchrader For `iputils-ping`, `-n` sets `opt_numeric`, which determines whether `pr_addr` will call `getnameinfo` without `NI_NUMERICHOST`, where a PTR query may happen. For `inetutils-ping`, it always calls `inet_ntoa` to convert sockaddr to string, a PTR resolution never happens. The interpretation of the `-n` flag and implementation of name resolution is rather complex behind the scene. It depends on what option you are using, what kind of response you are receiving, and even more. In general, `iputils-ping` may stuck when your DNS resolver doesn't respond to a PTR query in time. – youfu Mar 14 '22 at 16:04
  • Thanks for the details. `getnameinfo` with `NI_NUMERICHOST` (on glibc at least) is basically just a wrapper for `inet_ntop` (for IPv6 link-local addresses, it also tries to resolve the `scope_id` to an interface name using `if_indextoname`). With `-n` `iputils-ping` should therefore perform well too. – Sebastian Schrader Mar 14 '22 at 19:46
1

You can install one of them , the tow package provide the ping binary , the inetutils-ping will provide an additional tool ping6

GAD3R
  • 63,407
  • 31
  • 131
  • 192