ping 명령어 (AIX 5.3·6.1)

핵심 정리

  • 호스트나 게이트웨이에 ICMP ECHO_REQUEST를 보내 ECHO_RESPONSE를 받아 봅니다. 네트워크가 통하는지 볼 때 가장 먼저 씁니다.
  • AIX ping은 기본으로 Ctrl+C를 누를 때까지 1초마다 계속 보냅니다. 횟수를 정하려면 ping -c 5 호스트를 씁니다.
  • 끝나면 보낸·받은 패킷 수, 손실률, 왕복 시간(min/avg/max)을 요약합니다.
  • 자주 쓰는 플래그: -c(횟수), -s(데이터 크기, 기본 56바이트), -i(간격), -S(출발지 주소), -n(이름 풀이 안 함), -q(요약만), -w(마지막 응답 대기 시간).
  • -f(flood)는 root만 쓸 수 있고 네트워크에 큰 부담을 줍니다.
항목 내용
버전 AIX 5.3, AIX 6.1 (6.1 문서에 RBAC 보안 안내가 더해짐. 플래그는 같음)
원문 IBM Commands Reference — 5.3 Volume 4, 6.1 Volume 4
파일 /usr/sbin/ping
관련 명령어 traceroute, netstat, ifconfig, ping6

목적

네트워크 호스트에 echo 요청을 보냅니다.

영어 원문

Sends an echo request to a network host.

구문

text
ping [ -d ] [ -D ] [ -n ] [ -q ] [ -r ] [ -v ] [ -R ] [ -a addr_family ] [ -c Count ] [ -w timeout ]
     [ -f | -i Wait ] [ -l Preload ] [ -p Pattern ] [ -s PacketSize ] [ -S hostname/IP addr ] [ -L ]
     [ -I a.b.c.d. ] [ -o interface ] [ -T ttl ] Host [ PacketSize ] [ Count ]

설명

/usr/sbin/ping 명령은 호스트나 게이트웨이에 ICMP(Internet Control Message Protocol) ECHO_REQUEST를 보내 ICMP ECHO_RESPONSE를 받습니다. 다음 일에 쓸모 있습니다.

  • 네트워크와 원격 호스트의 상태 확인
  • 하드웨어·소프트웨어 문제의 추적과 범위 좁히기
  • 네트워크 시험, 측정, 관리

호스트가 동작 중이고 네트워크에 있으면 echo에 응답합니다. echo 요청마다 IP·ICMP 헤더 다음에 ping의 PID와 timeval 구조체, 그리고 패킷을 채울 만큼의 바이트가 들어갑니다. 기본으로 인터럽트(Ctrl+C)를 받을 때까지 echo 요청을 계속 보냅니다.

ping은 1초에 데이터그램 하나를 보내고 응답을 받을 때마다 한 줄을 출력합니다. 왕복 시간과 패킷 손실 통계를 계산해 끝날 때 짧게 요약합니다. 시간이 다 되거나 SIGINT를 받으면 끝납니다. Host 매개변수는 올바른 호스트 이름이나 인터넷 주소입니다.

인터럽트 키는 stty 명령으로 바꿀 수 있습니다.

echo 요청을 계속 보내면 시스템에 부담이 되므로, 반복 요청은 주로 문제를 좁힐 때만 씁니다.

영어 원문

The /usr/sbin/ping command sends an Internet Control Message Protocol (ICMP) ECHO_REQUEST to obtain an ICMP ECHO_RESPONSE from a host or gateway. The ping command is useful for:

  • Determining the status of the network and various foreign hosts.

  • Tracking and isolating hardware and software problems.

  • Testing, measuring, and managing networks.

If the host is operational and on the network, it responds to the echo. Each echo request contains an Internet Protocol (IP) and ICMP header, followed by a ping PID and a timeval structure, and enough bytes to fill out the packet. The default is to continuously send echo requests until an Interrupt is received (Ctrl-C).

The ping command sends one datagram per second and prints one line of output for every response received. The ping command calculates round-trip times and packet loss statistics, and displays a brief summary on completion. The ping command completes when the program times out or on receipt of a SIGINT signal. The Host parameter is either a valid host name or Internet address.

By default, the ping command will continue to send echo requests to the display until an Interrupt is received (Ctrl-C). The Interrupt key can be changed by using the stty command.

Because of the load that continuous echo requests can place on the system, repeated requests should be used primarily for problem isolation.

플래그

플래그 설명
-c Count 보낼(받을) echo 요청 수.
-w timeout -c와 함께만 동작합니다. 마지막 패킷을 보낸 뒤 응답을 최대 timeout초 기다립니다.
-d 소켓 수준 디버깅을 시작합니다.
-D 받은 ICMP ECHO_REPLY 패킷을 16진수로 덤프합니다.
-f flood ping. 패킷이 돌아오는 대로 또는 초당 100번 중 많은 쪽으로 보냅니다. ECHO_REQUEST를 보낼 때마다 .을, ECHO_REPLY를 받을 때마다 백스페이스를 출력해 버려지는 패킷 수를 빠르게 보여 줍니다. root만 쓸 수 있고 네트워크에 큰 부담을 주므로 조심해서 씁니다. -i와 함께 쓸 수 없습니다.
-I a.b.c.d 나가는 IPv4 멀티캐스트에 쓸 인터페이스(주소). 대문자 i입니다.
-o interface 나가는 IPv6 멀티캐스트에 쓸 인터페이스(en0, tr0 등).
-i Wait 패킷 사이에 Wait초 기다립니다. 기본 1초. -f와 함께 쓸 수 없습니다.
-L 멀티캐스트 ping의 로컬 루프백을 끕니다.
-l Preload 보통 모드(초당 하나)로 들어가기 전에 Preload개 패킷을 되도록 빨리 보냅니다. 소문자 l입니다.
-n 숫자로만 출력합니다. 호스트 주소의 이름을 찾지 않습니다.
-p Pattern 보낼 패킷을 채울 패드 바이트(최대 16바이트). 데이터에 따라 생기는 네트워크 문제를 진단할 때 씁니다. 예: -p ff는 모두 1로 채웁니다.
-q 조용한 출력. 시작과 끝의 요약 줄만 보여 줍니다.
-r 라우팅 표를 거치지 않고 붙어 있는 네트워크의 호스트로 바로 보냅니다. 직접 연결된 네트워크가 아니면 오류를 냅니다. 경로가 없어진 인터페이스로 로컬 호스트에 ping할 때 씁니다.
-R 경로 기록. ECHO_REQUEST에 RECORD_ROUTE 옵션을 넣고 돌아온 패킷의 경로 버퍼를 보여 줍니다. IP 헤더에는 경로가 9개까지만 들어가며, 많은 호스트와 게이트웨이가 이 옵션을 무시합니다.
-a addr_family addr_family가 inet6이면 ICMP 패킷의 목적지 주소를 IPv6 형식으로 대응합니다.
-s PacketSize 보낼 데이터 바이트 수. 기본 56으로, ICMP 헤더 8바이트와 합쳐 ICMP 데이터 64바이트가 됩니다.
-S hostname/IP addr 나가는 ping 패킷의 출발지 주소. IP 주소가 여럿인 호스트에서 패킷을 보내는 인터페이스가 아닌 주소를 출발지로 쓰게 합니다. 그 머신의 인터페이스 주소가 아니면 오류를 내고 보내지 않습니다.
-T ttl 멀티캐스트 패킷의 생존 시간(ttl).
-v 자세한 출력. echo 응답 말고 받은 ICMP 패킷도 나열합니다.
영어 원문
  • -c Count — Specifies the number of echo requests, as indicated by the Count variable, to be sent (and received).
  • -w timeout — This option works only with the -c option. It causes ping to wait for a maximum of 'timeout' seconds for a reply (after sending the last packet).
  • -d — Starts socket-level debugging.
  • -D — This option causes a hex dump to standard output of ICMP ECHO_REPLY packets.
  • -f — Specifies flood-ping option. The -f flag "floods" or outputs packets as fast as they come back or one hundred times per second, whichever is more. For every ECHO_REQUEST sent, a . (period) is printed, while for every ECHO_REPLY received, a backspace is printed. This provides a rapid display of how many packets are being dropped. Only the root user may use this option. Note: This can be very hard on a network and should be used with caution. Flood pinging is only permitted by the root user. The -f flag is incompatible with the -i Wait flag.
  • -I a.b.c.d — Specifies that the interface specified by a.b.c.d is to be used for outgoing IPv4 multicasts. The -I flag is an uppercase i.
  • -o interface — Specifies that interface is to be used for outgoing IPv6 multicasts. The interface is specified in the form 'en0', 'tr0' etc.
  • -i Wait — Waits the number of seconds specified by the Wait variable between the sending of each packet. The default is to wait for one second between each packet. This option is incompatible with the -f flag.
  • -L — Disables local loopback for multicast pings.
  • -l Preload — Sends the number of packets specified by the Preload variable as fast as possible before falling into normal mode of behavior (one per second). The -l flag is a lowercase l.
  • -n — Specifies numeric output only. No attempt is made to look up symbolic names for host addresses.
  • -p Pattern — Specifies up to 16 'pad' bytes to fill out the packet you send. This is useful for diagnosing data-dependent problems in a network. For example, -p ff fills the packet with all 1's.
  • -q — Specifies quiet output. Nothing is displayed except the summary lines at startup time and when finished.
  • -r — Bypasses the routing tables and sends directly to a host on an attached network. If the Host is not on a directly connected network, the ping command generates an error message. This option can be used to ping a local host through an interface that no longer has a route through it.
  • -R — Specifies record route option. The -R flag includes the RECORD_ROUTE option in the ECHO_REQUEST packet and displays the route buffer on returned packets. Note: The IP header is only large enough for nine such routes. Also, many hosts and gateways ignore this option.
  • -a addr_family — Maps the destination address of the ICMP packets to IPv6 format if addr_family is equal to "inet6".
  • -s PacketSize — Specifies the number of data bytes to be sent. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data.
  • -S hostname/IP addr — Uses the IP address as the source address in outgoing ping packets. On hosts with more than one IP address, the -S flag can be used to force the source address to be something other than the IP address of the interface on which the packet is sent. If the IP address is not one of the machine's interface addresses, an error is returned and nothing is sent.
  • -T ttl — Specifies that the time-to-live for a multicast packet is ttl seconds.
  • -v — Requests verbose output, which lists ICMP packets that are received in addition to echo responses.

매개변수

매개변수 설명
PacketSize 보낼 데이터 바이트 수. 기본 56(ICMP 헤더 8바이트와 합쳐 64바이트). 예전 ping과의 호환용입니다.
Count 보낼(받을) echo 요청 수. 예전 ping과의 호환용입니다.
영어 원문
  • PacketSize — Specifies the number of data bytes to be sent. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data. This parameter is included for compatibility with previous versions of the ping command.
  • Count — Specifies the number of echo requests to be sent (and received). This parameter is included for compatibility with previous versions of the ping command.

보안

RBAC 사용자와 Trusted AIX 사용자는 주의하세요. 이 명령은 특권 작업을 할 수 있으며, 특권 작업은 특권 사용자만 할 수 있습니다. 특권과 권한 목록은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다(6.1 문서에만 있음).

영어 원문

Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.

예제

  1. 호스트 canopus에 echo 요청을 5번 보내 연결을 확인합니다. 두 명령은 같습니다.
bash
ping -c 5 canopus
ping canopus 56 5
text
PING canopus.austin.century.com: (128.116.1.5): 56 data bytes
64 bytes from 128.116.1.5: icmp_seq=0 ttl=255 time=2 ms
64 bytes from 128.116.1.5: icmp_seq=1 ttl=255 time=2 ms
64 bytes from 128.116.1.5: icmp_seq=2 ttl=255 time=3 ms
64 bytes from 128.116.1.5: icmp_seq=3 ttl=255 time=2 ms
64 bytes from 128.116.1.5: icmp_seq=4 ttl=255 time=2 ms
----canopus.austin.century.com PING Statistics----
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 2/2/3 ms
  1. 호스트 lear의 정보를 얻으며 소켓 수준 디버깅을 시작합니다. Ctrl+C를 누를 때까지 계속됩니다.
bash
ping -d lear
  1. 데이터 2000바이트를 보냅니다. 두 명령은 같으며, 응답은 2008 bytes from ...처럼 ICMP 헤더 8바이트를 더한 크기로 나옵니다.
bash
ping -s 2000 opus
ping opus 2000
  1. 호스트 stlopnor에 flood ping을 보냅니다(root만). Ctrl+C를 누르면 1098 packets transmitted, 1097 packets received 같은 요약이 나옵니다.
bash
ping -f stlopnor
  1. 패킷 사이 간격을 5초로 합니다.
bash
ping -i5 opus
  1. 보통 모드로 들어가기 전에 10개를 되도록 빨리 보냅니다. 처음 패킷들은 왕복 시간이 길어지다가(9ms에서 36ms까지) 보통 모드에서 6ms 안팎으로 돌아옵니다.
bash
ping -l 10 opus
  1. 데이터에 따른 문제를 진단하려고 모두 1(0xff)로 채운 패킷을 보냅니다. 출력 첫 줄에 PATTERN: 0xff가 나옵니다.
bash
ping -p ff opus
  1. 요약만 봅니다. 화면에 보이지 않아도 Ctrl+C를 누를 때까지 패킷은 계속 보냅니다.
bash
ping -q bach
text
PING bach.austin.century.com: (129.35.34.234): 56 data bytes
^C
----bach.austin.century.com PING Statistics----
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 5/5/8 ms

자주 쓰는 형태:

bash
ping -c 3 -w 2 10.1.1.1             # 3번, 마지막 응답은 2초까지 기다림
ping -c 3 -S 10.1.2.10 10.1.1.1     # 출발지 주소를 정해 보냄(여러 IP가 있을 때)
ping -c 3 -s 1472 10.1.1.1          # MTU 1500 경로 확인(1472+8+20)
ping6 -c 3 fe80::1%en0              # IPv6
영어 원문
  1. To check the network connection to host canopus and specify the number of echo requests to send, enter:
ping -c 5 canopus

OR

ping canopus 56 5

Information similar to the following is displayed:

PING canopus.austin.century.com: (128.116.1.5): 56 data bytes
64 bytes from 128.116.1.5: icmp_seq=0 ttl=255 time=2 ms
64 bytes from 128.116.1.5: icmp_seq=1 ttl=255 time=2 ms
64 bytes from 128.116.1.5: icmp_seq=2 ttl=255 time=3 ms
64 bytes from 128.116.1.5: icmp_seq=3 ttl=255 time=2 ms
64 bytes from 128.116.1.5: icmp_seq=4 ttl=255 time=2 ms
----canopus.austin.century.com PING Statistics----
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 2/2/3 ms
  1. To get information about host lear and start socket-level debugging, enter:
ping -d lear

Information similar to the following is displayed:

PING lear.austin.century.com: (128.114.4.18) 56 data bytes
64 bytes from 128.114.4.18: icmp_seq=0 ttl=255 time=6 ms
64 bytes from 128.114.4.18: icmp_seq=1 ttl=255 time=17 ms
64 bytes from 128.114.4.18: icmp_seq=2 ttl=255 time=6 ms
64 bytes from 128.114.4.18: icmp_seq=3 ttl=255 time=6 ms
64 bytes from 128.114.4.18: icmp_seq=4 ttl=255 time=6 ms
^C
----lear.austin.century.com PING Statistics ----
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 6/8/17 ms

Note: The output is repeated until an Interrupt (Ctrl-C) is received.

  1. To obtain information about host opus and specify the number of data bytes to be sent, enter:
ping -s 2000 opus

OR

ping opus 2000

Information similar to the following is displayed: PING opus.austin.century.com: (129.35.34.234): 2000 data bytes 2008 bytes from 129.35.34.234: icmp_seq=0 ttl=255 time=20 ms 2008 bytes from 129.35.34.234: icmp_seq=1 ttl=255 time=19 ms 2008 bytes from 129.35.34.234: icmp_seq=2 ttl=255 time=20 ms 2008 bytes from 129.35.34.234: icmp_seq=3 ttl=255 time=20 ms 2008 bytes from 129.35.34.234: icmp_seq=4 ttl=255 time=20 ms 2008 bytes from 129.35.34.234: icmp_seq=5 ttl=255 time=19 ms 2008 bytes from 129.35.34.234: icmp_seq=6 ttl=255 time=19 ms ^C ----opus.austin.century.com PING Statistics---- 7 packets transmitted, 7 packets received, 0% packet loss round-trip min/avg/max = 19/19/20 ms

Note: The output is repeated until an Interrupt (Ctrl-C) is received.

  1. To invoke the flood-ping option to host stlopnor, enter:

ping -f stlopnor

Information similar to the following is displayed: Ping stlopnor.austin.century.com: (129.35.34.234): 56 data bytes .^C ----stlopnor.austin.century.com PING Statistics ---- 1098 packets transmitted, 1097 packets received, 0% packet loss round-trip min/avg/max = 4/4/11

Note: The flood-ping output continues until an Interrupt (Ctrl-C) is received.

  1. To specify an interval of five seconds between packets sent to host opus, enter:

ping -i5 opus

Information similar to the following is displayed: PING opus.austin.century.com: (129.35.34.234): 56 data bytes 64 bytes from 129.35.34.234: icmp_seq=0 ttl=255 time=5 ms 64 bytes from 129.35.34.234: icmp_seq=1 ttl=255 time=5 ms 64 bytes from 129.35.34.234: icmp_seq=2 ttl=255 time=6 ms ^C ----opus.austin.century.com PING Statistics---- 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 5/5/6 ms

Note: The output is repeated until an Interrupt (Ctrl-C) is received.

  1. To send the number of packets specified by the Preload variable as fast as possible before falling into normal mode of behavior to host opus, enter:

ping -l 10 opus

Information similar to the following is displayed: PING opus.austin.century.com: (129.35.34.234): 56 data bytes 64 bytes from 129.35.34.234: icmp_seq=0 ttl=255 time=9 ms 64 bytes from 129.35.34.234: icmp_seq=1 ttl=255 time=11 ms 64 bytes from 129.35.34.234: icmp_seq=2 ttl=255 time=16 ms 64 bytes from 129.35.34.234: icmp_seq=3 ttl=255 time=22 ms 64 bytes from 129.35.34.234: icmp_seq=4 ttl=255 time=26 ms 64 bytes from 129.35.34.234: icmp_seq=5 ttl=255 time=27 ms

64 bytes from 129.35.34.234: icmp_seq=6 ttl=255 time=30 ms
64 bytes from 129.35.34.234: icmp_seq=7 ttl=255 time=31 ms
64 bytes from 129.35.34.234: icmp_seq=8 ttl=255 time=33 ms
64 bytes from 129.35.34.234: icmp_seq=9 ttl=255 time=35 ms
64 bytes from 129.35.34.234: icmp_seq=10 ttl=255 time=36 ms
64 bytes from 129.35.34.234: icmp_seq=11 ttl=255 time=6 ms
64 bytes from 129.35.34.234: icmp_seq=12 ttl=255 time=6 ms
64 bytes from 129.35.34.234: icmp_seq=13 ttl=255 time=6 ms
64 bytes from 129.35.34.234: icmp_seq=14 ttl=255 time=7 ms
64 bytes from 129.35.34.234: icmp_seq=15 ttl=255 time=6 ms
^C
----opus.austin.century.com PING Statistics----
16 packets transmitted, 16 packets received, 0% packet loss
round-trip min/avg/max = 6/19/36 ms

Note: The output is repeated until an Interrupt (Ctrl-C) is received.

  1. To diagnose data-dependent problems in a network, enter:
ping -p ff opus

This command sends packets with a pad-pattern of all 1's to host opus. Information similar to the following is displayed:

PATTERN: 0xff
PING opus.austin.century.com: (129.35.34.234): 56 data bytes
64 bytes from 129.35.34.234: icmp_seq=0 ttl=255 time=5 ms
64 bytes from 129.35.34.234: icmp_seq=1 ttl=255 time=5 ms
64 bytes from 129.35.34.234: icmp_seq=2 ttl=255 time=5 ms
64 bytes from 129.35.34.234: icmp_seq=3 ttl=255 time=6 ms
64 bytes from 129.35.34.234: icmp_seq=4 ttl=255 time=5 ms
^C
----opus.austin.century.com PING Statistics----
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 5/5/6 ms

Note: The output is repeated until an Interrupt (Ctrl-C) is received.

  1. To specify quiet output, enter:
ping -q bach

Only summary information similar to the following is displayed:

PING bach.austin.century.com: (129.35.34.234): 56 data bytes
^C
----bach.austin.century.com PING Statistics----
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 5/5/8 ms

Note: Although not displayed, the output of packets continues until an Interrupt (Ctrl-C) is received.

Related reference:

  • netstat Command

Related information:

  • ifconfig command
  • Communications and networks

리눅스(GNU)와 다른 점

리눅스 ping(iputils)은 기본으로 계속 보내는 것은 같지만 옵션 뜻이 일부 다릅니다. -c(횟수), -i(간격), -s(크기), -q, -n, -f는 같고, 출발지는 -I 주소나 인터페이스, 전체 시간 제한은 -w 초, 응답마다 기다리는 시간은 -W 초입니다. AIX의 -I는 IPv4 멀티캐스트 인터페이스, -S는 출발지이므로 헷갈리지 않게 합니다. 단편화 금지로 MTU를 시험할 때는 -M do를 씁니다.