fping
Ping
ping 은 TCP/IP 프로토콜 중 ICMP 를 통해 동작하며, 유니캐스트 전송 방식이다.
ICMP 프로토콜 동작 원리는 호스트에 요청(ICMP echo request)을 보내고 요청을 받은 호스트가 응답(ICMP echo reply)한다. 이를 통해 그 호스트가 작동하는지와 네트워크 상태가 어떠한지 등을 파악할 수 있다.
ICMP 프로토콜을 지원하지 않은 기기나 보안 정책 중 ICMP를 차단하는 경우 ping 명령어는 사용할 수 없다.
fping
ping에서 한단계 진보한 명령이다.
가장 큰 차이점은 ping은 단일 대상, fping은 대상을 범위로 설정하기 때문에 대역적이다.
다음은 fping의 옵션이다.
OPTIONS
-a Show systems that are alive.
-A Display targets by address rather than DNS name. Combined with -d, the
output will be both the ip and (if available) the hostname.
-b n Number of bytes of ping data to send. The minimum size (normally 12)
allows room for the data that fping needs to do its work (sequence number,
timestamp). The reported received data size includes the IP header
(normally 20 bytes) and ICMP header (8 bytes), so the minimum total size
is 40 bytes. Default is 56, as in ping. Maximum is the theoretical
maximum IP datagram size (64K), though most systems limit this to a
smaller, system-dependent number.
-B n Backoff factor. In the default mode, fping sends several requests to a
target before giving up, waiting longer for a reply on each successive
request. This parameter is the value by which the wait time (-t) is
multiplied on each successive request; it must be entered as a floating-
point number (x.y). The default is 1.5.
-c n Number of request packets to send to each target. In this mode, a line is
displayed for each received response (this can suppressed with -q or -Q).
Also, statistics about responses for each target are displayed when all
requests have been sent (or when interrupted).
-C n Similar to -c, but the per-target statistics are displayed in a format
designed for automated response-time statistics gathering. For example:
% fping -C 5 -q somehost
somehost : 91.7 37.0 29.2 - 36.8
shows the response time in milliseconds for each of the five requests,
with the "-" indicating that no response was received to the fourth
request.
-d Use DNS to lookup address of return ping packet. This allows you to give
fping a list of IP addresses as input and print hostnames in the output.
-D Add Unix timestamps in front of output lines generated with in looping or
counting modes (-l, -c, or -C).
-e Show elapsed (round-trip) time of packets.
-f Read list of targets from a file. This option can only be used by the
root user. Regular users should pipe in the file via stdin:
% fping < targets_file
-g addr/mask
Generate a target list from a supplied IP netmask, or a starting and
ending IP. Specify the netmask or start/end in the targets portion of the
command line. If a network with netmask is given, the network and
broadcast addresses will be excluded. ex. To ping the network
192.168.1.0/24, the specified command line could look like either:
fping -g 192.168.1.0/24
or
fping -g 192.168.1.1 192.168.1.254
-h Print usage message.
-i n The minimum amount of time (in milliseconds) between sending a ping packet
to any target (default is 25).
-l Loop sending packets to each target indefinitely. Can be interrupted with
Ctrl-C; statistics about responses for each target are then displayed.
-m Send pings to each of a target host's multiple interfaces.
-n Same as -d.
-p <n>
In looping or counting modes (-l, -c, or -C), this parameter sets the time
in milliseconds that fping waits between successive packets to an
individual target. Default is 1000.
-q Quiet. Don't show per-probe results, but only the final summary. Also
don't show ICMP error messages.
-Q n Like -q, but show summary results every n seconds.
-r n Retry limit (default 3). This is the number of times an attempt at pinging
a target will be made, not including the first try.
-R Instead of using all-zeros as the packet data, generate random bytes. Use
to defeat, e.g., link data compression.
-s Print cumulative statistics upon exit.
-S addr
Set source address.
-I if
Set the interface (requires SO_BINDTODEVICE support)
-t n Initial target timeout in milliseconds (default 500). In the default mode,
this is the amount of time that fping waits for a response to its first
request. Successive timeouts are multiplied by the backoff factor
specified with -B. Note that this option has no effect looping or
counting modes (-l, -c, or -C).
-T n Ignored (for compatibility with fping 2.4).
-u Show targets that are unreachable.
-O n Set the typ of service flag (TOS). n can be either decimal or hexadecimal
(0xh) format.
-v Print fping version information.
-H n Set the IP TTL field (time to live hops).
다음은 fping 옵션 중 몇가지이다.
fping -g
대역을 설정한다.
시작IP~끝IP 또는 시작IP/서브네마스크비트로 값을 입력한다.
도달하거나 도달하지 못한 요청들을 모두 볼 수 있다.
브로드캐스팅 방식이기 때문에 모든 IP에 대하여 요청을 보낸다.
----------------(생략)----------------
fping -q
ICMP request / ICMP reply를 숨긴다.
보다 깔끔한 출력 결과를 확인할 수 있으나 도달한 request 또한 숨기게 되므로 또다른 명령어를 같이 입력해야 한다.
fping -a
도달한 request를 확인할 수 있다.
즉, 작동하는 대상만을 확인할 수 있다.
fping -s
스캔 후 정리된 결과를 확인할 수 있다.