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