Checkign in new iproute2
[iproute2.git] / man / man8 / ip.8
1 .TH IP 8 "17 January 2002" "iproute2" "Linux"
2 .SH NAME
3 ip \- show / manipulate routing, devices, policy routing and tunnels
4 .SH SYNOPSIS
5
6 .ad l
7 .in +8
8 .ti -8
9 .B ip
10 .RI "[ " OPTIONS " ] " OBJECT " { " COMMAND " | "
11 .BR help " }"
12 .sp
13
14 .ti -8
15 .IR OBJECT " := { "
16 .BR link " | " addr " | " addrlabel " | " route " | " rule " | " neigh " | "\
17  tunnel " | " maddr " | "  mroute " | " monitor " }"
18 .sp
19
20 .ti -8
21 .IR OPTIONS " := { "
22 \fB\-V\fR[\fIersion\fR] |
23 \fB\-s\fR[\fItatistics\fR] |
24 \fB\-r\fR[\fIesolve\fR] |
25 \fB\-f\fR[\fIamily\fR] {
26 .BR inet " | " inet6 " | " ipx " | " dnet " | " link " } | "
27 \fB\-o\fR[\fIneline\fR] }
28
29 .ti -8
30 .BI "ip link set " DEVICE
31 .RB "{ " up " | " down " | " arp " { " on " | " off " } |"
32 .br
33 .BR promisc " { " on " | " off " } |"
34 .br
35 .BR allmulticast " { " on " | " off " } |"
36 .br
37 .BR dynamic " { " on " | " off " } |"
38 .br
39 .BR multicast " { " on " | " off " } |"
40 .br
41 .B  txqueuelen
42 .IR PACKETS " |"
43 .br
44 .B  name
45 .IR NEWNAME " |"
46 .br
47 .B  address
48 .IR LLADDR " |"
49 .B  broadcast
50 .IR LLADDR " |"
51 .br
52 .B  mtu
53 .IR MTU " |"
54 .br
55 .B  netns
56 .IR PID " }"
57
58 .ti -8
59 .B ip link show
60 .RI "[ " DEVICE " ]"
61
62 .ti -8
63 .BR "ip addr" " { " add " | " del " } "
64 .IB IFADDR " dev " STRING
65
66 .ti -8
67 .BR "ip addr" " { " show " | " flush " } [ " dev
68 .IR STRING " ] [ "
69 .B  scope
70 .IR SCOPE-ID " ] [ "
71 .B  to
72 .IR PREFIX " ] [ " FLAG-LIST " ] [ "
73 .B  label
74 .IR PATTERN " ]"
75
76 .ti -8
77 .IR IFADDR " := " PREFIX " | " ADDR
78 .B  peer
79 .IR PREFIX " [ "
80 .B  broadcast
81 .IR ADDR " ] [ "
82 .B  anycast
83 .IR ADDR " ] [ "
84 .B  label
85 .IR STRING " ] [ "
86 .B  scope
87 .IR SCOPE-ID " ]"
88
89 .ti -8
90 .IR SCOPE-ID " := "
91 .RB "[ " host " | " link " | " global " | "
92 .IR NUMBER " ]"
93
94 .ti -8
95 .IR FLAG-LIST " := [ "  FLAG-LIST " ] " FLAG
96
97 .ti -8
98 .IR FLAG " := "
99 .RB "[ " permanent " | " dynamic " | " secondary " | " primary " | "\
100 tentative " | " deprecated " ]"
101
102 .ti -8
103 .BR "ip addrlabel" " { " add " | " del " } " prefix
104 .BR PREFIX " [ "
105 .B dev
106 .IR DEV " ] [ "
107 .B label
108 .IR NUMBER " ]"
109
110 .ti -8
111 .BR "ip addrlabel" " { " list " | " flush " }"
112
113 .ti -8
114 .BR "ip route" " { "
115 .BR list " | " flush " } "
116 .I  SELECTOR
117
118 .ti -8
119 .B  ip route get
120 .IR ADDRESS " [ "
121 .BI from " ADDRESS " iif " STRING"
122 .RB " ] [ " oif
123 .IR STRING " ] [ "
124 .B  tos
125 .IR TOS " ]"
126
127 .ti -8
128 .BR "ip route" " { " add " | " del " | " change " | " append " | "\
129 replace " | " monitor " } "
130 .I  ROUTE
131
132 .ti -8
133 .IR SELECTOR " := "
134 .RB "[ " root
135 .IR PREFIX " ] [ "
136 .B  match
137 .IR PREFIX " ] [ "
138 .B  exact
139 .IR PREFIX " ] [ "
140 .B  table
141 .IR TABLE_ID " ] [ "
142 .B  proto
143 .IR RTPROTO " ] [ "
144 .B  type
145 .IR TYPE " ] [ "
146 .B  scope
147 .IR SCOPE " ]"
148
149 .ti -8
150 .IR ROUTE " := " NODE_SPEC " [ " INFO_SPEC " ]"
151
152 .ti -8
153 .IR NODE_SPEC " := [ " TYPE " ] " PREFIX " ["
154 .B  tos
155 .IR TOS " ] [ "
156 .B  table
157 .IR TABLE_ID " ] [ "
158 .B  proto
159 .IR RTPROTO " ] [ "
160 .B  scope
161 .IR SCOPE " ] [ "
162 .B  metric
163 .IR METRIC " ]"
164
165 .ti -8
166 .IR INFO_SPEC " := " "NH OPTIONS FLAGS" " ["
167 .B  nexthop
168 .IR NH " ] ..."
169
170 .ti -8
171 .IR NH " := [ "
172 .B  via
173 .IR ADDRESS " ] [ "
174 .B  dev
175 .IR STRING " ] [ "
176 .B  weight
177 .IR NUMBER " ] " NHFLAGS
178
179 .ti -8
180 .IR OPTIONS " := " FLAGS " [ "
181 .B  mtu
182 .IR NUMBER " ] [ "
183 .B  advmss
184 .IR NUMBER " ] [ "
185 .B  rtt
186 .IR TIME " ] [ "
187 .B  rttvar
188 .IR TIME " ] [ "
189 .B  window
190 .IR NUMBER " ] [ "
191 .B  cwnd
192 .IR NUMBER " ] [ "
193 .B  ssthresh
194 .IR REALM " ] [ "
195 .B  realms
196 .IR REALM " ] [ "
197 .B  rto_min
198 .IR TIME " ]"
199
200 .ti -8
201 .IR TYPE " := [ "
202 .BR unicast " | " local " | " broadcast " | " multicast " | "\
203 throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]"
204
205 .ti -8
206 .IR TABLE_ID " := [ "
207 .BR local "| " main " | " default " | " all " |"
208 .IR NUMBER " ]"
209
210 .ti -8
211 .IR SCOPE " := [ "
212 .BR host " | " link " | " global " |"
213 .IR NUMBER " ]"
214
215 .ti -8
216 .IR FLAGS " := [ "
217 .BR equalize " ]"
218
219 .ti -8
220 .IR NHFLAGS " := [ "
221 .BR onlink " | " pervasive " ]"
222
223 .ti -8
224 .IR RTPROTO " := [ "
225 .BR kernel " | " boot " | " static " |"
226 .IR NUMBER " ]"
227
228 .ti -8
229 .B  ip rule
230 .RB " [ " list " | " add " | " del " | " flush " ]"
231 .I  SELECTOR ACTION
232
233 .ti -8
234 .IR SELECTOR " := [ "
235 .B  from
236 .IR PREFIX " ] [ "
237 .B  to
238 .IR PREFIX " ] [ "
239 .B  tos
240 .IR TOS " ] [ "
241 .B  fwmark
242 .IR FWMARK[/MASK] " ] [ "
243 .B  dev
244 .IR STRING " ] [ "
245 .B  pref
246 .IR NUMBER " ]"
247
248 .ti -8
249 .IR ACTION " := [ "
250 .B  table
251 .IR TABLE_ID " ] [ "
252 .B  nat
253 .IR ADDRESS " ] [ "
254 .BR prohibit " | " reject " | " unreachable " ] [ " realms
255 .RI "[" SRCREALM "/]" DSTREALM " ]"
256
257 .ti -8
258 .IR TABLE_ID " := [ "
259 .BR local " | " main " | " default " |"
260 .IR NUMBER " ]"
261
262 .ti -8
263 .BR "ip neigh" " { " add " | " del " | " change " | " replace " } { "
264 .IR ADDR " [ "
265 .B  lladdr
266 .IR LLADDR " ] [ "
267 .BR nud " { " permanent " | " noarp " | " stale " | " reachable " } ] | " proxy
268 .IR ADDR " } [ "
269 .B  dev
270 .IR DEV " ]"
271
272 .ti -8
273 .BR "ip neigh" " { " show " | " flush " } [ " to
274 .IR PREFIX " ] [ "
275 .B  dev
276 .IR DEV " ] [ "
277 .B  nud
278 .IR STATE " ]"
279
280 .ti -8
281 .BR "ip tunnel" " { " add " | " change " | " del " | " show " }"
282 .RI "[ " NAME " ]"
283 .br
284 .RB "[ " mode
285 .IR MODE " ] [ "
286 .B remote
287 .IR ADDR " ] [ "
288 .B  local
289 .IR ADDR " ]"
290 .br
291 .RB "[ [" i "|" o "]" seq " ] [ [" i "|" o "]" key
292 .IR KEY " ] [ "
293 .RB "[" i "|" o "]" csum " ] ]"
294 .br
295 .RB "[ " encaplimit
296 .IR ELIM " ]"
297 .RB "[ " ttl
298 .IR TTL " ]"
299 .br
300 .RB "[ " tos
301 .IR TOS " ] [ "
302 .B flowlabel
303 .IR FLOWLABEL " ]"
304 .br
305 .RB "[ [" no "]" pmtudisc " ]"
306 .RB "[ " dev
307 .IR PHYS_DEV " ]"
308 .RB "[ " "dscp inherit" " ]"
309
310 .ti -8
311 .IR MODE " := "
312 .RB " { " ipip " | " gre " | " sit " | " isatap " | " ip6ip6 " | " ipip6 " | " any " }"
313
314 .ti -8
315 .IR ADDR " := { " IP_ADDRESS " |"
316 .BR any " }"
317
318 .ti -8
319 .IR TOS " := { " NUMBER " |"
320 .BR inherit " }"
321
322 .ti -8
323 .IR ELIM " := {
324 .BR none " | "
325 .IR 0 ".." 255 " }"
326
327 .ti -8
328 .ti -8
329 .IR TTL " := { " 1 ".." 255 " | "
330 .BR inherit " }"
331
332 .ti -8
333 .IR KEY " := { " DOTTED_QUAD " | " NUMBER " }"
334
335 .ti -8
336 .IR TIME " := " NUMBER "[s|ms|us|ns|j]"
337
338 .ti -8
339 .BR "ip maddr" " [ " add " | " del " ]"
340 .IB MULTIADDR " dev " STRING
341
342 .ti -8
343 .BR "ip maddr show" " [ " dev
344 .IR STRING " ]"
345
346 .ti -8
347 .BR "ip mroute show" " ["
348 .IR PREFIX " ] [ "
349 .B  from
350 .IR PREFIX " ] [ "
351 .B  iif
352 .IR DEVICE " ]"
353
354 .ti -8
355 .BR "ip monitor" " [ " all " |"
356 .IR LISTofOBJECTS " ]"
357
358 .ti -8
359 .BR "ip xfrm"
360 .IR XFRM_OBJECT " { " COMMAND " }"
361
362 .ti -8
363 .IR XFRM_OBJECT " := { " state " | " policy " | " monitor " } "
364
365 .ti -8
366 .BR "ip xfrm state " { " add " | " update " } "
367 .IR ID " [ "
368 .IR XFRM_OPT " ] "
369 .RB " [ " mode
370 .IR MODE " ] "
371 .br
372 .RB " [ " reqid
373 .IR REQID " ] "
374 .RB " [ " seq
375 .IR SEQ " ] "
376 .RB " [ " replay-window
377 .IR SIZE " ] "
378 .br
379 .RB " [ " flag
380 .IR FLAG-LIST " ] "
381 .RB " [ " encap
382 .IR ENCAP " ] "
383 .RB " [ " sel
384 .IR SELECTOR " ] "
385 .br
386 .RB " [ "
387 .IR LIMIT-LIST " ] "
388
389 .ti -8
390 .BR "ip xfrm state allocspi "
391 .IR ID
392 .RB " [ " mode
393 .IR MODE " ] "
394 .RB " [ " reqid
395 .IR REQID " ] "
396 .RB " [ " seq
397 .IR SEQ " ] "
398 .RB " [ " min
399 .IR SPI
400 .B max
401 .IR SPI " ] "
402
403 .ti -8
404 .BR "ip xfrm state" " { " delete " | " get " } "
405 .IR ID
406
407 .ti -8
408 .BR "ip xfrm state" " { " deleteall " | " list " } [ "
409 .IR ID " ] "
410 .RB " [ " mode
411 .IR MODE " ] "
412 .br
413 .RB " [ " reqid
414 .IR REQID " ] "
415 .RB " [ " flag
416 .IR FLAG_LIST " ] "
417
418 .ti -8
419 .BR "ip xfrm state flush" " [ " proto
420 .IR XFRM_PROTO " ] "
421
422 .ti -8
423 .BR "ip xfrm state count"
424
425 .ti -8
426 .IR ID " := "
427 .RB " [ " src
428 .IR ADDR " ] "
429 .RB " [ " dst
430 .IR ADDR " ] "
431 .RB " [ " proto
432 .IR XFRM_PROTO " ] "
433 .RB " [ " spi
434 .IR SPI " ] "
435
436 .ti -8
437 .IR XFRM_PROTO " := "
438 .RB " [ " esp " | " ah " | " comp " | " route2 " | " hao " ] "
439
440 .ti -8
441 .IR MODE " := "
442 .RB " [ " transport " | " tunnel " | " ro " | " beet " ] "
443 .B (default=transport)
444
445 .ti -8
446 .IR FLAG-LIST " := "
447 .RI " [ " FLAG-LIST " ] " FLAG
448
449 .ti -8
450 .IR FLAG " := "
451 .RB " [ " noecn " | " decap-dscp " | " wildrecv " ] "
452
453 .ti -8
454 .IR ENCAP " := " ENCAP-TYPE " " SPORT " " DPORT " " OADDR
455
456 .ti -8
457 .IR ENCAP-TYPE " := "
458 .B espinudp
459 .RB " | "
460 .B espinudp-nonike
461
462 .ti -8
463 .IR ALGO-LIST " := [ "
464 .IR ALGO-LIST " ] | [ "
465 .IR ALGO " ] "
466
467 .ti -8
468 .IR ALGO " := "
469 .IR ALGO_TYPE
470 .IR ALGO_NAME
471 .IR ALGO_KEY
472
473 .ti -8
474 .IR ALGO_TYPE " := "
475 .RB " [ " enc " | " auth " | " comp " ] "
476
477 .ti -8
478 .IR SELECTOR " := "
479 .B src
480 .IR ADDR "[/" PLEN "]"
481 .B dst
482 .IR ADDR "[/" PLEN "]"
483 .RI " [ " UPSPEC " ] "
484 .RB " [ " dev
485 .IR DEV " ] "
486
487 .ti -8
488 .IR UPSPEC " := "
489 .B proto
490 .IR PROTO " [[ "
491 .B sport
492 .IR PORT " ] "
493 .RB " [ " dport
494 .IR PORT " ] | "
495 .br
496 .RB " [ " type
497 .IR NUMBER " ] "
498 .RB " [ " code
499 .IR NUMBER " ]] "
500
501 .ti -8
502 .IR LIMIT-LIST " := [ " LIMIT-LIST " ] |"
503 .RB " [ "limit
504 .IR LIMIT " ] "
505
506 .ti -8
507 .IR LIMIT " := "
508 .RB " [ [" time-soft "|" time-hard "|" time-use-soft "|" time-use-hard "]"
509 .IR SECONDS " ] | "
510 .RB "[ ["byte-soft "|" byte-hard "]"
511 .IR SIZE " ] | "
512 .br
513 .RB " [ ["packet-soft "|" packet-hard "]"
514 .IR COUNT " ] "
515
516 .ti -8
517 .BR "ip xfrm policy" " { " add " | " update " } " " dir "
518 .IR DIR
519 .IR SELECTOR " [ "
520 .BR index
521 .IR INDEX " ] "
522 .br
523 .RB " [ " ptype
524 .IR PTYPE " ] "
525 .RB " [ " action
526 .IR ACTION " ] "
527 .RB " [ " priority
528 .IR PRIORITY " ] "
529 .br
530 .RI " [ " LIMIT-LIST " ] [ "
531 .IR TMPL-LIST " ] "
532
533 .ti -8
534 .BR "ip xfrm policy" " { " delete " | " get " } " " dir "
535 .IR DIR " [ " SELECTOR " | "
536 .BR index
537 .IR INDEX
538 .RB " ] "
539 .br
540 .RB " [ " ptype
541 .IR PTYPE " ] "
542
543 .ti -8
544 .BR "ip xfrm policy" " { " deleteall " | " list " } "
545 .RB " [ " dir
546 .IR DIR " ] [ "
547 .IR SELECTOR " ] "
548 .br
549 .RB " [ " index
550 .IR INDEX " ] "
551 .RB " [ " action
552 .IR ACTION " ] "
553 .RB " [ " priority
554 .IR PRIORITY " ] "
555
556 .ti -8
557 .B "ip xfrm policy flush"
558 .RB " [ " ptype
559 .IR PTYPE " ] "
560
561 .ti -8
562 .B "ip xfrm count"
563
564 .ti -8
565 .IR PTYPE " := "
566 .RB " [ " main " | " sub " ] "
567 .B (default=main)
568
569 .ti -8
570 .IR DIR " := "
571 .RB " [ " in " | " out " | " fwd " ] "
572
573 .ti -8
574 .IR SELECTOR " := "
575 .B src
576 .IR ADDR "[/" PLEN "]"
577 .B dst
578 .IR ADDR "[/" PLEN] " [ " UPSPEC
579 .RB " ] [ " dev
580 .IR DEV " ] "
581
582 .ti -8
583 .IR UPSPEC " := "
584 .B proto
585 .IR PROTO " [ "
586 .RB " [ " sport
587 .IR PORT " ] "
588 .RB " [ " dport
589 .IR PORT " ] | "
590 .br
591 .RB " [ " type
592 .IR NUMBER " ] "
593 .RB " [ " code
594 .IR NUMBER " ] ] "
595
596 .ti -8
597 .IR ACTION " := "
598 .RB " [ " allow " | " block " ]"
599 .B (default=allow)
600
601 .ti -8
602 .IR LIMIT-LIST " := "
603 .RB " [ "
604 .IR LIMIT-LIST " ] | "
605 .RB " [ " limit
606 .IR LIMIT " ] "
607
608 .ti -8
609 .IR LIMIT " := "
610 .RB " [ [" time-soft "|" time-hard "|" time-use-soft "|" time-use-hard "]"
611 .IR SECONDS " ] | "
612 .RB " [ [" byte-soft "|" byte-hard "]"
613 .IR SIZE " ] | "
614 .br [ "
615 .RB "[" packet-soft "|" packet-hard "]"
616 .IR NUMBER " ] "
617
618 .ti -8
619 .IR TMPL-LIST " := "
620 .B " [ "
621 .IR TMPL-LIST " ] | "
622 .RB " [ " tmpl
623 .IR TMPL " ] "
624
625 .ti -8
626 .IR TMPL " := "
627 .IR ID " [ "
628 .B mode
629 .IR MODE " ] "
630 .RB " [ " reqid
631 .IR REQID " ] "
632 .RB " [ " level
633 .IR LEVEL " ] "
634
635 .ti -8
636 .IR ID " := "
637 .RB " [ " src
638 .IR ADDR " ] "
639 .RB " [ " dst
640 .IR ADDR " ] "
641 .RB " [ " proto
642 .IR XFRM_PROTO " ] "
643 .RB " [ " spi
644 .IR SPI " ] "
645
646 .ti -8
647 .IR XFRM_PROTO " := "
648 .RB " [ " esp " | " ah " | " comp " | " route2 " | " hao " ] "
649
650 .ti -8
651 .IR MODE " := "
652 .RB " [ " transport " | " tunnel " | " beet " ] "
653 .B (default=transport)
654
655 .ti -8
656 .IR LEVEL " := "
657 .RB " [ " required " | " use " ] "
658 .B (default=required)
659
660 .ti -8
661 .BR "ip xfrm monitor" " [ " all " | "
662 .IR LISTofOBJECTS " ] "
663
664 .in -8
665 .ad b
666
667 .SH OPTIONS
668
669 .TP
670 .BR "\-V" , " -Version"
671 print the version of the
672 .B ip
673 utility and exit.
674
675 .TP
676 .BR "\-s" , " \-stats", " \-statistics"
677 output more information.  If the option
678 appears twice or more, the amount of information increases.
679 As a rule, the information is statistics or some time values.
680
681 .TP
682 .BR "\-f" , " \-family"
683 followed by protocol family identifier:
684 .BR "inet" , " inet6"
685 or
686 .B link
687 ,enforce the protocol family to use.  If the option is not present,
688 the protocol family is guessed from other arguments.  If the rest
689 of the command line does not give enough information to guess the
690 family,
691 .B ip
692 falls back to the default one, usually
693 .B inet
694 or
695 .BR "any" .
696 .B link
697 is a special family identifier meaning that no networking protocol
698 is involved.
699
700 .TP
701 .B \-4
702 shortcut for
703 .BR "-family inet" .
704
705 .TP
706 .B \-6
707 shortcut for
708 .BR "\-family inet6" .
709
710 .TP
711 .B \-0
712 shortcut for
713 .BR "\-family link" .
714
715 .TP
716 .BR "\-o" , " \-oneline"
717 output each record on a single line, replacing line feeds
718 with the
719 .B '\e\'
720 character. This is convenient when you want to count records
721 with
722 .BR wc (1)
723  or to
724 .BR grep (1)
725 the output.
726
727 .TP
728 .BR "\-r" , " \-resolve"
729 use the system's name resolver to print DNS names instead of
730 host addresses.
731
732 .SH IP - COMMAND SYNTAX
733
734 .SS
735 .I OBJECT
736
737 .TP
738 .B link
739 - network device.
740
741 .TP
742 .B address
743 - protocol (IP or IPv6) address on a device.
744
745 .TP
746 .B addrlabel
747 - label configuration for protocol address selection.
748
749 .TP
750 .B neighbour
751 - ARP or NDISC cache entry.
752
753 .TP
754 .B route
755 - routing table entry.
756
757 .TP
758 .B rule
759 - rule in routing policy database.
760
761 .TP
762 .B maddress
763 - multicast address.
764
765 .TP
766 .B mroute
767 - multicast routing cache entry.
768
769 .TP
770 .B tunnel
771 - tunnel over IP.
772
773 .TP
774 .B xfrm
775 - framework for IPsec protocol.
776
777 .PP
778 The names of all objects may be written in full or
779 abbreviated form, f.e.
780 .B address
781 is abbreviated as
782 .B addr
783 or just
784 .B a.
785
786 .SS
787 .I COMMAND
788
789 Specifies the action to perform on the object.
790 The set of possible actions depends on the object type.
791 As a rule, it is possible to
792 .BR "add" , " delete"
793 and
794 .B show
795 (or
796 .B list
797 ) objects, but some objects do not allow all of these operations
798 or have some additional commands.  The
799 .B help
800 command is available for all objects.  It prints
801 out a list of available commands and argument syntax conventions.
802 .sp
803 If no command is given, some default command is assumed.
804 Usually it is
805 .B list
806 or, if the objects of this class cannot be listed,
807 .BR "help" .
808
809 .SH ip link - network device configuration
810
811 .B link
812 is a network device and the corresponding commands
813 display and change the state of devices.
814
815 .SS ip link set - change device attributes
816
817 .TP
818 .BI dev " NAME " (default)
819 .I NAME
820 specifies network device to operate on.
821
822 .TP
823 .BR up " and " down
824 change the state of the device to
825 .B UP
826 or
827 .BR "DOWN" .
828
829 .TP
830 .BR "arp on " or " arp off"
831 change the
832 .B NOARP
833 flag on the device.
834
835 .TP
836 .BR "multicast on " or " multicast off"
837 change the
838 .B MULTICAST
839 flag on the device.
840
841 .TP
842 .BR "dynamic on " or " dynamic off"
843 change the
844 .B DYNAMIC
845 flag on the device.
846
847 .TP
848 .BI name " NAME"
849 change the name of the device.  This operation is not
850 recommended if the device is running or has some addresses
851 already configured.
852
853 .TP
854 .BI txqueuelen " NUMBER"
855 .TP
856 .BI txqlen " NUMBER"
857 change the transmit queue length of the device.
858
859 .TP
860 .BI mtu " NUMBER"
861 change the
862 .I MTU
863 of the device.
864
865 .TP
866 .BI address " LLADDRESS"
867 change the station address of the interface.
868
869 .TP
870 .BI broadcast " LLADDRESS"
871 .TP
872 .BI brd " LLADDRESS"
873 .TP
874 .BI peer " LLADDRESS"
875 change the link layer broadcast address or the peer address when
876 the interface is
877 .IR "POINTOPOINT" .
878
879 .TP
880 .BI netns " PID"
881 move the device to the network namespace associated with the process
882 .IR "PID" .
883
884 .PP
885 .B Warning:
886 If multiple parameter changes are requested,
887 .B ip
888 aborts immediately after any of the changes have failed.
889 This is the only case when
890 .B ip
891 can move the system to an unpredictable state.  The solution
892 is to avoid changing several parameters with one
893 .B ip link set
894 call.
895
896 .SS  ip link show - display device attributes
897
898 .TP
899 .BI dev " NAME " (default)
900 .I NAME
901 specifies the network device to show.
902 If this argument is omitted all devices are listed.
903
904 .TP
905 .B up
906 only display running interfaces.
907
908 .SH ip address - protocol address management.
909
910 The
911 .B address
912 is a protocol (IP or IPv6) address attached
913 to a network device.  Each device must have at least one address
914 to use the corresponding protocol.  It is possible to have several
915 different addresses attached to one device.  These addresses are not
916 discriminated, so that the term
917 .B alias
918 is not quite appropriate for them and we do not use it in this document.
919 .sp
920 The
921 .B ip addr
922 command displays addresses and their properties, adds new addresses
923 and deletes old ones.
924
925 .SS ip address add - add new protocol address.
926
927 .TP
928 .BI dev " NAME"
929 the name of the device to add the address to.
930
931 .TP
932 .BI local " ADDRESS " (default)
933 the address of the interface. The format of the address depends
934 on the protocol. It is a dotted quad for IP and a sequence of
935 hexadecimal halfwords separated by colons for IPv6.  The
936 .I ADDRESS
937 may be followed by a slash and a decimal number which encodes
938 the network prefix length.
939
940 .TP
941 .BI peer " ADDRESS"
942 the address of the remote endpoint for pointopoint interfaces.
943 Again, the
944 .I ADDRESS
945 may be followed by a slash and a decimal number, encoding the network
946 prefix length.  If a peer address is specified, the local address
947 cannot have a prefix length.  The network prefix is associated
948 with the peer rather than with the local address.
949
950 .TP
951 .BI broadcast " ADDRESS"
952 the broadcast address on the interface.
953 .sp
954 It is possible to use the special symbols
955 .B '+'
956 and
957 .B '-'
958 instead of the broadcast address.  In this case, the broadcast address
959 is derived by setting/resetting the host bits of the interface prefix.
960
961 .TP
962 .BI label " NAME"
963 Each address may be tagged with a label string.
964 In order to preserve compatibility with Linux-2.0 net aliases,
965 this string must coincide with the name of the device or must be prefixed
966 with the device name followed by colon.
967
968 .TP
969 .BI scope " SCOPE_VALUE"
970 the scope of the area where this address is valid.
971 The available scopes are listed in file
972 .BR "/etc/iproute2/rt_scopes" .
973 Predefined scope values are:
974
975 .in +8
976 .B global
977 - the address is globally valid.
978 .sp
979 .B site
980 - (IPv6 only) the address is site local, i.e. it is
981 valid inside this site.
982 .sp
983 .B link
984 - the address is link local, i.e. it is valid only on this device.
985 .sp
986 .B host
987 - the address is valid only inside this host.
988 .in -8
989
990 .SS ip address delete - delete protocol address
991 .B Arguments:
992 coincide with the arguments of
993 .B ip addr add.
994 The device name is a required argument.  The rest are optional.
995 If no arguments are given, the first address is deleted.
996
997 .SS ip address show - look at protocol addresses
998
999 .TP
1000 .BI dev " NAME " (default)
1001 name of device.
1002
1003 .TP
1004 .BI scope " SCOPE_VAL"
1005 only list addresses with this scope.
1006
1007 .TP
1008 .BI to " PREFIX"
1009 only list addresses matching this prefix.
1010
1011 .TP
1012 .BI label " PATTERN"
1013 only list addresses with labels matching the
1014 .IR "PATTERN" .
1015 .I PATTERN
1016 is a usual shell style pattern.
1017
1018 .TP
1019 .BR dynamic " and " permanent
1020 (IPv6 only) only list addresses installed due to stateless
1021 address configuration or only list permanent (not dynamic)
1022 addresses.
1023
1024 .TP
1025 .B tentative
1026 (IPv6 only) only list addresses which did not pass duplicate
1027 address detection.
1028
1029 .TP
1030 .B deprecated
1031 (IPv6 only) only list deprecated addresses.
1032
1033 .TP
1034 .BR primary " and " secondary
1035 only list primary (or secondary) addresses.
1036
1037 .SS ip address flush - flush protocol addresses
1038 This command flushes the protocol addresses selected by some criteria.
1039
1040 .PP
1041 This command has the same arguments as
1042 .B show.
1043 The difference is that it does not run when no arguments are given.
1044
1045 .PP
1046 .B Warning:
1047 This command (and other
1048 .B flush
1049 commands described below) is pretty dangerous.  If you make a mistake,
1050 it will not forgive it, but will cruelly purge all the addresses.
1051
1052 .PP
1053 With the
1054 .B -statistics
1055 option, the command becomes verbose. It prints out the number of deleted
1056 addresses and the number of rounds made to flush the address list.  If
1057 this option is given twice,
1058 .B ip addr flush
1059 also dumps all the deleted addresses in the format described in the
1060 previous subsection.
1061
1062 .SH ip addrlabel - protocol address label management.
1063
1064 IPv6 address label is used for address selection
1065 described in RFC 3484.  Precedence is managed by userspace,
1066 and only label is stored in kernel.
1067
1068 .SS ip addrlabel add - add an address label
1069 the command adds an address label entry to the kernel.
1070 .TP
1071 .BI prefix " PREFIX"
1072 .TP
1073 .BI dev " DEV"
1074 the outgoing interface.
1075 .TP
1076 .BI label " NUMBER"
1077 the label for the prefix.
1078 0xffffffff is reserved.
1079 .SS ip addrlabel del - delete an address label
1080 the command deletes an address label entry in the kernel.
1081 .B Arguments:
1082 coincide with the arguments of
1083 .B ip addrlabel add
1084 but label is not required.
1085 .SS ip addrlabel list - list address labels
1086 the command show contents of address labels.
1087 .SS ip addrlabel flush - flush address labels
1088 the commoand flushes the contents of address labels and it does not restore default settings.
1089 .SH ip neighbour - neighbour/arp tables management.
1090
1091 .B neighbour
1092 objects establish bindings between protocol addresses and
1093 link layer addresses for hosts sharing the same link.
1094 Neighbour entries are organized into tables. The IPv4 neighbour table
1095 is known by another name - the ARP table.
1096
1097 .P
1098 The corresponding commands display neighbour bindings
1099 and their properties, add new neighbour entries and delete old ones.
1100
1101 .SS ip neighbour add - add a new neighbour entry
1102 .SS ip neighbour change - change an existing entry
1103 .SS ip neighbour replace - add a new entry or change an existing one
1104
1105 These commands create new neighbour records or update existing ones.
1106
1107 .TP
1108 .BI to " ADDRESS " (default)
1109 the protocol address of the neighbour. It is either an IPv4 or IPv6 address.
1110
1111 .TP
1112 .BI dev " NAME"
1113 the interface to which this neighbour is attached.
1114
1115 .TP
1116 .BI lladdr " LLADDRESS"
1117 the link layer address of the neighbour.
1118 .I LLADDRESS
1119 can also be
1120 .BR "null" .
1121
1122 .TP
1123 .BI nud " NUD_STATE"
1124 the state of the neighbour entry.
1125 .B nud
1126 is an abbreviation for 'Neigh bour Unreachability Detection'.
1127 The state can take one of the following values:
1128
1129 .in +8
1130 .B permanent
1131 - the neighbour entry is valid forever and can be only
1132 be removed administratively.
1133 .sp
1134
1135 .B noarp
1136 - the neighbour entry is valid. No attempts to validate
1137 this entry will be made but it can be removed when its lifetime expires.
1138 .sp
1139
1140 .B reachable
1141 - the neighbour entry is valid until the reachability
1142 timeout expires.
1143 .sp
1144
1145 .B stale
1146 - the neighbour entry is valid but suspicious.
1147 This option to
1148 .B ip neigh
1149 does not change the neighbour state if it was valid and the address
1150 is not changed by this command.
1151 .in -8
1152
1153 .SS ip neighbour delete - delete a neighbour entry
1154 This command invalidates a neighbour entry.
1155
1156 .PP
1157 The arguments are the same as with
1158 .BR "ip neigh add" ,
1159 except that
1160 .B lladdr
1161 and
1162 .B nud
1163 are ignored.
1164
1165 .PP
1166 .B Warning:
1167 Attempts to delete or manually change a
1168 .B noarp
1169 entry created by the kernel may result in unpredictable behaviour.
1170 Particularly, the kernel may try to resolve this address even
1171 on a
1172 .B NOARP
1173 interface or if the address is multicast or broadcast.
1174
1175 .SS ip neighbour show - list neighbour entries
1176
1177 This commands displays neighbour tables.
1178
1179 .TP
1180 .BI to " ADDRESS " (default)
1181 the prefix selecting the neighbours to list.
1182
1183 .TP
1184 .BI dev " NAME"
1185 only list the neighbours attached to this device.
1186
1187 .TP
1188 .B unused
1189 only list neighbours which are not currently in use.
1190
1191 .TP
1192 .BI nud " NUD_STATE"
1193 only list neighbour entries in this state.
1194 .I NUD_STATE
1195 takes values listed below or the special value
1196 .B all
1197 which means all states.  This option may occur more than once.
1198 If this option is absent,
1199 .B ip
1200 lists all entries except for
1201 .B none
1202 and
1203 .BR "noarp" .
1204
1205 .SS ip neighbour flush - flush neighbour entries
1206 This command flushes neighbour tables, selecting
1207 entries to flush by some criteria.
1208
1209 .PP
1210 This command has the same arguments as
1211 .B show.
1212 The differences are that it does not run when no arguments are given,
1213 and that the default neighbour states to be flushed do not include
1214 .B permanent
1215 and
1216 .BR "noarp" .
1217
1218 .PP
1219 With the
1220 .B -statistics
1221 option, the command becomes verbose.  It prints out the number of
1222 deleted neighbours and the number of rounds made to flush the
1223 neighbour table.  If the option is given
1224 twice,
1225 .B ip neigh flush
1226 also dumps all the deleted neighbours.
1227
1228 .SH ip route - routing table management
1229 Manipulate route entries in the kernel routing tables keep
1230 information about paths to other networked nodes.
1231 .sp
1232 .B Route types:
1233
1234 .in +8
1235 .B unicast
1236 - the route entry describes real paths to the destinations covered
1237 by the route prefix.
1238
1239 .sp
1240 .B unreachable
1241 - these destinations are unreachable.  Packets are discarded and the
1242 ICMP message
1243 .I host unreachable
1244 is generated.
1245 The local senders get an
1246 .I EHOSTUNREACH
1247 error.
1248
1249 .sp
1250 .B blackhole
1251 - these destinations are unreachable.  Packets are discarded silently.
1252 The local senders get an
1253 .I EINVAL
1254 error.
1255
1256 .sp
1257 .B prohibit
1258 - these destinations are unreachable.  Packets are discarded and the
1259 ICMP message
1260 .I communication administratively prohibited
1261 is generated.  The local senders get an
1262 .I EACCES
1263 error.
1264
1265 .sp
1266 .B local
1267 - the destinations are assigned to this host.  The packets are looped
1268 back and delivered locally.
1269
1270 .sp
1271 .B broadcast
1272 - the destinations are broadcast addresses.  The packets are sent as
1273 link broadcasts.
1274
1275 .sp
1276 .B throw
1277 - a special control route used together with policy rules. If such a
1278 route is selected, lookup in this table is terminated pretending that
1279 no route was found.  Without policy routing it is equivalent to the
1280 absence of the route in the routing table.  The packets are dropped
1281 and the ICMP message
1282 .I net unreachable
1283 is generated.  The local senders get an
1284 .I ENETUNREACH
1285 error.
1286
1287 .sp
1288 .B nat
1289 - a special NAT route.  Destinations covered by the prefix
1290 are considered to be dummy (or external) addresses which require translation
1291 to real (or internal) ones before forwarding.  The addresses to translate to
1292 are selected with the attribute
1293 .B Warning:
1294 Route NAT is no longer supported in Linux 2.6.
1295
1296
1297 .BR "via" .
1298 .sp
1299 .B anycast
1300 .RI "- " "not implemented"
1301 the destinations are
1302 .I anycast
1303 addresses assigned to this host.  They are mainly equivalent
1304 to
1305 .B local
1306 with one difference: such addresses are invalid when used
1307 as the source address of any packet.
1308
1309 .sp
1310 .B multicast
1311 - a special type used for multicast routing.  It is not present in
1312 normal routing tables.
1313 .in -8
1314
1315 .P
1316 .B Route tables:
1317 Linux-2.x can pack routes into several routing
1318 tables identified by a number in the range from 1 to 255 or by
1319 name from the file
1320 .B /etc/iproute2/rt_tables
1321 By default all normal routes are inserted into the
1322 .B main
1323 table (ID 254) and the kernel only uses this table when calculating routes.
1324
1325 .sp
1326 Actually, one other table always exists, which is invisible but
1327 even more important.  It is the
1328 .B local
1329 table (ID 255).  This table
1330 consists of routes for local and broadcast addresses.  The kernel maintains
1331 this table automatically and the administrator usually need not modify it
1332 or even look at it.
1333
1334 The multiple routing tables enter the game when
1335 .I policy routing
1336 is used.
1337
1338 .SS ip route add - add new route
1339 .SS ip route change - change route
1340 .SS ip route replace - change or add new one
1341
1342 .TP
1343 .BI to " TYPE PREFIX " (default)
1344 the destination prefix of the route.  If
1345 .I TYPE
1346 is omitted,
1347 .B ip
1348 assumes type
1349 .BR "unicast" .
1350 Other values of
1351 .I TYPE
1352 are listed above.
1353 .I PREFIX
1354 is an IP or IPv6 address optionally followed by a slash and the
1355 prefix length.  If the length of the prefix is missing,
1356 .B ip
1357 assumes a full-length host route.  There is also a special
1358 .I PREFIX
1359 .B default
1360 - which is equivalent to IP
1361 .B 0/0
1362 or to IPv6
1363 .BR "::/0" .
1364
1365 .TP
1366 .BI tos " TOS"
1367 .TP
1368 .BI dsfield " TOS"
1369 the Type Of Service (TOS) key.  This key has no associated mask and
1370 the longest match is understood as: First, compare the TOS
1371 of the route and of the packet.  If they are not equal, then the packet
1372 may still match a route with a zero TOS.
1373 .I TOS
1374 is either an 8 bit hexadecimal number or an identifier
1375 from
1376 .BR "/etc/iproute2/rt_dsfield" .
1377
1378 .TP
1379 .BI metric " NUMBER"
1380 .TP
1381 .BI preference " NUMBER"
1382 the preference value of the route.
1383 .I NUMBER
1384 is an arbitrary 32bit number.
1385
1386 .TP
1387 .BI table " TABLEID"
1388 the table to add this route to.
1389 .I TABLEID
1390 may be a number or a string from the file
1391 .BR "/etc/iproute2/rt_tables" .
1392 If this parameter is omitted,
1393 .B ip
1394 assumes the
1395 .B main
1396 table, with the exception of
1397 .BR local " , " broadcast " and " nat
1398 routes, which are put into the
1399 .B local
1400 table by default.
1401
1402 .TP
1403 .BI dev " NAME"
1404 the output device name.
1405
1406 .TP
1407 .BI via " ADDRESS"
1408 the address of the nexthop router.  Actually, the sense of this field
1409 depends on the route type.  For normal
1410 .B unicast
1411 routes it is either the true next hop router or, if it is a direct
1412 route installed in BSD compatibility mode, it can be a local address
1413 of the interface.  For NAT routes it is the first address of the block
1414 of translated IP destinations.
1415
1416 .TP
1417 .BI src " ADDRESS"
1418 the source address to prefer when sending to the destinations
1419 covered by the route prefix.
1420
1421 .TP
1422 .BI realm " REALMID"
1423 the realm to which this route is assigned.
1424 .I REALMID
1425 may be a number or a string from the file
1426 .BR "/etc/iproute2/rt_realms" .
1427
1428 .TP
1429 .BI mtu " MTU"
1430 .TP
1431 .BI "mtu lock" " MTU"
1432 the MTU along the path to the destination.  If the modifier
1433 .B lock
1434 is not used, the MTU may be updated by the kernel due to
1435 Path MTU Discovery.  If the modifier
1436 .B lock
1437 is used, no path MTU discovery will be tried, all packets
1438 will be sent without the DF bit in IPv4 case or fragmented
1439 to MTU for IPv6.
1440
1441 .TP
1442 .BI window " NUMBER"
1443 the maximal window for TCP to advertise to these destinations,
1444 measured in bytes.  It limits maximal data bursts that our TCP
1445 peers are allowed to send to us.
1446
1447 .TP
1448 .BI rtt " TIME"
1449 the initial RTT ('Round Trip Time') estimate. If no suffix is
1450 specified the units are raw values passed directly to the
1451 routing code to maintain compatability with previous releases.
1452 Otherwise if a suffix of s, sec or secs is used to specify
1453 seconds; ms, msec or msecs to specify milliseconds; us, usec
1454 or usecs to specify microseconds; ns, nsec or nsecs to specify
1455 nanoseconds; j, hz or jiffies to specify jiffies, the value is
1456 converted to what the routing code expects.
1457
1458
1459 .TP
1460 .BI rttvar " TIME " "(2.3.15+ only)"
1461 the initial RTT variance estimate. Values are specified as with
1462 .BI rtt
1463 above.
1464
1465 .TP
1466 .BI rto_min " TIME " "(2.6.23+ only)"
1467 the minimum TCP Retransmission TimeOut to use when communicating with this
1468 destination.  Values are specified as with
1469 .BI rtt
1470 above.
1471
1472 .TP
1473 .BI ssthresh " NUMBER " "(2.3.15+ only)"
1474 an estimate for the initial slow start threshold.
1475
1476 .TP
1477 .BI cwnd " NUMBER " "(2.3.15+ only)"
1478 the clamp for congestion window.  It is ignored if the
1479 .B lock
1480 flag is not used.
1481
1482 .TP
1483 .BI advmss " NUMBER " "(2.3.15+ only)"
1484 the MSS ('Maximal Segment Size') to advertise to these
1485 destinations when establishing TCP connections.  If it is not given,
1486 Linux uses a default value calculated from the first hop device MTU.
1487 (If the path to these destination is asymmetric, this guess may be wrong.)
1488
1489 .TP
1490 .BI reordering " NUMBER " "(2.3.15+ only)"
1491 Maximal reordering on the path to this destination.
1492 If it is not given, Linux uses the value selected with
1493 .B sysctl
1494 variable
1495 .BR "net/ipv4/tcp_reordering" .
1496
1497 .TP
1498 .BI nexthop " NEXTHOP"
1499 the nexthop of a multipath route.
1500 .I NEXTHOP
1501 is a complex value with its own syntax similar to the top level
1502 argument lists:
1503
1504 .in +8
1505 .BI via " ADDRESS"
1506 - is the nexthop router.
1507 .sp
1508
1509 .BI dev " NAME"
1510 - is the output device.
1511 .sp
1512
1513 .BI weight " NUMBER"
1514 - is a weight for this element of a multipath
1515 route reflecting its relative bandwidth or quality.
1516 .in -8
1517
1518 .TP
1519 .BI scope " SCOPE_VAL"
1520 the scope of the destinations covered by the route prefix.
1521 .I SCOPE_VAL
1522 may be a number or a string from the file
1523 .BR "/etc/iproute2/rt_scopes" .
1524 If this parameter is omitted,
1525 .B ip
1526 assumes scope
1527 .B global
1528 for all gatewayed
1529 .B unicast
1530 routes, scope
1531 .B link
1532 for direct
1533 .BR unicast " and " broadcast
1534 routes and scope
1535 .BR host " for " local
1536 routes.
1537
1538 .TP
1539 .BI protocol " RTPROTO"
1540 the routing protocol identifier of this route.
1541 .I RTPROTO
1542 may be a number or a string from the file
1543 .BR "/etc/iproute2/rt_protos" .
1544 If the routing protocol ID is not given,
1545 .B ip assumes protocol
1546 .B boot
1547 (i.e. it assumes the route was added by someone who doesn't
1548 understand what they are doing).  Several protocol values have
1549 a fixed interpretation.
1550 Namely:
1551
1552 .in +8
1553 .B redirect
1554 - the route was installed due to an ICMP redirect.
1555 .sp
1556
1557 .B kernel
1558 - the route was installed by the kernel during autoconfiguration.
1559 .sp
1560
1561 .B boot
1562 - the route was installed during the bootup sequence.
1563 If a routing daemon starts, it will purge all of them.
1564 .sp
1565
1566 .B static
1567 - the route was installed by the administrator
1568 to override dynamic routing. Routing daemon will respect them
1569 and, probably, even advertise them to its peers.
1570 .sp
1571
1572 .B ra
1573 - the route was installed by Router Discovery protocol.
1574 .in -8
1575
1576 .sp
1577 The rest of the values are not reserved and the administrator is free
1578 to assign (or not to assign) protocol tags.
1579
1580 .TP
1581 .B onlink
1582 pretend that the nexthop is directly attached to this link,
1583 even if it does not match any interface prefix.
1584
1585 .TP
1586 .B equalize
1587 allow packet by packet randomization on multipath routes.
1588 Without this modifier, the route will be frozen to one selected
1589 nexthop, so that load splitting will only occur on per-flow base.
1590 .B equalize
1591 only works if the kernel is patched.
1592
1593 .SS ip route delete - delete route
1594
1595 .B ip route del
1596 has the same arguments as
1597 .BR "ip route add" ,
1598 but their semantics are a bit different.
1599
1600 Key values
1601 .RB "(" to ", " tos ", " preference " and " table ")"
1602 select the route to delete.  If optional attributes are present,
1603 .B ip
1604 verifies that they coincide with the attributes of the route to delete.
1605 If no route with the given key and attributes was found,
1606 .B ip route del
1607 fails.
1608
1609 .SS ip route show - list routes
1610 the command displays the contents of the routing tables or the route(s)
1611 selected by some criteria.
1612
1613 .TP
1614 .BI to " SELECTOR " (default)
1615 only select routes from the given range of destinations.
1616 .I SELECTOR
1617 consists of an optional modifier
1618 .RB "(" root ", " match " or " exact ")"
1619 and a prefix.
1620 .BI root " PREFIX"
1621 selects routes with prefixes not shorter than
1622 .IR PREFIX "."
1623 F.e.
1624 .BI root " 0/0"
1625 selects the entire routing table.
1626 .BI match " PREFIX"
1627 selects routes with prefixes not longer than
1628 .IR PREFIX "."
1629 F.e.
1630 .BI match " 10.0/16"
1631 selects
1632 .IR 10.0/16 ","
1633 .IR 10/8 " and " 0/0 ,
1634 but it does not select
1635 .IR 10.1/16 " and " 10.0.0/24 .
1636 And
1637 .BI exact " PREFIX"
1638 (or just
1639 .IR PREFIX ")"
1640 selects routes with this exact prefix. If neither of these options
1641 are present,
1642 .B ip
1643 assumes
1644 .BI root " 0/0"
1645 i.e. it lists the entire table.
1646
1647 .TP
1648 .BI tos " TOS"
1649 .BI dsfield " TOS"
1650 only select routes with the given TOS.
1651
1652 .TP
1653 .BI table " TABLEID"
1654 show the routes from this table(s).  The default setting is to show
1655 .BR table main "."
1656 .I TABLEID
1657 may either be the ID of a real table or one of the special values:
1658 .sp
1659 .in +8
1660 .B all
1661 - list all of the tables.
1662 .sp
1663 .B cache
1664 - dump the routing cache.
1665 .in -8
1666
1667 .TP
1668 .B cloned
1669 .TP
1670 .B cached
1671 list cloned routes i.e. routes which were dynamically forked from
1672 other routes because some route attribute (f.e. MTU) was updated.
1673 Actually, it is equivalent to
1674 .BR "table cache" "."
1675
1676 .TP
1677 .BI from " SELECTOR"
1678 the same syntax as for
1679 .BR to ","
1680 but it binds the source address range rather than destinations.
1681 Note that the
1682 .B from
1683 option only works with cloned routes.
1684
1685 .TP
1686 .BI protocol " RTPROTO"
1687 only list routes of this protocol.
1688
1689 .TP
1690 .BI scope " SCOPE_VAL"
1691 only list routes with this scope.
1692
1693 .TP
1694 .BI type " TYPE"
1695 only list routes of this type.
1696
1697 .TP
1698 .BI dev " NAME"
1699 only list routes going via this device.
1700
1701 .TP
1702 .BI via " PREFIX"
1703 only list routes going via the nexthop routers selected by
1704 .IR PREFIX "."
1705
1706 .TP
1707 .BI src " PREFIX"
1708 only list routes with preferred source addresses selected
1709 by
1710 .IR PREFIX "."
1711
1712 .TP
1713 .BI realm " REALMID"
1714 .TP
1715 .BI realms " FROMREALM/TOREALM"
1716 only list routes with these realms.
1717
1718 .SS ip route flush - flush routing tables
1719 this command flushes routes selected by some criteria.
1720
1721 .sp
1722 The arguments have the same syntax and semantics as the arguments of
1723 .BR "ip route show" ,
1724 but routing tables are not listed but purged.  The only difference is
1725 the default action:
1726 .B show
1727 dumps all the IP main routing table but
1728 .B flush
1729 prints the helper page.
1730
1731 .sp
1732 With the
1733 .B -statistics
1734 option, the command becomes verbose. It prints out the number of
1735 deleted routes and the number of rounds made to flush the routing
1736 table. If the option is given
1737 twice,
1738 .B ip route flush
1739 also dumps all the deleted routes in the format described in the
1740 previous subsection.
1741
1742 .SS ip route get - get a single route
1743 this command gets a single route to a destination and prints its
1744 contents exactly as the kernel sees it.
1745
1746 .TP
1747 .BI to " ADDRESS " (default)
1748 the destination address.
1749
1750 .TP
1751 .BI from " ADDRESS"
1752 the source address.
1753
1754 .TP
1755 .BI tos " TOS"
1756 .TP
1757 .BI dsfield " TOS"
1758 the Type Of Service.
1759
1760 .TP
1761 .BI iif " NAME"
1762 the device from which this packet is expected to arrive.
1763
1764 .TP
1765 .BI oif " NAME"
1766 force the output device on which this packet will be routed.
1767
1768 .TP
1769 .B connected
1770 if no source address
1771 .RB "(option " from ")"
1772 was given, relookup the route with the source set to the preferred
1773 address received from the first lookup.
1774 If policy routing is used, it may be a different route.
1775
1776 .P
1777 Note that this operation is not equivalent to
1778 .BR "ip route show" .
1779 .B show
1780 shows existing routes.
1781 .B get
1782 resolves them and creates new clones if necessary.  Essentially,
1783 .B get
1784 is equivalent to sending a packet along this path.
1785 If the
1786 .B iif
1787 argument is not given, the kernel creates a route
1788 to output packets towards the requested destination.
1789 This is equivalent to pinging the destination
1790 with a subsequent
1791 .BR "ip route ls cache" ,
1792 however, no packets are actually sent.  With the
1793 .B iif
1794 argument, the kernel pretends that a packet arrived from this interface
1795 and searches for a path to forward the packet.
1796
1797 .SH ip rule - routing policy database management
1798
1799 .BR "Rule" s
1800 in the routing policy database control the route selection algorithm.
1801
1802 .P
1803 Classic routing algorithms used in the Internet make routing decisions
1804 based only on the destination address of packets (and in theory,
1805 but not in practice, on the TOS field).
1806
1807 .P
1808 In some circumstances we want to route packets differently depending not only
1809 on destination addresses, but also on other packet fields: source address,
1810 IP protocol, transport protocol ports or even packet payload.
1811 This task is called 'policy routing'.
1812
1813 .P
1814 To solve this task, the conventional destination based routing table, ordered
1815 according to the longest match rule, is replaced with a 'routing policy
1816 database' (or RPDB), which selects routes by executing some set of rules.
1817
1818 .P
1819 Each policy routing rule consists of a
1820 .B selector
1821 and an
1822 .B action predicate.
1823 The RPDB is scanned in the order of increasing priority. The selector
1824 of each rule is applied to {source address, destination address, incoming
1825 interface, tos, fwmark} and, if the selector matches the packet,
1826 the action is performed.  The action predicate may return with success.
1827 In this case, it will either give a route or failure indication
1828 and the RPDB lookup is terminated. Otherwise, the RPDB program
1829 continues on the next rule.
1830
1831 .P
1832 Semantically, natural action is to select the nexthop and the output device.
1833
1834 .P
1835 At startup time the kernel configures the default RPDB consisting of three
1836 rules:
1837
1838 .TP
1839 1.
1840 Priority: 0, Selector: match anything, Action: lookup routing
1841 table
1842 .B local
1843 (ID 255).
1844 The
1845 .B local
1846 table is a special routing table containing
1847 high priority control routes for local and broadcast addresses.
1848 .sp
1849 Rule 0 is special. It cannot be deleted or overridden.
1850
1851 .TP
1852 2.
1853 Priority: 32766, Selector: match anything, Action: lookup routing
1854 table
1855 .B main
1856 (ID 254).
1857 The
1858 .B main
1859 table is the normal routing table containing all non-policy
1860 routes. This rule may be deleted and/or overridden with other
1861 ones by the administrator.
1862
1863 .TP
1864 3.
1865 Priority: 32767, Selector: match anything, Action: lookup routing
1866 table
1867 .B default
1868 (ID 253).
1869 The
1870 .B default
1871 table is empty.  It is reserved for some post-processing if no previous
1872 default rules selected the packet.
1873 This rule may also be deleted.
1874
1875 .P
1876 Each RPDB entry has additional
1877 attributes.  F.e. each rule has a pointer to some routing
1878 table.  NAT and masquerading rules have an attribute to select new IP
1879 address to translate/masquerade.  Besides that, rules have some
1880 optional attributes, which routes have, namely
1881 .BR "realms" .
1882 These values do not override those contained in the routing tables.  They
1883 are only used if the route did not select any attributes.
1884
1885 .sp
1886 The RPDB may contain rules of the following types:
1887
1888 .in +8
1889 .B unicast
1890 - the rule prescribes to return the route found
1891 in the routing table referenced by the rule.
1892
1893 .B blackhole
1894 - the rule prescribes to silently drop the packet.
1895
1896 .B unreachable
1897 - the rule prescribes to generate a 'Network is unreachable' error.
1898
1899 .B prohibit
1900 - the rule prescribes to generate 'Communication is administratively
1901 prohibited' error.
1902
1903 .B nat
1904 - the rule prescribes to translate the source address
1905 of the IP packet into some other value.
1906 .in -8
1907
1908 .SS ip rule add - insert a new rule
1909 .SS ip rule delete - delete a rule
1910
1911 .TP
1912 .BI type " TYPE " (default)
1913 the type of this rule.  The list of valid types was given in the previous
1914 subsection.
1915
1916 .TP
1917 .BI from " PREFIX"
1918 select the source prefix to match.
1919
1920 .TP
1921 .BI to " PREFIX"
1922 select the destination prefix to match.
1923
1924 .TP
1925 .BI iif " NAME"
1926 select the incoming device to match.  If the interface is loopback,
1927 the rule only matches packets originating from this host.  This means
1928 that you may create separate routing tables for forwarded and local
1929 packets and, hence, completely segregate them.
1930
1931 .TP
1932 .BI tos " TOS"
1933 .TP
1934 .BI dsfield " TOS"
1935 select the TOS value to match.
1936
1937 .TP
1938 .BI fwmark " MARK"
1939 select the
1940 .B fwmark
1941 value to match.
1942
1943 .TP
1944 .BI priority " PREFERENCE"
1945 the priority of this rule.  Each rule should have an explicitly
1946 set
1947 .I unique
1948 priority value.
1949 The options preference and order are synonyms with priority.
1950
1951 .TP
1952 .BI table " TABLEID"
1953 the routing table identifier to lookup if the rule selector matches.
1954 It is also possible to use lookup instead of table.
1955
1956 .TP
1957 .BI realms " FROM/TO"
1958 Realms to select if the rule matched and the routing table lookup
1959 succeeded.  Realm
1960 .I TO
1961 is only used if the route did not select any realm.
1962
1963 .TP
1964 .BI nat " ADDRESS"
1965 The base of the IP address block to translate (for source addresses).
1966 The
1967 .I ADDRESS
1968 may be either the start of the block of NAT addresses (selected by NAT
1969 routes) or a local host address (or even zero).
1970 In the last case the router does not translate the packets, but
1971 masquerades them to this address.
1972 Using map-to instead of nat means the same thing.
1973
1974 .B Warning:
1975 Changes to the RPDB made with these commands do not become active
1976 immediately.  It is assumed that after a script finishes a batch of
1977 updates, it flushes the routing cache with
1978 .BR "ip route flush cache" .
1979
1980 .SS ip rule flush - also dumps all the deleted rules.
1981 This command has no arguments.
1982
1983 .SS ip rule show - list rules
1984 This command has no arguments.
1985 The options list or lst are synonyms with show.
1986
1987 .SH ip maddress - multicast addresses management
1988
1989 .B maddress
1990 objects are multicast addresses.
1991
1992 .SS ip maddress show - list multicast addresses
1993
1994 .TP
1995 .BI dev " NAME " (default)
1996 the device name.
1997
1998 .SS ip maddress add - add a multicast address
1999 .SS ip maddress delete - delete a multicast address
2000 these commands attach/detach a static link layer multicast address
2001 to listen on the interface.
2002 Note that it is impossible to join protocol multicast groups
2003 statically.  This command only manages link layer addresses.
2004
2005 .TP
2006 .BI address " LLADDRESS " (default)
2007 the link layer multicast address.
2008
2009 .TP
2010 .BI dev " NAME"
2011 the device to join/leave this multicast address.
2012
2013 .SH ip mroute - multicast routing cache management
2014 .B mroute
2015 objects are multicast routing cache entries created by a user level
2016 mrouting daemon (f.e.
2017 .B pimd
2018 or
2019 .B mrouted
2020 ).
2021
2022 Due to the limitations of the current interface to the multicast routing
2023 engine, it is impossible to change
2024 .B mroute
2025 objects administratively, so we may only display them.  This limitation
2026 will be removed in the future.
2027
2028 .SS ip mroute show - list mroute cache entries
2029
2030 .TP
2031 .BI to " PREFIX " (default)
2032 the prefix selecting the destination multicast addresses to list.
2033
2034 .TP
2035 .BI iif " NAME"
2036 the interface on which multicast packets are received.
2037
2038 .TP
2039 .BI from " PREFIX"
2040 the prefix selecting the IP source addresses of the multicast route.
2041
2042 .SH ip tunnel - tunnel configuration
2043 .B tunnel
2044 objects are tunnels, encapsulating packets in IP packets and then
2045 sending them over the IP infrastructure.
2046 The encapulating (or outer) address family is specified by the
2047 .B -f
2048 option.  The default is IPv4.
2049
2050 .SS ip tunnel add - add a new tunnel
2051 .SS ip tunnel change - change an existing tunnel
2052 .SS ip tunnel delete - destroy a tunnel
2053
2054 .TP
2055 .BI name " NAME " (default)
2056 select the tunnel device name.
2057
2058 .TP
2059 .BI mode " MODE"
2060 set the tunnel mode. Available modes depend on the encapsulating address family.
2061 .br
2062 Modes for IPv4 encapsulation available:
2063 .BR ipip ", " sit ", " isatap " and " gre "."
2064 .br
2065 Modes for IPv6 encapsulation available:
2066 .BR ip6ip6 ", " ipip6 " and " any "."
2067
2068 .TP
2069 .BI remote " ADDRESS"
2070 set the remote endpoint of the tunnel.
2071
2072 .TP
2073 .BI local " ADDRESS"
2074 set the fixed local address for tunneled packets.
2075 It must be an address on another interface of this host.
2076
2077 .TP
2078 .BI ttl " N"
2079 set a fixed TTL
2080 .I N
2081 on tunneled packets.
2082 .I N
2083 is a number in the range 1--255. 0 is a special value
2084 meaning that packets inherit the TTL value.
2085 The default value for IPv4 tunnels is:
2086 .BR "inherit" .
2087 The default value for IPv6 tunnels is:
2088 .BR "64" .
2089
2090
2091 .TP
2092 .BI tos " T"
2093 .TP
2094 .BI dsfield " T"
2095 .TP
2096 .BI tclass " T"
2097 set a fixed TOS (or traffic class in IPv6)
2098 .I T
2099 on tunneled packets.
2100 The default value is:
2101 .BR "inherit" .
2102
2103 .TP
2104 .BI dev " NAME"
2105 bind the tunnel to the device
2106 .I NAME
2107 so that tunneled packets will only be routed via this device and will
2108 not be able to escape to another device when the route to endpoint
2109 changes.
2110
2111 .TP
2112 .B nopmtudisc
2113 disable Path MTU Discovery on this tunnel.
2114 It is enabled by default.  Note that a fixed ttl is incompatible
2115 with this option: tunnelling with a fixed ttl always makes pmtu
2116 discovery.
2117
2118 .TP
2119 .BI key " K"
2120 .TP
2121 .BI ikey " K"
2122 .TP
2123 .BI okey " K"
2124 .RB ( " only GRE tunnels " )
2125 use keyed GRE with key
2126 .IR K ". " K
2127 is either a number or an IP address-like dotted quad.
2128 The
2129 .B key
2130 parameter sets the key to use in both directions.
2131 The
2132 .BR ikey " and " okey
2133 parameters set different keys for input and output.
2134
2135 .TP
2136 .BR csum ", " icsum ", " ocsum
2137 .RB ( " only GRE tunnels " )
2138 generate/require checksums for tunneled packets.
2139 The
2140 .B ocsum
2141 flag calculates checksums for outgoing packets.
2142 The
2143 .B icsum
2144 flag requires that all input packets have the correct
2145 checksum.  The
2146 .B csum
2147 flag is equivalent to the combination
2148 .BR "icsum ocsum" .
2149
2150 .TP
2151 .BR seq ", " iseq ", " oseq
2152 .RB ( " only GRE tunnels " )
2153 serialize packets.
2154 The
2155 .B oseq
2156 flag enables sequencing of outgoing packets.
2157 The
2158 .B iseq
2159 flag requires that all input packets are serialized.
2160 The
2161 .B  seq
2162 flag is equivalent to the combination
2163 .BR "iseq oseq" .
2164 .B It isn't work. Don't use it.
2165
2166 .TP
2167 .BR "dscp inherit"
2168 .RB ( " only IPv6 tunnels " )
2169 Inherit DS field between inner and outer header.
2170
2171 .TP
2172 .BI encaplim " ELIM"
2173 .RB ( " only IPv6 tunnels " )
2174 set a fixed encapsulation limit.  Default is 4.
2175
2176 .TP
2177 .BI flowlabel " FLOWLABEL"
2178 .RB ( " only IPv6 tunnels " )
2179 set a fixed flowlabel.
2180
2181 .SS ip tunnel show - list tunnels
2182 This command has no arguments.
2183
2184 .SH ip monitor and rtmon - state monitoring
2185
2186 The
2187 .B ip
2188 utility can monitor the state of devices, addresses
2189 and routes continuously.  This option has a slightly different format.
2190 Namely, the
2191 .B monitor
2192 command is the first in the command line and then the object list follows:
2193
2194 .BR "ip monitor" " [ " all " |"
2195 .IR LISTofOBJECTS " ]"
2196
2197 .I OBJECT-LIST
2198 is the list of object types that we want to monitor.
2199 It may contain
2200 .BR link ", " address " and " route "."
2201 If no
2202 .B file
2203 argument is given,
2204 .B ip
2205 opens RTNETLINK, listens on it and dumps state changes in the format
2206 described in previous sections.
2207
2208 .P
2209 If a file name is given, it does not listen on RTNETLINK,
2210 but opens the file containing RTNETLINK messages saved in binary format
2211 and dumps them.  Such a history file can be generated with the
2212 .B rtmon
2213 utility.  This utility has a command line syntax similar to
2214 .BR "ip monitor" .
2215 Ideally,
2216 .B rtmon
2217 should be started before the first network configuration command
2218 is issued. F.e. if you insert:
2219 .sp
2220 .in +8
2221 rtmon file /var/log/rtmon.log
2222 .in -8
2223 .sp
2224 in a startup script, you will be able to view the full history
2225 later.
2226
2227 .P
2228 Certainly, it is possible to start
2229 .B rtmon
2230 at any time.
2231 It prepends the history with the state snapshot dumped at the moment
2232 of starting.
2233
2234 .SH ip xfrm - setting xfrm
2235 xfrm is an IP framework, which can transform format of the datagrams,
2236 .br
2237 i.e. encrypt the packets with some algorithm. xfrm policy and xfrm state
2238 are associated through templates
2239 .IR TMPL_LIST "."
2240 This framework is used as a part of IPsec protocol.
2241
2242 .SS ip xfrm state add - add new state into xfrm
2243
2244 .SS ip xfrm state update - update existing xfrm state
2245
2246 .SS ip xfrm state allocspi - allocate SPI value
2247
2248 .TP
2249 .I MODE
2250 is set as default to
2251 .BR transport ","
2252 but it could be set to
2253 .BR tunnel "," ro " or " beet "."
2254
2255 .TP
2256 .I FLAG-LIST
2257 contains one or more flags.
2258
2259 .TP
2260 .I FLAG
2261 could be set to
2262 .BR noecn ", " decap-dscp " or " wildrecv "."
2263
2264 .TP
2265 .I ENCAP
2266 encapsulation is set to encapsulation type
2267 .IR ENCAP-TYPE ", source port " SPORT ", destination port "  DPORT " and " OADDR "."
2268
2269 .TP
2270 .I ENCAP-TYPE
2271 could be set to
2272 .BR espinudp " or " espinudp-nonike "."
2273
2274 .TP
2275 .I ALGO-LIST
2276 contains one or more algorithms
2277 .I ALGO
2278 which depend on the type of algorithm set by
2279 .IR ALGO_TYPE "."
2280 It can be used these algoritms
2281 .BR enc ", " auth " or " comp "."
2282
2283 .SS ip xfrm policy add - add a new policy
2284
2285 .SS ip xfrm policy update - update an existing policy
2286
2287 .SS ip xfrm policy delete - delete existing policy
2288
2289 .SS ip xfrm policy get - get existing policy
2290
2291 .SS ip xfrm policy deleteall - delete all existing xfrm policy
2292
2293 .SS ip xfrm policy list - print out the list of xfrm policy
2294
2295 .SS ip xfrm policy flush - flush policies
2296 It can be flush
2297 .BR all
2298 policies or only those specified with
2299 .BR ptype "."
2300
2301 .TP
2302 .BI dir " DIR "
2303 directory could be one of these:
2304 .BR "inp", " out " or " fwd".
2305
2306 .TP
2307 .IR SELECTOR
2308 selects for which addresses will be set up the policy. The selector
2309 is defined by source and destination address.
2310
2311 .TP
2312 .IR UPSPEC
2313 is defined by source port
2314 .BR sport ", "
2315 destination port
2316 .BR dport ", " type
2317 as number and
2318 .B code
2319 also number.
2320
2321 .TP
2322 .BI dev " DEV "
2323 specify network device.
2324
2325 .TP
2326 .BI index " INDEX "
2327 the number of indexed policy.
2328
2329 .TP
2330 .BI ptype " PTYPE "
2331 type is set as default on
2332 .BR "main" ,
2333 could be switch on
2334 .BR "sub" .
2335
2336 .TP
2337 .BI action " ACTION "
2338 is set as default on
2339 .BR "allow".
2340 It could be switch on
2341 .BR "block".
2342
2343 .TP
2344 .BI priority " PRIORITY "
2345 priority is a number. Default priority is set on zero.
2346
2347 .TP
2348 .IR LIMIT-LIST
2349 limits are set in seconds, bytes or numbers of packets.
2350
2351 .TP
2352 .IR TMPL-LIST
2353 template list is based on
2354 .IR ID ","
2355 .BR mode ", " reqid " and " level ". "
2356
2357 .TP
2358 .IR ID
2359 is specified by source address, destination address,
2360 .I proto
2361 and value of
2362 .IR spi "."
2363
2364 .TP
2365 .IR XFRM_PROTO
2366 values:
2367 .BR esp ", " ah ", " comp ", " route2 " or " hao "."
2368
2369 .TP
2370 .IR MODE
2371 is set as default on
2372 .BR transport ","
2373 but it could be set on
2374 .BR tunnel " or " beet "."
2375
2376 .TP
2377 .IR LEVEL
2378 is set as default on
2379 .BR required
2380 and the other choice is
2381 .BR use "."
2382
2383 .TP
2384 .IR UPSPEC
2385 is specified by
2386 .BR sport ", "
2387 .BR dport ", " type
2388 and
2389 .B code
2390 (NUMBER).
2391
2392 .SS ip xfrm monitor - is used for listing all objects or defined group of them.
2393 The
2394 .B xfrm monitor
2395 can monitor the policies for all objects or defined group of them.
2396
2397 .SH HISTORY
2398 .B ip
2399 was written by Alexey N. Kuznetsov and added in Linux 2.2.
2400 .SH SEE ALSO
2401 .BR tc (8)
2402 .br
2403 .RB "IP Command reference " ip-cref.ps
2404 .br
2405 .RB "IP tunnels " ip-cref.ps
2406 .br
2407 .RB "User documentation at " http://lartc.org/ ", but please direct bugreports and patches to: " <netdev@vger.kernel.org>
2408
2409 .SH AUTHOR
2410 Original Manpage  by Michail Litvak <mci@owl.openwall.com>