Reply
Member
Posts: 107
Registered: ‎10-16-2015
Kudos: 13

ER-X : ping invalid command when using count number

I would like to be able to use the count limit in the ping command, but it's not working on my ER-X.

 

root@ubnt:~# ping -h
Usage: ping [-LRUbdfnqrvVaAD] [-c count] [-i interval] [-w deadline]

Without count option...

 

root@ubnt:~# ping www.google.co.uk
PING www.google.co.uk (216.58.212.99) 56(84) bytes of data.
64 bytes from lhr35s06-in-f99.1e100.net (216.58.212.99): icmp_req=1 ttl=54 time=15.5 ms
64 bytes from lhr35s06-in-f3.1e100.net (216.58.212.99): icmp_req=2 ttl=54 time=15.4 ms
64 bytes from lhr35s06-in-f3.1e100.net (216.58.212.99): icmp_req=3 ttl=54 time=15.1 ms
^C
--- www.google.co.uk ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 15.123/15.365/15.507/0.199 ms

With -c (count) option...

 

root@ubnt:~# ping -c 3 www.google.co.uk
Invalid command

 

ubnt@ubnt:~$ show version
Version:      v1.10.7
Build ID:     5127989
Build on:     10/01/18 12:27
Copyright:    2012-2018 Ubiquiti Networks, Inc.
HW model:     EdgeRouter X 5-Port
HW S/N:       44D9E7938F77
Uptime:       12:18:49 up 11 days, 48 min,  1 user,  load average: 1.34, 1.25, 1.17

Thanks.

 

Veteran Member
Posts: 7,253
Registered: ‎03-24-2016
Kudos: 1867
Solutions: 823

Re: ER-X : ping invalid command when using count number

try "sudo ping"  ,  or specify entire path to ping executable.

Ping is both a linux  command, and a vyatta command

Member
Posts: 107
Registered: ‎10-16-2015
Kudos: 13

Re: ER-X : ping invalid command when using count number

Yes, that worked...

 

ubnt@ubnt:~$ ping -c 3 www.google.co.uk
Invalid command

ubnt@ubnt:~$ sudo ping -c 3 www.google.co.uk
PING www.google.co.uk (216.58.206.67) 56(84) bytes of data.
64 bytes from lhr35s11-in-f3.1e100.net (216.58.206.67): icmp_req=1 ttl=55 time=15.8 ms
64 bytes from lhr35s11-in-f3.1e100.net (216.58.206.67): icmp_req=2 ttl=55 time=15.8 ms
64 bytes from lhr35s11-in-f3.1e100.net (216.58.206.67): icmp_req=3 ttl=55 time=15.5 ms

...but why do you need elevated permission to count pings?

 

lol

Established Member
Posts: 1,373
Registered: ‎07-07-2014
Kudos: 289
Solutions: 90

Re: ER-X : ping invalid command when using count number


@plittlefield wrote:

Yes, that worked...

 

ubnt@ubnt:~$ ping -c 3 www.google.co.uk
Invalid command

ubnt@ubnt:~$ sudo ping -c 3 www.google.co.uk
PING www.google.co.uk (216.58.206.67) 56(84) bytes of data.
64 bytes from lhr35s11-in-f3.1e100.net (216.58.206.67): icmp_req=1 ttl=55 time=15.8 ms
64 bytes from lhr35s11-in-f3.1e100.net (216.58.206.67): icmp_req=2 ttl=55 time=15.8 ms
64 bytes from lhr35s11-in-f3.1e100.net (216.58.206.67): icmp_req=3 ttl=55 time=15.5 ms

...but why do you need elevated permission to count pings?

 

lol


As @16again explained, "ping" is both a vyatta command and a linux command.  When you first login you're at a vyatta shell.  When you run the command as "sudo" you're running the linux version of 'ping'.  You can also type 'sudo su' at the command prompt to drop to a linux shell.

Member
Posts: 253
Registered: ‎08-15-2015
Kudos: 39
Solutions: 2

Re: ER-X : ping invalid command when using count number


@plittlefield wrote:

...but why do you need elevated permission to count pings?

 

lol


You don't.  You just need to path ping to get the "right" one.

 

$ ping -c 1 google.com
Invalid command
$ which ping
/bin/ping
$ /bin/ping -c 1 google.com
PING google.com (172.217.0.14) 56(84) bytes of data.
64 bytes from ord38s04-in-f14.1e100.net (172.217.0.14): icmp_req=1 ttl=54 time=15.9 ms

--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 15.940/15.940/15.940/0.000 ms
$ 

When you sudo you leave the vyatta shell.

 

$ echo $SHELL
/bin/vbash
$ sudo -i
# echo $SHELL
/bin/bash
# 

So you get the "right" ping.

 

Emerging Member
Posts: 446
Registered: ‎09-13-2018
Kudos: 70
Solutions: 26

Re: ER-X : ping invalid command when using count number

or even a "\" prior to the ping

 

\ping -c 1 google.com
Reply