{ "version": "https://jsonfeed.org/version/1.1", "user_comment": "This feed allows you to read the posts from this site in any feed reader that supports the JSON Feed format. To add this feed to your reader, copy the following URL -- https://matoken.org/blog/tag/pingu/feed/json/ -- and add it your reader.", "home_page_url": "https://matoken.org/blog/tag/pingu/", "feed_url": "https://matoken.org/blog/tag/pingu/feed/json/", "language": "ja", "title": "pingu – matoken's blog", "description": "Is there no plan B?", "icon": "https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9.jpeg", "items": [ { "id": "http://matoken.org/blog/?p=3658", "url": "https://matoken.org/blog/2022/06/12/pingu-command-that-comes-out-with-ping/", "title": "ping\u3067\u30d4\u30f3\u30b0\u30fc\u304c\u51fa\u3066\u304f\u308bpingu\u30b3\u30de\u30f3\u30c9", "content_html": "
\n\n\n\u30d1\u30b1\u30c3\u30c8\u304c\u5e30\u3063\u3066\u304f\u308b\u3068\u30d4\u30f3\u30b0\u30fc\u304c\u51fa\u3066\u304f\u308bping\u30b3\u30de\u30f3\u30c9\u3092\u4f5c\u308a\u307e\u3057\u305f
\n
\n\u697d\u3057\u3044\uff57\uff57\uff57https://t.co/VxeVtIt2IB#golang #cli #ping pic.twitter.com/KoLlEou9Ou\u2014 ((
\n<9F><90><91>++)) (@Sheeeeepla)
\nJune 11, 2022
\u53ef\u611b\u3044
\n\u3066\u3053\u3068\u3067\u624b\u5143\u3067\u3082\u52d5\u304b\u3057\u3066\u307f\u307e\u3057\u305f\uff0e
\n
$ go install github.com/sheepla/pingu@latest\n
| \n Note \n | \n\n \n \ninstall\u3057\u3066\u304b\u3089\u6c17\u3065\u3044\u305f\u306e\u3067\u3059\u304c\uff0cGitHub\u306erelease\u306b\u3044\u304f\u3064\u304b\u306e\u30d0\u30a4\u30ca\u30ea\u304c\u3042\u308a\u307e\u3057\u305f\uff0e \n \n\n \n$ git clone https://github.com/sheepla/pingu && cd pingu\n$ GOARCH=\"arm\" GOOS=\"linux\" go build -o pingu_linux-arm main.go\n$ GOARCH=\"amd64\" GOOS=\"openbsd\" go build -o pingu_openbsd-amd64 main.go\n$ file ./pingu_*\n./pingu_linux-arm: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, Go BuildID=murva-OzxIcI_YixZ4Ug/cNCKM_axMOq6C247-ffX/ZvpTdtm8O3oDXPd__Lpl/cHptxGGRawpNVtoik-SP, not stripped\n./pingu_openbsd-amd64: ELF 64-bit LSB executable, x86-64, version 1 (OpenBSD), dynamically linked, interpreter /usr/libexec/ld.so, for OpenBSD, Go BuildID=Q-bDgKXcAqG8C7jI1-AU/tFPAi4Y1vzFywav4YxWJ/RlLmE89x6Zh42bIsaKyQ/oVjfJQxr0rf9Z5byo_ZF, not stripped\n | \n
\u65e9\u901f\u5b9f\u884c\u3059\u308b\u3068permission denied\u3067\u5931\u6557\u3057\u307e\u3059\uff0e
\n$ pingu localhost\nPING localhost (127.0.0.1) type `Ctrl-C` to abort\n[ERROR] an error occurred when running ping: socket: permission denied\n
SUID \u3092\u8a2d\u5b9a\u3057\u3066\u307f\u305f\u308a\uff0c
\n$ cp -a $(which pingu) .\n$ sudo chown 0.0 ./pingu\n$ sudo chmod u+s ./pingu\n$ ./pingu localhost\nPING localhost (127.0.0.1) type `Ctrl-C` to abort\n[ERROR] an error occurred when running ping: socket: permission denied\n
sudo\u3067\u3082\u99c4\u76ee\u3067\u3059\uff0e
\n$ sudo ~matoken/go/bin/pingu localhost\nPING localhost (127.0.0.1) type `Ctrl-C` to abort\n[ERROR] an error occurred when running ping: socket: permission denied\n
\u691c\u7d22\u3057\u3066\u307f\u308b\u3068\u3053\u306e\u30da\u30fc\u30b8\u3092\u898b\u3064\u3051\u307e\u3057\u305f\uff0e
\nping \u30b3\u30de\u30f3\u30c9\u304c\u7279\u5225\u3067\u901a\u5e38\u306f net.ipv4.ping_group_range \u306e\u6a29\u9650\u304c\u5fc5\u8981\u306a\u3088\u3046\u3067\u3059\uff0e
\nprettyping \u306f\u52d5\u304f\u306e\u306b\u306a\u3068\u601d\u3063\u305f\u3051\u3069\u3053\u308c\u306f ping \u30b3\u30de\u30f3\u30c9\u3092\u547c\u3093\u3067\u3044\u308b\u306e\u3067\u52d5\u304f\u306e\u3067\u3059\u306d\uff0e
net.ipv4.ping_group_range \u3092\u78ba\u8a8d\u3059\u308b\u3068 1 0 \u306b\u306a\u3063\u3066\u3044\u307e\u3059\uff0e
$ sysctl -a 2>&1 | grep ping\nnet.ipv4.ping_group_range = 1 0\n$ cat /proc/sys/net/ipv4/ping_group_range\n1 0\n
0 0 \u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067 gid 0 \u3067\u5b9f\u884c\u53ef\u80fd\u306b$ sudo id -g\n0\n$ sudo sysctl net.ipv4.ping_group_range=\"0 0\"\nnet.ipv4.ping_group_range = 0 0\n$ sudo ~matoken/go/bin/pingu localhost\nPING localhost (127.0.0.1) type `Ctrl-C` to abort\n ... . ... .. .. ......... seq=0 32bytes from 127.0.0.1: ttl=64 time=242.773\u00b5s\n ... .... .. .. ... ..... .. .. seq=1 32bytes from 127.0.0.1: ttl=64 time=241.504\u00b5s\n^C\n\u2500\u2500\u2500\u2500\u2500 localhost ping statistics \u2500\u2500\u2500\u2500\u2500\nPACKET STATISTICS: 2 transmitted => 2 received (0% loss)\nROUND TRIP: min=241.504\u00b5s avg=242.139\u00b5s max=242.773\u00b5s stddev=634ns\n
0 1000 \u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067 gid 1000 \u306e\u4e00\u822c\u30e6\u30fc\u30b6\u3067\u3082\u5b9f\u884c\u53ef\u80fd\u306b$ sudo sysctl net.ipv4.ping_group_range=\"0 $(id -g)\"\nnet.ipv4.ping_group_range = 0 1000\n$ pingu localhost\nPING localhost (127.0.0.1) type `Ctrl-C` to abort\n ... . ... .. .. ......... seq=0 32bytes from 127.0.0.1: ttl=64 time=149.711\u00b5s\n ... .... .. .. ... ..... .. .. seq=1 32bytes from 127.0.0.1: ttl=64 time=235.975\u00b5s\n ... ....... ... ... . ..... ####### seq=2 32bytes from 127.0.0.1: ttl=64 time=195.434\u00b5s\n..... ........ .###############..... ... ##########. . seq=3 32bytes from 127.0.0.1: ttl=64 time=179.31\u00b5s\n .... ........#####################. ... ########### seq=4 32bytes from 127.0.0.1: ttl=64 time=201.388\u00b5s\n ....... ######################.... ############ seq=5 32bytes from 127.0.0.1: ttl=64 time=242.148\u00b5s\n. . .... ########################... ########### seq=6 32bytes from 127.0.0.1: ttl=64 time=219.127\u00b5s\n .. ....#########################.. .########### seq=7 32bytes from 127.0.0.1: ttl=64 time=163.007\u00b5s\n . #########################. .########## seq=8 32bytes from 127.0.0.1: ttl=64 time=136.878\u00b5s\n .... .########################. ######## seq=9 32bytes from 127.0.0.1: ttl=64 time=203.288\u00b5s\n ..... . ####################. #######. seq=10 32bytes from 127.0.0.1: ttl=64 time=128.612\u00b5s\n^C\n\u2500\u2500\u2500\u2500\u2500 localhost ping statistics \u2500\u2500\u2500\u2500\u2500\nPACKET STATISTICS: 11 transmitted => 11 received (0% loss)\nROUND TRIP: min=128.612\u00b5s avg=186.807\u00b5s max=242.148\u00b5s stddev=36.88\u00b5s\n
1001 1000 \u306e\u69d8\u306b\u304a\u304b\u3057\u306a\u7bc4\u56f2\u306b\u8a2d\u5b9a\u3059\u308b\u3068\u52d5\u304b\u306a\u304f\u306a\u308a\u307e\u3059\uff0e$ sudo sysctl net.ipv4.ping_group_range=\"1001 $(id -g)\"\nnet.ipv4.ping_group_range = 1001 1000\n$ pingu localhost\nPING localhost (127.0.0.1) type `Ctrl-C` to abort\n[ERROR] an error occurred when running ping: socket: permission denied\n
| \u30c7\u30a3\u30b9\u30c8\u30ea\u30d3\u30e5\u30fc\u30b7\u30e7\u30f3 | \nuname -r | \nnet.ipv4.ping_group_range | \npingu | \n
|---|---|---|---|
| \n Debian sid amd64 \n | \n\n 5.17.0-3-amd64 \n | \n\n 1\t0 \n | \n\n NG \n | \n
| \n Debian bullseye amd64 \n | \n\n 5.10.0-14-amd64 \n | \n\n 1\t0 \n | \n\n NG \n | \n
| \n Debian buster amd64 \n | \n\n 5.10.0-0.bpo.12-amd64 \n | \n\n 1\t0 \n | \n\n NG \n | \n
| \n Raspberry Pi OS bullseye armhf \n | \n\n 5.15.32-v7+ \n | \n\n 0\t2147483647 \n | \n\n OK \n | \n
| \n Ubuntu 22.10 amd64(development branch) \n | \n\n 5.15.0-33-generic \n | \n\n 0\t2147483647 \n | \n\n OK \n | \n
| \n Note \n | \n\nsysctl\u306f\u518d\u8d77\u52d5\u3067\u3082\u3068\u306b\u623b\u308b\u306e\u3067\u6c38\u7d9a\u5316\u3057\u305f\u3044\u5834\u5408\u306f /etc/sysctl.conf, /etc/sysctl.d/* \u8fba\u308a\u306b\u66f8\u3044\u3066\u304a\u304d\u307e\u3057\u3087\u3046\uff0e | \n
pingu\u52d5\u3044\u305f\u3051\u3069\u8272\u306a\u3057\u306e\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u3060\u3068\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u306e\u3067\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u3092\uff0e
\n\u3061\u306a\u307f\u306b\u7aef\u672b\u5e45\u304c\u72ed\u3044\u3068\u3053\u3093\u306a\u611f\u3058\u306b\u306a\u308b\u306e\u3067\u5e83\u3052\u3066\u3042\u3052\u307e\u3057\u3087\u3046(\u4e0a\u306e\u753b\u50cf\u306fcols 111)
\n\u4e0d\u5b89\u5b9a\u306a\u56de\u7dda\u3060\u3068\u884c\u304c\u6e1b\u308a\u30d4\u30f3\u30b0\u30fc\u304c\u7e2e\u307f\u307e\u3059(\u81ea\u5b85\u3067\u306epovo 2.0\u56de\u7dda
)
\u4e0d\u5b89\u5b9a\u306a\u56de\u7dda\u3060\u3068 prettyping \u304c\u3044\u3044\u3067\u3059\u306d\uff0e
$ pingu --version\npingu: v???-rev???\n$ ls ~/go/pkg/mod/github.com/sheepla/\npingu@v0.0.1\n$ dpkg-query -W linux-image-`uname -r` golang iputils-ping\ngolang:amd64 2:1.18~3\niputils-ping 3:20211215-1\nlinux-image-5.17.0-3-amd64 5.17.11-1\n$ lsb_release -dr\nDescription: Debian GNU/Linux bookworm/sid\nRelease: unstable\n