【ARPing入門ガイド】Pingとの違いからコマンドの使い方まで徹底解説!

ARPプロトコルを利用して、同一ネットワーク内の機器の疎通確認を行うネットワーク診断ツール
- arping -

ネットワーク調査や疎通確認をしていると、「pingは通らないのに通信できる」という場面に遭遇することがあります。pingはICMPに依存するため、ファイアウォールの設定次第では応答が返らない場合があります。そのようなケースで役立つのが〝arping〟です。

本記事では、arpingのインストール方法から基本操作、頻出オプションの使い方まで分かりやすく解説します。さらに、pingとの違いを実機で比較検証し、ICMP遮断環境でもarpingが利用できる理由を解説しています。

検証環境で実行した各コマンドの結果も掲載しているので、実際の動作をイメージしながら理解を深めることができます。

arpingを基礎から実践まで学びたい方は、最後までご覧ください。

目次

arpingとは

arpingは、ARP(Address Resolution Protocol)を利用して、同一ネットワーク内のホストに対して疎通確認を行うためのコマンドラインツールです。ICMPベースのpingとは異なり、ARPリクエストを直接送信する点が特徴です。

主な特徴
  • ARP(Address Resolution Protocol)を使ってホスト疎通確認を行う
  • OSI参照モデルの第2層であるデータリンク層(L2)で動作する
  • 同一ネットワーク内のホスト存在確認に向いている
  • ICMPを遮断しているホストでも応答確認できる
  • IPアドレスだけでなくMACアドレス宛にも送信可能
  • Kali Linuxにプリインストールされている
  • 重複IPアドレスの検出が可能

なおarpingには、「Thomas Habets版」と「iputils版」があります。

両者は同じarpingというコマンド名を持っていますが、実装やオプション仕様が大きく異なります。両者の違いは、次のセクションで詳しく解説しています。

本記事では「Thomas Habets版」を採用

本記事では、「Thomas Habets版」または「iputils版」の記載がない限り、ネットワーク検証やペネトレーションテストで広く利用されるThomas Habets版のarpingを前提に解説しています。

Thomas Habets版とiputils版の違い

arping には、Thomas Habets版iputils版の2系統の実装があります。両者はコマンド名が同じarpingであるため、混同されるケースが少なくありません。

項目Thomas Habets版iputils版
開発・メンテナンスThomas Habets氏(個人)Alexey Kuznetsov氏(iputils開発コミュニティ)
オプション数多い(33)少ない(12)
インターフェース指定のオプション-i(小文字)-I(大文字)
コマンドの配置場所(*)/usr/sbin/arping/usr/bin/arping
ライセンスGPLv2GPLv2

* ディストリビューションにより異なる場合があります。

実装の確認方法

バージョン確認コマンドを実行することにより、どちらの実装がインストールされているか判別することができます。

# Thomas Habets版の場合
$ arping -h
ARPing 2.28, by Thomas Habets <thomas@habets.se>

# iputils版の場合
$ arping -V
arping from iputils 20250605
libcap: yes, IDN: yes, NLS: no, error.h: yes, getrandom(): yes, __fpending(): yes
  • -hオプションを実行して、ARPing x.x, by Thomas Habetsと表示された場合、Thomas Habets版のarpingがインストールされています。
  • -Vオプションを実行して、arping from iputils xxxxxxxxと表示された場合、iputils版のarpingがインストールされています。

オプションの違い

「Thomas Habets版」「iputils版」どちらもARPを利用した疎通確認ツールですが、利用可能なオプションが異なります。両者のオプションには互換性がありません。既にarpingを導入されている場合、どちらの実装がインストール済みか、前述のコマンドで確認して下さい。

Thomas Habets版のオプション

$ arping --help
ARPing 2.28, by Thomas Habets <thomas@habets.se>
usage: arping [ -0aAbdDeFpPqrRuUvzZ ] [ -w <sec> ] [ -W <sec> ] [ -S <host/ip> ]
              [ -T <host/ip ] [ -s <MAC> ] [ -t <MAC> ] [ -c <count> ]
              [ -C <count> ] [ -i <interface> ] [ -m <type> ] [ -g <group> ]
              [ -V <vlan> ] [ -Q <priority> ] <host/ip/MAC | -B>

Options:

    -0     Use this option to ping with source IP address 0.0.0.0. Use this
           when you haven't configured your interface yet.  Note that  this
           may  get  the  MAC-ping  unanswered.   This  is  an alias for -S
           0.0.0.0.
    -a     Audiable ping.
    -A     Only count addresses matching  requested  address  (This  *WILL*
           break  most things you do. Only useful if you are arpinging many
           hosts at once. See arping-scan-net.sh for an example).
    -b     Like -0 but source broadcast source  address  (255.255.255.255).
           Note that this may get the arping unanswered since it's not nor-
           mal behavior for a host.
    -B     Use instead of host if you want to address 255.255.255.255.
    -c count
           Only send count requests.
    -C count
           Only wait for this many replies, regardless of -c and -w.
    -d     Find duplicate replies. Exit with 1 if there are answers from
           two different MAC addresses.
    -D     Display answers as exclamation points and missing packets as dots.
    -e     Like -a but beep when there is no reply.
    -F     Don't try to be smart about the interface name.  (even  if  this
           switch is not given, -i overrides smartness)
    -g group
           setgid() to this group instead of the nobody group.
    -h     Displays a help message and exits.
    -i interface
           Use the specified interface.
    -m type
           Type of timestamp to use for incoming packets. Use -vv when
           pinging to list available ones.
    -q     Does not display messages, except error messages.
    -Q pri 802.1p priority to set. Should be used with 802.1Q (-V).
           Defaults to 0.
    -r     Raw output: only the MAC/IP address is displayed for each reply.
    -R     Raw output: Like -r but shows "the other one", can  be  combined
           with -r.
    -s MAC Set source MAC address. You may need to use -p with this.
    -S IP  Like  -b and -0 but with set source address.  Note that this may
           get the arping unanswered if the target does not have routing to
           the  IP.  If you don't own the IP you are using, you may need to
           turn on promiscious mode on the interface (with -p).  With  this
           switch  you can find out what IP-address a host has without tak-
           ing an IP-address yourself.
    -t MAC Set target MAC address to use when pinging IP address.
    -T IP  Use -T as target address when pinging MACs that won't respond to
           a broadcast ping but perhaps to a directed broadcast.
           Example:
           To check the address of MAC-A, use knowledge of MAC-B and  IP-B.
           $ arping -S <IP-B> -s <MAC-B> -p <MAC-A>
    -p     Turn  on  promiscious  mode  on interface, use this if you don't
           "own" the MAC address you are using.
    -P     Send ARP replies instead of requests. Useful with -U.
    -u     Show index=received/sent instead  of  just  index=received  when
           pinging MACs.
    -U     Send unsolicited ARP.
    -v     Verbose output. Use twice for more messages.
    -V num 802.1Q tag to add. Defaults to no VLAN tag.
    -w sec Specify a timeout before ping exits regardless of how many
           packets have been sent or received.
    -W sec Time to wait between pings.
    -z     Enable seccomp
    -Z     Disable seccomp (default)
Report bugs to: thomas@habets.se
Arping home page: <http://www.habets.pp.se/synscan/>
Development repo: http://github.com/ThomasHabets/arping

iputils版のオプション

$ arping -h

Usage:
  arping [options] <destination>

Options:
  -f            quit on first reply
  -q            be quiet
  -b            keep on broadcasting, do not unicast
  -D            duplicate address detection mode
  -U            unsolicited ARP mode, update your neighbours
  -A            ARP answer mode, update your neighbours
  -V            print version and exit
  -c <count>    how many packets to send
  -w <timeout>  how long to wait for a reply
  -i <interval> set interval between packets (default: 1 second)
  -I <device>   which ethernet device to use
  -s <source>   source IP address
  <destination> DNS name or IP address

For more details see arping(8).

arpingとpingの違い

arpingとpingは、どちらもネットワーク疎通確認に使用されるコマンドですが、使用するプロトコルや動作するOSI参照モデルのレイヤーが異なります。

項目arpingping
使用プロトコルARP(Address Resolution Protocol)ICMP(Internet Control Message Protocol)
OSI参照モデルデータリンク層(L2)ネットワーク層(L3)
主な用途同一セグメント内のホストの存在確認ネットワーク到達性確認
ルーター越え不可
MACアドレス取得不可
ICMP遮断環境での疎通確認不可

pingICMP Echo Requestを送信して応答を確認します。そのため、対象ホストがICMPを拒否している場合、pingでは応答がありません。

一方、arpingARP Requestを送信し、対象ホストから返されるARP Replyを確認します。ARPはLAN内の通信に必要なプロトコルであるため、通常はARP Reply応答があります。

ICMPを利用するpingとは異なり、arpingはARPレベルで応答を確認できるため、ICMP制限環境でもホストの存在確認が可能です。

本記事の後半では、arpingとpingの比較検証を行っていますので、最後までご覧ください。

ツール使用前に必ずご確認ください

  • 本記事で解説するコマンドや手法は、自身が管理する環境、または使用許可を得た環境でのみ使用してください。許可なく他者のネットワークで使用することは、社内規定や各種法令に抵触する可能性があります。
  • arping自体は軽量なツールですが、短時間に大量のパケットを送信した場合、ネットワーク機器に不必要な負荷を与える可能性があります。本番環境で利用する場合は、ネットワーク負荷を十分考慮のうえ実施してください。

arpingのインストール

arpingは使用するOSによってインストール方法が異なります。以下に、主要なOSごとのインストール手順を示します。

  • Kali Linux 2026.1
  • Ubuntu 26.04 LTS
  • Windows 11

Kali Linuxの場合

Kali Linuxでは、Thomas Habets版のarpingが標準でインストールされているため、追加インストールなしですぐ利用できます。

以下のコマンドで、arpingのインストールバージョン、および実行ファイルの配置場所を確認できます。

# インストールバージョン
$ arping -h
ARPing 2.28, by Thomas Habets <thomas@habets.se>
〜 以下、省略 〜

# 実行ファイルの配置場所
$ which arping
/usr/sbin/arping

Ubuntuの場合

Ubuntu環境では、APTパッケージマネージャ経由でarpingを導入できます。

# パッケージリストの更新
$ sudo apt update

# パッケージ情報の確認
$ apt show arping
Package: arping
Version: 2.28-1
Priority: optional
Section: universe/net
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Salvatore Bonaccorso <carnil@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 87.0 kB
Depends: libc6 (>= 2.38), libnet9 (>= 1.1.3), libpcap0.8t64 (>= 1.5.1), libseccomp2 (>= 1.0.1)
Conflicts: iputils-arping
Homepage: https://www.habets.pp.se/synscan/programs.php?prog=arping
Download-Size: 33.7 kB
APT-Sources: http://archive.ubuntu.com/ubuntu resolute/universe amd64 Packages
Description: sends IP and/or ARP pings (to the MAC address)
 The arping utility sends ARP and/or ICMP requests to the specified host
 and displays the replies. The host may be specified by its hostname,
 its IP address, or its MAC address.

# arpingのインストール
$ sudo apt install arping

インストール後、以下のコマンドで正常にインストールされたことを確認します。

$ which arping
/usr/sbin/arping

$ arping -h
ARPing 2.28, by Thomas Habets <thomas@habets.se>
usage: arping [ -0aAbdDeFpPqrRuUvzZ ] [ -w <sec> ] [ -W <sec> ] [ -S <host/ip> ]
              [ -T <host/ip ] [ -s <MAC> ] [ -t <MAC> ] [ -c <count> ]
              [ -C <count> ] [ -i <interface> ] [ -m <type> ] [ -g <group> ]
              [ -V <vlan> ] [ -Q <priority> ] <host/ip/MAC | -B>
For complete usage info, use --help or check the manpage.

Ubuntuの公式リポジトリでは、iputils版のarping(パッケージ名:iputils-arping)も提供しているため、誤ってインストールしないよう注意が必要です。

$ apt show iputils-arping
Package: iputils-arping
Version: 3:20250605-1ubuntu1
Priority: optional
Section: net
Source: iputils
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Noah Meyerhans <noahm@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 59.4 kB
Depends: libcap2-bin, libc6 (>= 2.38), libcap2 (>= 1:2.10)
Conflicts: arping
Homepage: https://github.com/iputils/iputils/
Download-Size: 16.5 kB
APT-Sources: http://archive.ubuntu.com/ubuntu resolute/main amd64 Packages
Description: Tool to send ICMP echo requests to an ARP address
 The arping command acts like the standard ping command except it pings
 a machine by its ARP address instead of its IP address.  It is typically
 used to locate a machine if its hardware address is known but its IP
 address is unknown

Windowsの場合

arpingは、Linux/Unix系OSを対象として開発されており、Windowsネイティブ環境への公式対応はありません。Windows上で利用するには、以下のいずれかの方法でLinux環境を構築する必要があります。

  • WSL(Windows Subsystem for Linux)を利用する
  • VirtualBoxなどの仮想化ソフトウェアを利用する

本記事の後半で紹介する検証環境では、後者(VirtualBox)を採用しています。

arpingコマンドの基本操作

arpingコマンドの基本構文

$ arping [オプション] <対象ホスト>

最もシンプルなコマンド

例えば、192.0.2.1に対してARPリクエストを送信する場合は、次のように実行します。

$ sudo arping 192.0.2.1

なお、arpingはデフォルトでは送信を停止しません。Ctrl + Cで手動停止するか、後述の-cオプションで送信回数を明示的に指定してください。

arpingは低レイヤー(L2)の生パケットを直接操作するため、root権限を必要とします。一般ユーザー権限で実行すると、以下のエラーが表示されます。

$ arping 192.0.2.1
arping: you may need to run as root

インターフェースを指定する

複数のNICを搭載している環境では、使用するネットワークインターフェースを-iオプションで指定します。

$ sudo arping -i eth0 192.0.2.1

自分のマシンのネットワークインターフェース名が不明な場合、ip aip routeで確認できます。

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:79:3a:0a brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.11/24 brd 192.168.10.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe79:3a0a/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:e8:48:7e brd ff:ff:ff:ff:ff:ff
    inet 10.0.3.15/24 brd 10.0.3.255 scope global dynamic noprefixroute eth1
       valid_lft 73691sec preferred_lft 62891sec
    inet6 fd17:625c:f037:3:273e:d7be:5d2a:c348/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 86397sec preferred_lft 14397sec
    inet6 fe80::fc79:c432:a841:bc46/64 scope link
       valid_lft forever preferred_lft forever

$ ip route
default via 10.0.3.2 dev eth1 proto dhcp src 10.0.3.15 metric 1003
10.0.3.0/24 dev eth1 proto dhcp scope link src 10.0.3.15 metric 1003
192.168.10.0/24 dev eth0 proto kernel scope link src 192.168.10.11

本記事の検証環境の場合、

  • ネットワークアダプター1(eth0)に「ホストオンリーアダプター(192.168.10.0/24)
  • ネットワークアダプター2(eth1)に「NAT(DHCP)

を割り当てています。

ヘルプメッセージ

$ arping -h        # 簡易ヘルプメッセージ(usageのみ)
$ arping --help    # 詳細ヘルプメッセージ(usage、Options)

頻出オプションの使用例

送信回数(-c)

-cオプションを使用すると、ARPリクエストの送信回数を指定できます。この例では、192.0.2.1に対してARPリクエストを3回送信して自動的に終了します。

$ sudo arping -c 3 192.0.2.1    # 送信回数:3回

応答回数(-C)

応答が-Cオプションで指定した回数に達した時点で、コマンドの実行を終了します。

$ sudo arping -C 3 192.0.2.1    # 応答回数:3回

タイムアウト(-w)

-wオプションで指定した秒数が経過したら、コマンドの実行を終了します。

$ sudo arping -w 5 192.0.2.1    # タイムアウト:5秒

送信間隔(-W)

-Wオプションにて、送信間隔(秒単位)を指定します。

$ sudo arping -W 3 192.0.2.1    # 送信間隔:3秒

詳細出力モード(-v, -vv)

-vオプションを指定すると、詳細なログを出力します。2回指定(-vv)すると、さらに詳細なログを出力します。

$ sudo arping -v 192.0.2.1
$ sudo arping -vv 192.0.2.1

【参考】オプションの違いによる実行結果の比較(※本記事の検証環境の実行結果より抜粋)

通常出力(オプションなし)の場合

ARPING 192.168.10.202
60 bytes from 08:00:27:5a:51:51 (192.168.10.202): index=0 time=477.907 usec
60 bytes from 08:00:27:5a:51:51 (192.168.10.202): index=1 time=555.571 usec
60 bytes from 08:00:27:5a:51:51 (192.168.10.202): index=2 time=494.624 usec

詳細出力(-v)の場合

arping: Autodetected interface eth0
arping: Landlock enabled
This box:   Interface: eth0  IP: 192.168.10.11   MAC address: 08:00:27:79:3a:0a
ARPING 192.168.10.202
60 bytes from 08:00:27:5a:51:51 (192.168.10.202): index=0 time=517.156 usec
60 bytes from 08:00:27:5a:51:51 (192.168.10.202): index=1 time=558.493 usec
60 bytes from 08:00:27:5a:51:51 (192.168.10.202): index=2 time=529.160 usec

詳細出力(-vv)の場合

arping: clock_getres() = 0s 1ns
arping: trying libnet_init(LIBNET_LINK, <null>)
arping: libnet_getfd(): 3
arping: Autodetected interface eth0
arping: trying libnet_init(LIBNET_LINK, eth0)
Timestamp types:
  Name               Description
  host               Host
arping: Successfully chrooted to /run/sshd
arping: Landlock enabled
arping: Successfully dropped uid/gid to 65534/65534.
arping: pcap_get_selectable_fd(): 4
This box:   Interface: eth0  IP: 192.168.10.11   MAC address: 08:00:27:79:3a:0a
ARPING 192.168.10.202
arping: sending packet at time 771.409138482
60 bytes from 08:00:27:5a:51:51 (192.168.10.202): index=0 time=371.026 usec
arping: sending packet at time 772.410449539
60 bytes from 08:00:27:5a:51:51 (192.168.10.202): index=1 time=552.668 usec
arping: sending packet at time 773.412265602
60 bytes from 08:00:27:5a:51:51 (192.168.10.202): index=2 time=707.656 usec

静音モード(-q)

-qオプションを指定すると、エラーメッセージのみ表示します。(通常メッセージは表示しない)

$ sudo arping -q 192.0.2.1

Rawモード(-r, -R)

各応答に対して、MACアドレスまたはIPアドレスのみを出力します。

# MACアドレスのみ出力(-r)
$ sudo arping -r 192.0.2.1
XX:XX:XX:XX:XX:XX

# IPアドレスのみ出力(-R)
$ sudo arping -R 192.0.2.1
192.0.2.1

# 両方(MAC+IP)出力(-r -R)
$ sudo arping -r -R 192.0.2.1
XX:XX:XX:XX:XX:XX 192.0.2.1

IPアドレス重複を検知(-d)

異なる2つのMACアドレスから応答があった場合、終了ステータス1で終了します。同一のIPアドレスが複数の機器に割り当てられている事象を調査する際に使用します。

$ sudo arping -d 192.0.2.1

# 終了ステータス
# 0:重複なし(正常)
# 1:重複あり

終了ステータスは、echo $?コマンドで確認できます。

【参考】本記事の検証環境での実行結果

IPアドレスの重複がない場合(正常時)

$ sudo arping -d 192.168.10.222
ARPING 192.168.10.222
60 bytes from 08:00:27:0d:9d:58 (192.168.10.222): index=0 time=465.815 usec
60 bytes from 08:00:27:0d:9d:58 (192.168.10.222): index=1 time=581.144 usec
60 bytes from 08:00:27:0d:9d:58 (192.168.10.222): index=2 time=592.740 usec

--- 192.168.10.222 statistics ---
3 packets transmitted, 3 packets received,   0% unanswered (0 extra)
rtt min/avg/max/std-dev = 0.466/0.547/0.593/0.057 ms

$ echo $?
0

IPアドレスの重複がある場合

$ sudo arping -d 192.168.10.222
ARPING 192.168.10.222
60 bytes from 08:00:27:0d:9d:58 (192.168.10.222): index=0 time=375.888 usec
60 bytes from 08:00:27:5a:51:51 (192.168.10.222): index=1 time=530.552 usec
60 bytes from 08:00:27:0d:9d:58 (192.168.10.222): index=2 time=959.669 usec
60 bytes from 08:00:27:5a:51:51 (192.168.10.222): index=3 time=990.333 usec
60 bytes from 08:00:27:0d:9d:58 (192.168.10.222): index=4 time=592.858 usec
60 bytes from 08:00:27:5a:51:51 (192.168.10.222): index=5 time=726.289 usec

--- 192.168.10.222 statistics ---
3 packets transmitted, 6 packets received,   0% unanswered (3 extra)
rtt min/avg/max/std-dev = 0.376/0.696/0.990/0.223 ms

$ echo $?
1

【実際にやってみた】ARPingとPingの実行結果を比較検証

本検証では、ICMP Echo Requestを遮断したUbuntu環境に対して、Kali Linuxからpingarpingを実行します。さらに、Kali Linux側でtcpdumpを実行し、実際に送受信されるパケットの違いを確認します。

本検証のシステム構成は、下記のとおりです。(両ホストは、Windows上のVirtualBox環境にてホストオンリーネットワーク構成で稼働しています。)

OSIPアドレス使用するミドルウェア
送信元Kali Linux 2026.1192.168.10.11ping
arping
tcpdump(パケットキャプチャ)
送信先Ubuntu 26.04 LTS192.168.10.202ufw(ファイアウォール機能)

事前準備:UbuntuでICMPを遮断する

Ubuntu側で、ICMP Echo Requestの受信を遮断(DROP)します。

STEP

前提条件

ufwサービスを稼働中であること

$ systemctl status ufw
● ufw.service - Uncomplicated firewall
     Loaded: loaded (/usr/lib/systemd/system/ufw.service; enabled; preset: enabled)
     Active: active (exited) since Thu 2026-05-21 14:19:58 JST; 1h 17min ago
     〜 以下、省略 〜

ufwが有効であること

$ sudo ufw status
状態: アクティブ
STEP

ufwルールを変更

まず、/etc/ufw/before.rulesを編集して、ICMP Echo Requestの受信を遮断(DROP)します。

# 編集前
-A ufw-before-input -p icmp --icmp-type echo-request -j ACCEPT

# 編集後
-A ufw-before-input -p icmp --icmp-type echo-request -j DROP
STEP

ufwルールを再読み込み

次に、変更後のufwルールを反映します。

$ sudo ufw reload
STEP

反映内容を確認

最後に、正しく反映されているか、確認します。

$ sudo iptables -L
〜 以下、抜粋 〜
Chain ufw-before-input (1 references)
DROP       icmp --  anywhere             anywhere             icmp echo-request

ICMP Echo Requestが遮断(DROP)されていることが確認できました。この状態では、Ubuntuはpingに応答しません。

Kali Linuxでping、arpingを実行する

Kali Linuxのネットワークインターフェースはeth0(*)を使用します。(* ホストオンリーアダプター:192.168.10.0/24)

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
〜 省略 〜
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:79:3a:0a brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.11/24 brd 192.168.10.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe79:3a0a/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
〜 省略 〜
STEP

Kali Linux側でtcpdumpを起動する

pingおよびarpingの実行前に、Kali Linux上でtcpdumpを起動し、対象インターフェース(ここではeth0)のパケットをキャプチャします。

Kali Linux側で実行(別ターミナルで起動しておく)

$ sudo tcpdump -i eth0
STEP

pingを実行する

Kali LinuxからUbuntu(192.168.10.202)に対して、pingコマンドを実行します。

Kali Linux側で実行

$ ping -I eth0 -c 3 192.168.10.202
PING 192.168.10.202 (192.168.10.202) from 192.168.10.11 eth0: 56(84) bytes of data.

--- 192.168.10.202 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2095ms

3パケット送信しましたが、ICMPが遮断されているため、応答は0件(パケットロス率100%)となりました。Ubuntuはオンライン状態ですが、pingコマンドでは「到達不能」と判定されます。

ping実行時のtcpdump結果

19:52:36.024402 IP 192.168.10.11 > 192.168.10.202: ICMP echo request, id 56527, seq 1, length 64
19:52:37.057848 IP 192.168.10.11 > 192.168.10.202: ICMP echo request, id 56527, seq 2, length 64
19:52:38.119286 IP 192.168.10.11 > 192.168.10.202: ICMP echo request, id 56527, seq 3, length 64

Kali LinuxからUbuntuにICMP echo requestは送信されていますが、Ubuntu側からの応答(ICMP echo reply)がtcpdumpにも表示されていません。

【参考】ICMPを遮断していない場合

19:58:55.443791 IP 192.168.10.11 > 192.168.10.202: ICMP echo request, id 56528, seq 1, length 64
19:58:55.444244 IP 192.168.10.202 > 192.168.10.11: ICMP echo reply, id 56528, seq 1, length 64
19:58:56.479768 IP 192.168.10.11 > 192.168.10.202: ICMP echo request, id 56528, seq 2, length 64
19:58:56.480400 IP 192.168.10.202 > 192.168.10.11: ICMP echo reply, id 56528, seq 2, length 64
19:58:57.512094 IP 192.168.10.11 > 192.168.10.202: ICMP echo request, id 56528, seq 3, length 64
19:58:57.512677 IP 192.168.10.202 > 192.168.10.11: ICMP echo reply, id 56528, seq 3, length 64

ICMPを遮断していない場合、ICMP echo requestに対して、ICMP echo replyが出力されます。

STEP

arpingを実行する

次は同じ対象ホストに対して、arpingコマンドを実行します。

Kali Linux側で実行

$ sudo arping -i eth0 -c 3 192.168.10.202
ARPING 192.168.10.202
60 bytes from 08:00:27:5a:51:51 (192.168.10.202): index=0 time=485.163 usec
60 bytes from 08:00:27:5a:51:51 (192.168.10.202): index=1 time=591.878 usec
60 bytes from 08:00:27:5a:51:51 (192.168.10.202): index=2 time=539.318 usec

--- 192.168.10.202 statistics ---
3 packets transmitted, 3 packets received,   0% unanswered (0 extra)
rtt min/avg/max/std-dev = 0.485/0.539/0.592/0.044 ms

3回すべてに対して応答を受信しており、Ubuntuがオンライン状態であることが確認できます。さらに、UbuntuのMACアドレス(08:00:27:5a:51:51)も取得できています。

arping実行時のtcpdump結果

19:56:43.040622 ARP, Request who-has 192.168.10.202 tell 192.168.10.11, length 44
19:56:43.041106 ARP, Reply 192.168.10.202 is-at 08:00:27:5a:51:51 (oui Unknown), length 46
19:56:44.042355 ARP, Request who-has 192.168.10.202 tell 192.168.10.11, length 44
19:56:44.042942 ARP, Reply 192.168.10.202 is-at 08:00:27:5a:51:51 (oui Unknown), length 46
19:56:45.043223 ARP, Request who-has 192.168.10.202 tell 192.168.10.11, length 44
19:56:45.043767 ARP, Reply 192.168.10.202 is-at 08:00:27:5a:51:51 (oui Unknown), length 46

ARPリクエスト(ARP, Request who-has ...)に対して、UbuntuからARPリプライ(ARP, Reply ... is-at)が返ってきていることが確認できます。

検証結果から分かったこと

今回の検証では、ICMPを遮断したUbuntuに対して、Kali Linuxからpingコマンドとarpingコマンドを実行しました。その結果を整理すると、以下のようになります。

項目pingarping
使用プロトコルICMPARP
ufwの影響受ける受けない
応答の有無なし(100% packet loss)あり(3/3応答)
MACアドレスの取得不可可能
tcpdumpでの応答確認応答パケットなしリクエスト・リプライの双方を確認
ホスト稼働状況の判定誤判定(オフライン状態)正確に判定(オンライン状態)

ICMP遮断環境でもarpingは影響を受けない

  • pingでは、3パケットを送信したにもかかわらず、応答が0件(パケットロス率100%)という結果になりました。
  • 一方、arpingでは、全3パケットに対して応答を受信(応答率100%)し、対象ホストのMACアドレスも取得できました。

tcpdumpによるパケットレベルでも、同様の結果が得られた

  • ping実行時は、ICMP Echo Requestのみ送信され、応答が返ってきません。
  • 一方、arping実行時は、ARP Requestに対してARP Replyが正常に返されています。

まとめ

本記事ではThomas Habets版のarpingについて、以下のポイントを解説しました。

  • Thomas Habets版とiputils版の違い
  • インストール方法
  • arpingコマンドの基本操作
  • 頻出オプションの具体例
  • ICMP遮断環境におけるpingとの挙動比較

arpingは、ARP(Address Resolution Protocol)を使用してデータリンク層(L2)でホストの疎通確認を行うツールです。ICMPを使用するpingとは動作レイヤーが異なるため、ファイアウォール機能でICMPを遮断している環境でも、対象ホストの存在を確認できる点が最大の特徴です。

実際の検証でも確認したとおり、Ubuntu環境においてICMPを遮断した場合、pingでは応答を受け取れなかった一方、arpingでは応答を受信できました。このことから、pingで応答が得られない場合でも「対象機器が存在しない」と即断せず、arpingによる補完確認を推奨します。

デフォラボ

この記事が気に入ったら
フォローしてね!

よかったらシェアしてね!
  • URLをコピーしました!
目次