1 | .. comment SPDX-License-Identifier: CC-BY-SA-4.0 |
---|
2 | |
---|
3 | .. COMMENT: COPYRIGHT (c) 1988-2008. |
---|
4 | .. COMMENT: On-Line Applications Research Corporation (OAR). |
---|
5 | .. COMMENT: All rights reserved. |
---|
6 | |
---|
7 | Network Commands |
---|
8 | **************** |
---|
9 | |
---|
10 | Introduction |
---|
11 | ============ |
---|
12 | |
---|
13 | The RTEMS shell has the following network commands: |
---|
14 | |
---|
15 | - netstats_ - obtain network statistics |
---|
16 | |
---|
17 | - ifconfig_ - configure a network interface |
---|
18 | |
---|
19 | - route_ - show or manipulate the IP routing table |
---|
20 | |
---|
21 | - ping_ - ping a host or IP address |
---|
22 | |
---|
23 | Commands |
---|
24 | ======== |
---|
25 | |
---|
26 | This section details the Network Commands available. A subsection is dedicated |
---|
27 | to each of the commands and describes the behavior and configuration of that |
---|
28 | command as well as providing an example usage. |
---|
29 | |
---|
30 | .. raw:: latex |
---|
31 | |
---|
32 | \clearpage |
---|
33 | |
---|
34 | .. _netstats: |
---|
35 | |
---|
36 | netstats - obtain network statistics |
---|
37 | ------------------------------------ |
---|
38 | .. index:: netstats |
---|
39 | |
---|
40 | SYNOPSYS: |
---|
41 | .. code-block:: shell |
---|
42 | |
---|
43 | netstats [-Aimfpcut] |
---|
44 | |
---|
45 | DESCRIPTION: |
---|
46 | This command is used to display various types of network statistics. The |
---|
47 | information displayed can be specified using command line arguments in |
---|
48 | various combinations. The arguments are interpreted as follows: |
---|
49 | |
---|
50 | *-A* |
---|
51 | print All statistics |
---|
52 | |
---|
53 | *-i* |
---|
54 | print Inet Routes |
---|
55 | |
---|
56 | *-m* |
---|
57 | print MBUF Statistics |
---|
58 | |
---|
59 | *-f* |
---|
60 | print IF Statistics |
---|
61 | |
---|
62 | *-p* |
---|
63 | print IP Statistics |
---|
64 | |
---|
65 | *-c* |
---|
66 | print ICMP Statistics |
---|
67 | |
---|
68 | *-u* |
---|
69 | print UDP Statistics |
---|
70 | |
---|
71 | *-t* |
---|
72 | print TCP Statistics |
---|
73 | |
---|
74 | EXIT STATUS: |
---|
75 | This command returns 0 on success and non-zero if an error is encountered. |
---|
76 | |
---|
77 | NOTES: |
---|
78 | NONE |
---|
79 | |
---|
80 | EXAMPLES: |
---|
81 | The following is an example of using the ``netstats`` command to print the |
---|
82 | IP routing table: |
---|
83 | |
---|
84 | .. code-block:: shell |
---|
85 | |
---|
86 | [/] $ netstats -i |
---|
87 | Destination Gateway/Mask/Hw Flags Refs Use Expire Interface |
---|
88 | default 192.168.1.14 UGS 0 0 0 eth1 |
---|
89 | 192.168.1.0 255.255.255.0 U 0 0 1 eth1 |
---|
90 | 192.168.1.14 00:A0:C8:1C:EE:28 UHL 1 0 1219 eth1 |
---|
91 | 192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 840 1202 eth1 |
---|
92 | 192.168.1.151 00:1C:23:B2:0F:BB UHL 1 23 1219 eth1 |
---|
93 | |
---|
94 | The following is an example of using the ``netstats`` command to print the |
---|
95 | MBUF statistics: |
---|
96 | |
---|
97 | .. code-block:: shell |
---|
98 | |
---|
99 | [/] $ netstats -m |
---|
100 | ************ MBUF STATISTICS ************ |
---|
101 | mbufs:2048 clusters: 128 free: 63 |
---|
102 | drops: 0 waits: 0 drains: 0 |
---|
103 | free:1967 data:79 header:2 socket:0 |
---|
104 | pcb:0 rtable:0 htable:0 atable:0 |
---|
105 | soname:0 soopts:0 ftable:0 rights:0 |
---|
106 | ifaddr:0 control:0 oobdata:0 |
---|
107 | |
---|
108 | The following is an example of using the ``netstats`` command to print the |
---|
109 | print the interface statistics: |
---|
110 | |
---|
111 | .. code-block:: shell |
---|
112 | |
---|
113 | [/] $ netstats -f |
---|
114 | ************ INTERFACE STATISTICS ************ |
---|
115 | ***** eth1 ***** |
---|
116 | Ethernet Address: 00:04:9F:00:5B:21 |
---|
117 | Address:192.168.1.244 Broadcast Address:192.168.1.255 Net mask:255.255.255.0 |
---|
118 | Flags: Up Broadcast Running Active Multicast |
---|
119 | Send queue limit:50 length:1 Dropped:0 |
---|
120 | Rx Interrupts:889 Not First:0 Not Last:0 |
---|
121 | Giant:0 Non-octet:0 |
---|
122 | Bad CRC:0 Overrun:0 Collision:0 |
---|
123 | Tx Interrupts:867 Deferred:0 Late Collision:0 |
---|
124 | Retransmit Limit:0 Underrun:0 Misaligned:0 |
---|
125 | |
---|
126 | The following is an example of using the ``netstats`` command to print the |
---|
127 | print IP statistics: |
---|
128 | |
---|
129 | .. code-block:: shell |
---|
130 | |
---|
131 | [/] $ netstats -p |
---|
132 | ************ IP Statistics ************ |
---|
133 | total packets received 894 |
---|
134 | packets rcvd for unreachable dest 13 |
---|
135 | datagrams delivered to upper level 881 |
---|
136 | total ip packets generated here 871 |
---|
137 | |
---|
138 | The following is an example of using the ``netstats`` command to print the |
---|
139 | ICMP statistics: |
---|
140 | |
---|
141 | .. code-block:: shell |
---|
142 | |
---|
143 | [/] $ netstats -c |
---|
144 | ************ ICMP Statistics ************ |
---|
145 | Type 0 sent 843 |
---|
146 | number of responses 843 |
---|
147 | Type 8 received 843 |
---|
148 | |
---|
149 | The following is an example of using the ``netstats`` command to print the |
---|
150 | UDP statistics: |
---|
151 | |
---|
152 | .. code-block:: shell |
---|
153 | |
---|
154 | [/] $ netstats -u |
---|
155 | ************ UDP Statistics ************ |
---|
156 | |
---|
157 | The following is an example of using the ``netstats`` command to print the |
---|
158 | TCP statistics: |
---|
159 | |
---|
160 | .. code-block:: shell |
---|
161 | |
---|
162 | [/] $ netstats -t |
---|
163 | ************ TCP Statistics ************ |
---|
164 | connections accepted 1 |
---|
165 | connections established 1 |
---|
166 | segs where we tried to get rtt 34 |
---|
167 | times we succeeded 35 |
---|
168 | delayed acks sent 2 |
---|
169 | total packets sent 37 |
---|
170 | data packets sent 35 |
---|
171 | data bytes sent 2618 |
---|
172 | ack-only packets sent 2 |
---|
173 | total packets received 47 |
---|
174 | packets received in sequence 12 |
---|
175 | bytes received in sequence 307 |
---|
176 | rcvd ack packets 35 |
---|
177 | bytes acked by rcvd acks 2590 |
---|
178 | times hdr predict ok for acks 27 |
---|
179 | times hdr predict ok for data pkts 10 |
---|
180 | |
---|
181 | .. index:: CONFIGURE_SHELL_NO_COMMAND_NETSTATS |
---|
182 | .. index:: CONFIGURE_SHELL_COMMAND_NETSTATS |
---|
183 | |
---|
184 | CONFIGURATION: |
---|
185 | This command is included in the default shell command set. When building a |
---|
186 | custom command set, define ``CONFIGURE_SHELL_COMMAND_NETSTATS`` to have |
---|
187 | this command included. |
---|
188 | |
---|
189 | This command can be excluded from the shell command set by defining |
---|
190 | ``CONFIGURE_SHELL_NO_COMMAND_NETSTATS`` when all shell commands have been |
---|
191 | configured. |
---|
192 | |
---|
193 | .. index:: rtems_shell_rtems_main_netstats |
---|
194 | |
---|
195 | PROGRAMMING INFORMATION: |
---|
196 | The ``netstats`` is implemented by a C language function which has the |
---|
197 | following prototype: |
---|
198 | |
---|
199 | .. code-block:: c |
---|
200 | |
---|
201 | int rtems_shell_rtems_main_netstats( |
---|
202 | int argc, |
---|
203 | char **argv |
---|
204 | ); |
---|
205 | |
---|
206 | The configuration structure for the ``netstats`` has the following prototype: |
---|
207 | |
---|
208 | .. code-block:: c |
---|
209 | |
---|
210 | extern rtems_shell_cmd_t rtems_shell_NETSTATS_Command; |
---|
211 | |
---|
212 | .. raw:: latex |
---|
213 | |
---|
214 | \clearpage |
---|
215 | |
---|
216 | .. _ifconfig: |
---|
217 | |
---|
218 | ifconfig - configure a network interface |
---|
219 | ---------------------------------------- |
---|
220 | .. index:: ifconfig |
---|
221 | |
---|
222 | SYNOPSYS: |
---|
223 | .. code-block:: shell |
---|
224 | |
---|
225 | ifconfig |
---|
226 | ifconfig interface |
---|
227 | ifconfig interface \[up|down] |
---|
228 | ifconfig interface \[netmask|pointtopoint|broadcast] IP |
---|
229 | |
---|
230 | DESCRIPTION: |
---|
231 | This command may be used to display information about the network |
---|
232 | interfaces in the system or configure them. |
---|
233 | |
---|
234 | EXIT STATUS: |
---|
235 | This command returns 0 on success and non-zero if an error is encountered. |
---|
236 | |
---|
237 | NOTES: |
---|
238 | Just like its counterpart on GNU/Linux and BSD systems, this command is |
---|
239 | complicated. More example usages would be a welcome submission. |
---|
240 | |
---|
241 | EXAMPLES: |
---|
242 | The following is an example of how to use ``ifconfig``: |
---|
243 | |
---|
244 | .. code-block:: shell |
---|
245 | |
---|
246 | ************ INTERFACE STATISTICS ************ |
---|
247 | ***** eth1 ***** |
---|
248 | Ethernet Address: 00:04:9F:00:5B:21 |
---|
249 | Address:192.168.1.244 Broadcast Address:192.168.1.255 Net mask:255.255.255.0 |
---|
250 | Flags: Up Broadcast Running Active Multicast |
---|
251 | Send queue limit:50 length:1 Dropped:0 |
---|
252 | Rx Interrupts:5391 Not First:0 Not Last:0 |
---|
253 | Giant:0 Non-octet:0 |
---|
254 | Bad CRC:0 Overrun:0 Collision:0 |
---|
255 | Tx Interrupts:5256 Deferred:0 Late Collision:0 |
---|
256 | Retransmit Limit:0 Underrun:0 Misaligned:0 |
---|
257 | |
---|
258 | .. index:: CONFIGURE_SHELL_NO_COMMAND_IFCONFIG |
---|
259 | .. index:: CONFIGURE_SHELL_COMMAND_IFCONFIG |
---|
260 | |
---|
261 | CONFIGURATION: |
---|
262 | This command is included in the default shell command set. When building a |
---|
263 | custom command set, define ``CONFIGURE_SHELL_COMMAND_IFCONFIG`` to have |
---|
264 | this command included. |
---|
265 | |
---|
266 | This command can be excluded from the shell command set by defining |
---|
267 | ``CONFIGURE_SHELL_NO_COMMAND_IFCONFIG`` when all shell commands have been |
---|
268 | configured. |
---|
269 | |
---|
270 | .. index:: rtems_shell_rtems_main_ifconfig |
---|
271 | |
---|
272 | PROGRAMMING INFORMATION: |
---|
273 | The ``ifconfig`` is implemented by a C language function which has the |
---|
274 | following prototype: |
---|
275 | |
---|
276 | .. code-block:: c |
---|
277 | |
---|
278 | int rtems_shell_rtems_main_ifconfig( |
---|
279 | int argc, |
---|
280 | char **argv |
---|
281 | ); |
---|
282 | |
---|
283 | The configuration structure for the ``ifconfig`` has the following |
---|
284 | prototype: |
---|
285 | |
---|
286 | .. code-block:: c |
---|
287 | |
---|
288 | extern rtems_shell_cmd_t rtems_shell_IFCONFIG_Command; |
---|
289 | |
---|
290 | .. raw:: latex |
---|
291 | |
---|
292 | \clearpage |
---|
293 | |
---|
294 | .. _route: |
---|
295 | |
---|
296 | route - show or manipulate the ip routing table |
---|
297 | ----------------------------------------------- |
---|
298 | .. index:: route |
---|
299 | |
---|
300 | SYNOPSYS: |
---|
301 | .. code-block:: shell |
---|
302 | |
---|
303 | route [subcommand] [args] |
---|
304 | |
---|
305 | DESCRIPTION: |
---|
306 | This command is used to display and manipulate the routing table. When |
---|
307 | invoked with no arguments, the current routing information is displayed. |
---|
308 | When invoked with the subcommands ``add`` or ``del``, then additional |
---|
309 | arguments must be provided to describe the route. |
---|
310 | |
---|
311 | Command templates include the following: |
---|
312 | |
---|
313 | .. code-block:: shell |
---|
314 | |
---|
315 | route [add|del] -net IP_ADDRESS gw GATEWAY_ADDRESS [netmask MASK] |
---|
316 | route [add|del] -host IP_ADDRESS gw GATEWAY_ADDRES [netmask MASK] |
---|
317 | |
---|
318 | When not provided the netmask defaults to ``255.255.255.0`` |
---|
319 | |
---|
320 | EXIT STATUS: |
---|
321 | This command returns 0 on success and non-zero if an error is encountered. |
---|
322 | |
---|
323 | NOTES: |
---|
324 | Just like its counterpart on GNU/Linux and BSD systems, this command is |
---|
325 | complicated. More example usages would be a welcome submission. |
---|
326 | |
---|
327 | EXAMPLES: |
---|
328 | The following is an example of how to use ``route`` to display, add, and |
---|
329 | delete a new route: |
---|
330 | |
---|
331 | .. code-block:: shell |
---|
332 | |
---|
333 | [/] $ route |
---|
334 | Destination Gateway/Mask/Hw Flags Refs Use Expire Interface |
---|
335 | default 192.168.1.14 UGS 0 0 0 eth1 |
---|
336 | 192.168.1.0 255.255.255.0 U 0 0 1 eth1 |
---|
337 | 192.168.1.14 00:A0:C8:1C:EE:28 UHL 1 0 1444 eth1 |
---|
338 | 192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 10844 1202 eth1 |
---|
339 | 192.168.1.151 00:1C:23:B2:0F:BB UHL 2 37 1399 eth1 |
---|
340 | [/] $ route add -net 192.168.3.0 gw 192.168.1.14 |
---|
341 | [/] $ route |
---|
342 | Destination Gateway/Mask/Hw Flags Refs Use Expire Interface |
---|
343 | default 192.168.1.14 UGS 0 0 0 eth1 |
---|
344 | 192.168.1.0 255.255.255.0 U 0 0 1 eth1 |
---|
345 | 192.168.1.14 00:A0:C8:1C:EE:28 UHL 2 0 1498 eth1 |
---|
346 | 192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 14937 1202 eth1 |
---|
347 | 192.168.1.151 00:1C:23:B2:0F:BB UHL 2 96 1399 eth1 |
---|
348 | 192.168.3.0 192.168.1.14 UGS 0 0 0 eth1 |
---|
349 | [/] $ route del -net 192.168.3.0 gw 192.168.1.14 |
---|
350 | [/] $ route |
---|
351 | Destination Gateway/Mask/Hw Flags Refs Use Expire Interface |
---|
352 | default 192.168.1.14 UGS 0 0 0 eth1 |
---|
353 | 192.168.1.0 255.255.255.0 U 0 0 1 eth1 |
---|
354 | 192.168.1.14 00:A0:C8:1C:EE:28 UHL 1 0 1498 eth1 |
---|
355 | 192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 15945 1202 eth1 |
---|
356 | 192.168.1.151 00:1C:23:B2:0F:BB UHL 2 117 1399 eth1 |
---|
357 | |
---|
358 | .. index:: CONFIGURE_SHELL_NO_COMMAND_ROUTE |
---|
359 | .. index:: CONFIGURE_SHELL_COMMAND_ROUTE |
---|
360 | |
---|
361 | CONFIGURATION: |
---|
362 | This command is included in the default shell command set. When building a |
---|
363 | custom command set, define ``CONFIGURE_SHELL_COMMAND_ROUTE`` to have this |
---|
364 | command included. |
---|
365 | |
---|
366 | This command can be excluded from the shell command set by defining |
---|
367 | ``CONFIGURE_SHELL_NO_COMMAND_ROUTE`` when all shell commands have been |
---|
368 | configured. |
---|
369 | |
---|
370 | .. index:: rtems_shell_rtems_main_route |
---|
371 | |
---|
372 | PROGRAMMING INFORMATION: |
---|
373 | The ``route`` is implemented by a C language function which has the |
---|
374 | following prototype: |
---|
375 | |
---|
376 | .. code-block:: c |
---|
377 | |
---|
378 | int rtems_shell_rtems_main_route( |
---|
379 | int argc, |
---|
380 | char **argv |
---|
381 | ); |
---|
382 | |
---|
383 | The configuration structure for the ``route`` has the following prototype: |
---|
384 | |
---|
385 | .. code-block:: c |
---|
386 | |
---|
387 | extern rtems_shell_cmd_t rtems_shell_ROUTE_Command; |
---|
388 | |
---|
389 | .. raw:: latex |
---|
390 | |
---|
391 | \clearpage |
---|
392 | |
---|
393 | .. _ping: |
---|
394 | |
---|
395 | ping - ping a host or IP address |
---|
396 | -------------------------------- |
---|
397 | .. index:: ping |
---|
398 | |
---|
399 | SYNOPSYS: |
---|
400 | .. code-block:: shell |
---|
401 | |
---|
402 | ping [-AaDdfnoQqRrv] [-c count] [-G sweepmaxsize] [-g sweepminsize] |
---|
403 | [-h sweepincrsize] [-i wait] [-l preload] [-M mask | time] [-m ttl] |
---|
404 | [-p pattern] [-S src_addr] [-s packetsize] [-t timeout] |
---|
405 | [-W waittime] [-z tos] host |
---|
406 | ping [-AaDdfLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload] |
---|
407 | [-M mask | time] [-m ttl] [-p pattern] [-S src_addr] |
---|
408 | [-s packetsize] [-T ttl] [-t timeout] [-W waittime] |
---|
409 | [-z tos] mcast-group |
---|
410 | |
---|
411 | DESCRIPTION: |
---|
412 | The ping utility uses the ICMP protocol's mandatory ECHO_REQUEST datagram |
---|
413 | to elicit an ICMP ECHO_RESPONSE from a host or gateway. ECHO_REQUEST |
---|
414 | datagrams ("pings") have an IP and ICMP header, followed by a "struct |
---|
415 | timeval" and then an arbitrary number of "pad" bytes used to fill out the |
---|
416 | packet. The options are as follows: |
---|
417 | |
---|
418 | *-A* |
---|
419 | Audible. Output a bell (ASCII 0x07) character when no packet is |
---|
420 | received before the next packet is transmitted. To cater for |
---|
421 | round-trip times that are longer than the interval between |
---|
422 | transmissions, further missing packets cause a bell only if the maximum |
---|
423 | number of unreceived packets has increased. |
---|
424 | |
---|
425 | *-a* |
---|
426 | Audible. Include a bell (ASCII 0x07) character in the output when any |
---|
427 | packet is received. This option is ignored if other format options are |
---|
428 | present. |
---|
429 | |
---|
430 | *-c count* |
---|
431 | Stop after sending (and receiving) count ECHO_RESPONSE packets. If |
---|
432 | this option is not specified, ping will operate until interrupted. If |
---|
433 | this option is specified in conjunction with ping sweeps, each sweep |
---|
434 | will consist of count packets. |
---|
435 | |
---|
436 | *-D* |
---|
437 | Set the Don't Fragment bit. |
---|
438 | |
---|
439 | *-d* |
---|
440 | Set the SO_DEBUG option on the socket being used. |
---|
441 | |
---|
442 | *-f* |
---|
443 | Flood ping. Outputs packets as fast as they come back or one hundred |
---|
444 | times per second, whichever is more. For every ECHO_REQUEST sent a |
---|
445 | period "." is printed, while for every ECHO_REPLY received a backspace |
---|
446 | is printed. This provides a rapid display of how many packets are |
---|
447 | being dropped. Only the super-user may use this option. This can be |
---|
448 | very hard on a network and should be used with caution. |
---|
449 | |
---|
450 | *-G sweepmaxsize* |
---|
451 | Specify the maximum size of ICMP payload when sending sweeping pings. |
---|
452 | This option is required for ping sweeps. |
---|
453 | |
---|
454 | *-g sweepminsize* |
---|
455 | Specify the size of ICMP payload to start with when sending sweeping |
---|
456 | pings. The default value is 0. |
---|
457 | |
---|
458 | *-h sweepincrsize* |
---|
459 | Specify the number of bytes to increment the size of ICMP payload after |
---|
460 | each sweep when sending sweeping pings. The default value is 1. |
---|
461 | |
---|
462 | *-I iface* |
---|
463 | Source multicast packets with the given interface address. This flag |
---|
464 | only applies if the ping destination is a multicast address. |
---|
465 | |
---|
466 | *-i wait* |
---|
467 | Wait wait seconds between sending each packet. The default is to wait |
---|
468 | for one second between each packet. The wait time may be fractional, |
---|
469 | but only the super-user may specify values less than 1 second. This |
---|
470 | option is incompatible with the -f option. |
---|
471 | |
---|
472 | *-L* |
---|
473 | Suppress loopback of multicast packets. This flag only applies if the |
---|
474 | ping destination is a multicast address. |
---|
475 | |
---|
476 | *-l preload* |
---|
477 | If preload is specified, ping sends that many packets as fast as |
---|
478 | possible before falling into its normal mode of behavior. Only the |
---|
479 | super-user may use this option. |
---|
480 | |
---|
481 | *-M mask | time* |
---|
482 | Use ICMP_MASKREQ or ICMP_TSTAMP instead of ICMP_ECHO. For mask, print |
---|
483 | the netmask of the remote machine. Set the net.inet.icmp.maskrepl MIB |
---|
484 | variable to enable ICMP_MASKREPLY. For time, print the origination, |
---|
485 | reception and transmission timestamps. |
---|
486 | |
---|
487 | *-m ttl* |
---|
488 | Set the IP Time To Live for outgoing packets. If not specified, the |
---|
489 | kernel uses the value of the net.inet.ip.ttl MIB variable. |
---|
490 | |
---|
491 | *-n* |
---|
492 | Numeric output only. No attempt will be made to lookup symbolic names |
---|
493 | for host addresses. |
---|
494 | |
---|
495 | *-o* |
---|
496 | Exit successfully after receiving one reply packet. |
---|
497 | |
---|
498 | *-p pattern* |
---|
499 | You may specify up to 16 "pad" bytes to fill out the packet you send. |
---|
500 | This is useful for diagnosing data-dependent problems in a network. |
---|
501 | For example, "-p ff" will cause the sent packet to be filled with all |
---|
502 | ones. |
---|
503 | |
---|
504 | *-Q* |
---|
505 | Somewhat quiet output. Don't display ICMP error messages that are in |
---|
506 | response to our query messages. Originally, the -v flag was required |
---|
507 | to display such errors, but -v displays all ICMP error messages. On a |
---|
508 | busy machine, this output can be overbear- ing. Without the -Q flag, |
---|
509 | ping prints out any ICMP error mes- sages caused by its own |
---|
510 | ECHO_REQUEST messages. |
---|
511 | |
---|
512 | *-q* |
---|
513 | Quiet output. Nothing is displayed except the summary lines at startup |
---|
514 | time and when finished. |
---|
515 | |
---|
516 | *-R* |
---|
517 | Record route. Includes the RECORD_ROUTE option in the ECHO_REQUEST |
---|
518 | packet and displays the route buffer on returned packets. Note that |
---|
519 | the IP header is only large enough for nine such routes; the |
---|
520 | traceroute(8) command is usually better at determining the route |
---|
521 | packets take to a particular destination. If more routes come back |
---|
522 | than should, such as due to an illegal spoofed packet, ping will print |
---|
523 | the route list and then truncate it at the correct spot. Many hosts |
---|
524 | ignore or discard the RECORD_ROUTE option. |
---|
525 | |
---|
526 | *-r* |
---|
527 | Bypass the normal routing tables and send directly to a host on an |
---|
528 | attached network. If the host is not on a directly-attached network, |
---|
529 | an error is returned. This option can be used to ping a local host |
---|
530 | through an interface that has no route through it (e.g., after the |
---|
531 | interface was dropped). |
---|
532 | |
---|
533 | *-S src_addr* |
---|
534 | Use the following IP address as the source address in outgoing packets. |
---|
535 | On hosts with more than one IP address, this option can be used to |
---|
536 | force the source address to be something other than the IP address of |
---|
537 | the interface the probe packet is sent on. If the IP address is not |
---|
538 | one of this machine's interface addresses, an error is returned and |
---|
539 | nothing is sent. |
---|
540 | |
---|
541 | *-s packetsize* |
---|
542 | Specify the number of data bytes to be sent. The default is 56, which |
---|
543 | translates into 64 ICMP data bytes when combined with the 8 bytes of |
---|
544 | ICMP header data. Only the super-user may specify val- ues more than |
---|
545 | default. This option cannot be used with ping sweeps. |
---|
546 | |
---|
547 | *-T ttl* |
---|
548 | Set the IP Time To Live for multicasted packets. This flag only |
---|
549 | applies if the ping destination is a multicast address. |
---|
550 | |
---|
551 | *-t timeout* |
---|
552 | Specify a timeout, in seconds, before ping exits regardless of how many |
---|
553 | packets have been received. |
---|
554 | |
---|
555 | *-v* |
---|
556 | Verbose output. ICMP packets other than ECHO_RESPONSE that are |
---|
557 | received are listed. |
---|
558 | |
---|
559 | *-W waittime* |
---|
560 | Time in milliseconds to wait for a reply for each packet sent. If a |
---|
561 | reply arrives later, the packet is not printed as replied, but |
---|
562 | considered as replied when calculating statistics. |
---|
563 | |
---|
564 | *-z tos* |
---|
565 | Use the specified type of service. |
---|
566 | |
---|
567 | EXIT STATUS: |
---|
568 | The ping utility exits with one of the following values: |
---|
569 | |
---|
570 | 0 At least one response was heard from the specified host. |
---|
571 | |
---|
572 | 2 The transmission was successful but no responses were |
---|
573 | received. |
---|
574 | |
---|
575 | any other value an error occurred. These values are defined in |
---|
576 | <sysexits.h>. |
---|
577 | |
---|
578 | NOTES: |
---|
579 | When using ping for fault isolation, it should first be run on the local |
---|
580 | host, to verify that the local network interface is up and running. Then, |
---|
581 | hosts and gateways further and further away should be "pinged". Round-trip |
---|
582 | times and packet loss statistics are computed. If duplicate packets are |
---|
583 | received, they are not included in the packet loss calculation, although |
---|
584 | the round trip time of these packets is used in calculating the round-trip |
---|
585 | time statistics. When the specified number of packets have been sent a |
---|
586 | brief summary is displayed, showing the number of packets sent and |
---|
587 | received, and the minimum, mean, maximum, and standard deviation of the |
---|
588 | round-trip times. |
---|
589 | |
---|
590 | This program is intended for use in network testing, measurement and |
---|
591 | management. Because of the load it can impose on the network, it is unwise |
---|
592 | to use ping during normal operations or from automated scripts. |
---|
593 | |
---|
594 | This command can fail if more than the FD_SET size number of file |
---|
595 | descriptors are open. |
---|
596 | |
---|
597 | EXAMPLES: |
---|
598 | The following is an example of how to use ``oing`` to ping: |
---|
599 | |
---|
600 | .. code-block:: shell |
---|
601 | |
---|
602 | [/] # ping 10.10.10.1 |
---|
603 | PING 10.10.10.1 (10.10.10.1): 56 data bytes |
---|
604 | 64 bytes from 10.10.10.1: icmp_seq=0 ttl=63 time=0.356 ms |
---|
605 | 64 bytes from 10.10.10.1: icmp_seq=1 ttl=63 time=0.229 ms |
---|
606 | 64 bytes from 10.10.10.1: icmp_seq=2 ttl=63 time=0.233 ms |
---|
607 | 64 bytes from 10.10.10.1: icmp_seq=3 ttl=63 time=0.235 ms |
---|
608 | 64 bytes from 10.10.10.1: icmp_seq=4 ttl=63 time=0.229 ms |
---|
609 | --- 10.10.10.1 ping statistics --- |
---|
610 | 5 packets transmitted, 5 packets received, 0.0% packet loss |
---|
611 | round-trip min/avg/max/stddev = 0.229/0.256/0.356/0.050 ms |
---|
612 | [/] # ping -f -c 10000 10.10.10.1 |
---|
613 | PING 10.10.10.1 (10.10.10.1): 56 data bytes |
---|
614 | . |
---|
615 | --- 10.10.10.1 ping statistics --- |
---|
616 | 10000 packets transmitted, 10000 packets received, 0.0% packet loss |
---|
617 | round-trip min/avg/max/stddev = 0.154/0.225/0.533/0.027 ms |
---|
618 | |
---|
619 | .. index:: CONFIGURE_SHELL_NO_COMMAND_PING |
---|
620 | .. index:: CONFIGURE_SHELL_COMMAND_PING |
---|
621 | |
---|
622 | CONFIGURATION: |
---|
623 | This command is included in the default shell command set. When building a |
---|
624 | custom command set, define ``CONFIGURE_SHELL_COMMAND_PING`` to have this |
---|
625 | command included. |
---|
626 | |
---|
627 | This command can be excluded from the shell command set by defining |
---|
628 | ``CONFIGURE_SHELL_NO_COMMAND_PING`` when all shell commands have been |
---|
629 | configured. |
---|
630 | |
---|
631 | .. index:: rtems_shell_rtems_main_ping |
---|
632 | |
---|
633 | PROGRAMMING INFORMATION: |
---|
634 | The ``ping`` is implemented by a C language function which has the following |
---|
635 | prototype: |
---|
636 | |
---|
637 | .. code-block:: c |
---|
638 | |
---|
639 | int rtems_shell_rtems_main_ping( |
---|
640 | int argc, |
---|
641 | char **argv |
---|
642 | ); |
---|
643 | |
---|
644 | The configuration structure for the ``ping`` has the following prototype: |
---|
645 | |
---|
646 | .. code-block:: c |
---|
647 | |
---|
648 | extern rtems_shell_cmd_t rtems_shell_PING_Command; |
---|