Avoid escape sequences in txt output for man pages
[lartc.git] / manpages / ip.8
blob50e44192e4f2f05fa2c5c921ceff4d0077068d0f
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
6 .ad l
7 .in +8
8 .ti -8
9 .B ip
10 .RI "[ " OPTIONS " ] " OBJECT " { " COMMAND " | "
11 .BR help " }"
12 .sp
14 .ti -8
15 .IR OBJECT " := { "
16 .BR link " | " addr " | " route " | " rule " | " neigh " | " tunnel " | "\
17 maddr " | "  mroute " | " monitor " }"
18 .sp
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] }
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 allmulti " { " 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 " }"
55 .ti -8
56 .B ip link show
57 .RI "[ " DEVICE " ]"
59 .ti -8
60 .BR "ip addr" " { " add " | " del " } " 
61 .IB IFADDR " dev " STRING
63 .ti -8
64 .BR "ip addr" " { " show " | " flush " } [ " dev
65 .IR STRING " ] [ "
66 .B  scope
67 .IR SCOPE-ID " ] [ "
68 .B  to 
69 .IR PREFIX " ] [ " FLAG-LIST " ] [ "
70 .B  label
71 .IR PATTERN " ]"
73 .ti -8
74 .IR IFADDR " := " PREFIX " | " ADDR
75 .B  peer
76 .IR PREFIX " [ "
77 .B  broadcast
78 .IR ADDR " ] [ "
79 .B  anycast
80 .IR ADDR " ] [ "
81 .B  label
82 .IR STRING " ] [ "
83 .B  scope
84 .IR SCOPE-ID " ]"
86 .ti -8
87 .IR SCOPE-ID " := "
88 .RB "[ " host " | " link " | " global " | "
89 .IR NUMBER " ]"
91 .ti -8
92 .IR FLAG-LIST " := [ "  FLAG-LIST " ] " FLAG
94 .ti -8
95 .IR FLAG " := "
96 .RB "[ " permanent " | " dynamic " | " secondary " | " primary " | "\
97 tentative " | " deprecated " ]"
99 .ti -8
100 .BR "ip route" " { "
101 .BR list " | " flush " } "
102 .I  SELECTOR
104 .ti -8
105 .B  ip route get 
106 .IR ADDRESS " [ "
107 .BI from " ADDRESS " iif " STRING"
108 .RB " ] [ " oif 
109 .IR STRING " ] [ "
110 .B  tos
111 .IR TOS " ]"
113 .ti -8
114 .BR "ip route" " { " add " | " del " | " change " | " append " | "\
115 replace " | " monitor " } "
116 .I  ROUTE
118 .ti -8
119 .IR SELECTOR " := "
120 .RB "[ " root
121 .IR PREFIX " ] [ "
122 .B  match
123 .IR PREFIX " ] [ "
124 .B  exact
125 .IR PREFIX " ] [ "
126 .B  table
127 .IR TABLE_ID " ] [ "
128 .B  proto
129 .IR RTPROTO " ] [ "
130 .B  type
131 .IR TYPE " ] [ "
132 .B  scope
133 .IR SCOPE " ]"
135 .ti -8
136 .IR ROUTE " := " NODE_SPEC " [ " INFO_SPEC " ]"
138 .ti -8
139 .IR NODE_SPEC " := [ " TYPE " ] " PREFIX " ["
140 .B  tos
141 .IR TOS " ] [ "
142 .B  table
143 .IR TABLE_ID " ] [ "
144 .B  proto
145 .IR RTPROTO " ] [ "
146 .B  scope
147 .IR SCOPE " ] [ "
148 .B  metric
149 .IR METRIC " ]"
151 .ti -8
152 .IR INFO_SPEC " := " "NH OPTIONS FLAGS" " ["
153 .B  nexthop
154 .IR NH " ] ..."
156 .ti -8
157 .IR NH " := [ "
158 .B  via
159 .IR ADDRESS " ] [ "
160 .B  dev
161 .IR STRING " ] [ "
162 .B  weight
163 .IR NUMBER " ] " NHFLAGS
165 .ti -8
166 .IR OPTIONS " := " FLAGS " [ "
167 .B  mtu
168 .IR NUMBER " ] [ "
169 .B  advmss
170 .IR NUMBER " ] [ "
171 .B  rtt
172 .IR NUMBER " ] [ "
173 .B  rttvar
174 .IR NUMBER " ] [ "
175 .B  window
176 .IR NUMBER " ] [ "
177 .B  cwnd
178 .IR NUMBER " ] [ "
179 .B  ssthresh
180 .IR REALM " ] [ "
181 .B  realms
182 .IR REALM " ]"
184 .ti -8
185 .IR TYPE " := [ "
186 .BR unicast " | " local " | " broadcast " | " multicast " | "\
187 throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]"
189 .ti -8
190 .IR TABLE_ID " := [ "
191 .BR local "| " main " | " default " | " all " |"
192 .IR NUMBER " ]"
194 .ti -8
195 .IR SCOPE " := [ "
196 .BR host " | " link " | " global " |"
197 .IR NUMBER " ]"
199 .ti -8
200 .IR FLAGS " := [ "
201 .BR equalize " ]"
203 .ti -8
204 .IR NHFLAGS " := [ "
205 .BR onlink " | " pervasive " ]"
207 .ti -8
208 .IR RTPROTO " := [ "
209 .BR kernel " | " boot " | " static " |"
210 .IR NUMBER " ]"
212 .ti -8
213 .B  ip rule
214 .RB " [ " list " | " add " | " del " ]"
215 .I  SELECTOR ACTION
217 .ti -8
218 .IR SELECTOR " := [ "
219 .B  from
220 .IR PREFIX " ] [ "
221 .B  to
222 .IR PREFIX " ] [ "
223 .B  tos
224 .IR TOS " ] [ "
225 .B  fwmark
226 .IR FWMARK " ] [ "
227 .B  dev
228 .IR STRING " ] [ "
229 .B  pref
230 .IR NUMBER " ]"
232 .ti -8
233 .IR ACTION " := [ "
234 .B  table
235 .IR TABLE_ID " ] [ "
236 .B  nat
237 .IR ADDRESS " ] [ "
238 .BR prohibit " | " reject " | " unreachable " ] [ " realms
239 .RI "[" SRCREALM "/]" DSTREALM " ]"
241 .ti -8
242 .IR TABLE_ID " := [ "
243 .BR local " | " main " | " default " |"
244 .IR NUMBER " ]"
246 .ti -8
247 .BR "ip neigh" " { " add " | " del " | " change " | " replace " } { "
248 .IR ADDR " [ "
249 .B  lladdr
250 .IR LLADDR " ] [ "
251 .BR nud " { " permanent " | " noarp " | " stale " | " reachable " } ] | " proxy
252 .IR ADDR " } [ "
253 .B  dev
254 .IR DEV " ]"
256 .ti -8
257 .BR "ip neigh" " { " show " | " flush " } [ " to
258 .IR PREFIX " ] [ "
259 .B  dev
260 .IR DEV " ] [ "
261 .B  nud
262 .IR STATE " ]"
264 .ti -8
265 .BR "ip tunnel" " { " add " | " change " | " del " | " show " }"
266 .RI "[ " NAME " ]"
268 .RB "[ " mode " { " ipip " | " gre " | " sit " } ]"
270 .RB "[ " remote
271 .IR ADDR " ] [ "
272 .B  local
273 .IR ADDR " ]"
275 .RB "[ [" i "|" o "]" seq " ] [ [" i "|" o "]" key
276 .IR KEY " ] [ "
277 .RB "[" i "|" o "]" csum " ] ]"
279 .RB "[ " ttl
280 .IR TTL " ] [ "
281 .B  tos
282 .IR TOS " ] [ "
283 .RB "[" no "]" pmtudisc " ]"
285 .RB "[ " dev
286 .IR PHYS_DEV " ]"
288 .ti -8
289 .IR ADDR " := { " IP_ADDRESS " |"
290 .BR any " }"
292 .ti -8
293 .IR TOS " := { " NUMBER " |"
294 .BR inherit " }"
296 .ti -8
297 .IR TTL " := { " 1 ".." 255 " | "
298 .BR inherit " }"
300 .ti -8
301 .IR KEY " := { " DOTTED_QUAD " | " NUMBER " }"
303 .ti -8
304 .BR "ip maddr" " [ " add " | " del " ]"
305 .IB MULTIADDR " dev " STRING
307 .ti -8
308 .BR "ip maddr show" " [ " dev
309 .IR STRING " ]"
311 .ti -8
312 .BR "ip mroute show" " ["
313 .IR PREFIX " ] [ "
314 .B  from
315 .IR PREFIX " ] [ "
316 .B  iif
317 .IR DEVICE " ]"
319 .ti -8
320 .BR "ip monitor" " [ " all " |"
321 .IR LISTofOBJECTS " ]"
322 .in -8
323 .ad b
325 .SH OPTIONS
328 .BR "\-V" , " -Version"
329 print the version of the
330 .B ip
331 utility and exit.
334 .BR "\-s" , " \-stats", " \-statistics"
335 output more information.  If the option
336 appears twice or more, the amount of information increases.
337 As a rule, the information is statistics or some time values.
340 .BR "\-f" , " \-family"
341 followed by protocol family identifier:
342 .BR "inet" , " inet6"
344 .B link
345 ,enforce the protocol family to use.  If the option is not present,
346 the protocol family is guessed from other arguments.  If the rest 
347 of the command line does not give enough information to guess the
348 family,
349 .B ip
350 falls back to the default one, usually
351 .B inet
353 .BR "any" .
354 .B link
355 is a special family identifier meaning that no networking protocol
356 is involved.
359 .B \-4
360 shortcut for
361 .BR "-family inet" .
364 .B \-6
365 shortcut for
366 .BR "\-family inet6" .
369 .B \-0
370 shortcut for
371 .BR "\-family link" .
374 .BR "\-o" , " \-oneline"
375 output each record on a single line, replacing line feeds
376 with the
377 .B '\'
378 character. This is convenient when you want to count records 
379 with
380 .BR wc (1)
381  or to
382 .BR grep (1)
383 the output.
386 .BR "\-r" , " \-resolve"
387 use the system's name resolver to print DNS names instead of
388 host addresses.
390 .SH IP - COMMAND SYNTAX
393 .I OBJECT
396 .B link
397 - network device.
400 .B address
401 - protocol (IP or IPv6) address on a device.
403 .B neighbour
404 - ARP or NDISC cache entry.
407 .B route
408 - routing table entry.
411 .B rule
412 - rule in routing policy database.
415 .B maddress
416 - multicast address.
419 .B mroute
420 - multicast routing cache entry.
423 .B tunnel
424 - tunnel over IP.
427 The names of all objects may be written in full or
428 abbreviated form, f.e.
429 .B address
430 is abbreviated as
431 .B addr
432 or just
433 .B a.
436 .I COMMAND
438 Specifies the action to perform on the object.
439 The set of possible actions depends on the object type.
440 As a rule, it is possible to
441 .BR "add" , " delete"
443 .B show
445 .B list
446 ) objects, but some objects do not allow all of these operations
447 or have some additional commands.  The
448 .B help
449 command is available for all objects.  It prints
450 out a list of available commands and argument syntax conventions.
452 If no command is given, some default command is assumed.
453 Usually it is
454 .B list
455 or, if the objects of this class cannot be listed,
456 .BR "help" .
458 .SH ip link - network device configuration
460 .B link
461 is a network device and the corresponding commands
462 display and change the state of devices.
464 .SS ip link set - change device attributes
467 .BI dev " NAME " (default)
468 .I NAME
469 specifies network device to operate on.
472 .BR up " and " down
473 change the state of the device to
474 .B UP
476 .BR "DOWN" .
479 .BR "arp on " or " arp off"
480 change the
481 .B NOARP
482 flag on the device.
485 .BR "multicast on " or " multicast off"
486 change the
487 .B MULTICAST
488 flag on the device.
491 .BR "dynamic on " or " dynamic off"
492 change the
493 .B DYNAMIC
494 flag on the device.
497 .BI name " NAME"
498 change the name of the device.  This operation is not
499 recommended if the device is running or has some addresses
500 already configured.
503 .BI txqueuelen " NUMBER"
504 .TP 
505 .BI txqlen " NUMBER"
506 change the transmit queue length of the device.
509 .BI mtu " NUMBER"
510 change the 
511 .I MTU
512 of the device.
515 .BI address " LLADDRESS"
516 change the station address of the interface.
519 .BI broadcast " LLADDRESS"
521 .BI brd " LLADDRESS"
523 .BI peer " LLADDRESS"
524 change the link layer broadcast address or the peer address when
525 the interface is
526 .IR "POINTOPOINT" .
529 .B Warning:
530 If multiple parameter changes are requested,
531 .B ip
532 aborts immediately after any of the changes have failed.
533 This is the only case when
534 .B ip
535 can move the system to an unpredictable state.  The solution
536 is to avoid changing several parameters with one
537 .B ip link set
538 call.
540 .SS  ip link show - display device attributes
543 .BI dev " NAME " (default)
544 .I NAME
545 specifies the network device to show.
546 If this argument is omitted all devices are listed.
549 .B up
550 only display running interfaces.
552 .SH ip address - protocol address management.
555 .B address
556 is a protocol (IP or IPv6) address attached
557 to a network device.  Each device must have at least one address
558 to use the corresponding protocol.  It is possible to have several
559 different addresses attached to one device.  These addresses are not
560 discriminated, so that the term
561 .B alias
562 is not quite appropriate for them and we do not use it in this document.
565 .B ip addr
566 command displays addresses and their properties, adds new addresses
567 and deletes old ones.
569 .SS ip address add - add new protocol address.
572 .BI dev " NAME"
573 the name of the device to add the address to.
576 .BI local " ADDRESS " (default)
577 the address of the interface. The format of the address depends
578 on the protocol. It is a dotted quad for IP and a sequence of
579 hexadecimal halfwords separated by colons for IPv6.  The
580 .I ADDRESS
581 may be followed by a slash and a decimal number which encodes
582 the network prefix length.
585 .BI peer " ADDRESS"
586 the address of the remote endpoint for pointopoint interfaces.
587 Again, the
588 .I ADDRESS
589 may be followed by a slash and a decimal number, encoding the network
590 prefix length.  If a peer address is specified, the local address
591 cannot have a prefix length.  The network prefix is associated
592 with the peer rather than with the local address.
595 .BI broadcast " ADDRESS"
596 the broadcast address on the interface.
598 It is possible to use the special symbols
599 .B '+'
601 .B '-'
602 instead of the broadcast address.  In this case, the broadcast address
603 is derived by setting/resetting the host bits of the interface prefix.
606 .BI label " NAME"
607 Each address may be tagged with a label string.
608 In order to preserve compatibility with Linux-2.0 net aliases,
609 this string must coincide with the name of the device or must be prefixed
610 with the device name followed by colon.
613 .BI scope " SCOPE_VALUE"
614 the scope of the area where this address is valid.
615 The available scopes are listed in file
616 .BR "/etc/iproute2/rt_scopes" .
617 Predefined scope values are:
619 .in +8
620 .B global
621 - the address is globally valid.
623 .B site
624 - (IPv6 only) the address is site local, i.e. it is
625 valid inside this site.
627 .B link
628 - the address is link local, i.e. it is valid only on this device.
630 .B host
631 - the address is valid only inside this host.
632 .in -8
634 .SS ip address delete - delete protocol address
635 .B Arguments:
636 coincide with the arguments of
637 .B ip addr add.
638 The device name is a required argument.  The rest are optional.
639 If no arguments are given, the first address is deleted.
641 .SS ip address show - look at protocol addresses
644 .BI dev " NAME " (default)
645 name of device.
648 .BI scope " SCOPE_VAL"
649 only list addresses with this scope.
652 .BI to " PREFIX"
653 only list addresses matching this prefix.
656 .BI label " PATTERN"
657 only list addresses with labels matching the
658 .IR "PATTERN" .
659 .I PATTERN
660 is a usual shell style pattern.
663 .BR dynamic " and " permanent
664 (IPv6 only) only list addresses installed due to stateless
665 address configuration or only list permanent (not dynamic)
666 addresses.
669 .B tentative
670 (IPv6 only) only list addresses which did not pass duplicate
671 address detection.
674 .B deprecated
675 (IPv6 only) only list deprecated addresses.
678 .BR primary " and " secondary
679 only list primary (or secondary) addresses.
681 .SS ip address flush - flush protocol addresses
682 This command flushes the protocol addresses selected by some criteria.
685 This command has the same arguments as
686 .B show.
687 The difference is that it does not run when no arguments are given.
690 .B Warning:
691 This command (and other
692 .B flush
693 commands described below) is pretty dangerous.  If you make a mistake,
694 it will not forgive it, but will cruelly purge all the addresses.
697 With the
698 .B -statistics
699 option, the command becomes verbose. It prints out the number of deleted
700 addresses and the number of rounds made to flush the address list.  If
701 this option is given twice,
702 .B ip addr flush
703 also dumps all the deleted addresses in the format described in the
704 previous subsection.
706 .SH ip neighbour - neighbour/arp tables management.
708 .B neighbour
709 objects establish bindings between protocol addresses and
710 link layer addresses for hosts sharing the same link.
711 Neighbour entries are organized into tables. The IPv4 neighbour table
712 is known by another name - the ARP table.
715 The corresponding commands display neighbour bindings
716 and their properties, add new neighbour entries and delete old ones.
718 .SS ip neighbour add - add a new neighbour entry
719 .SS ip neighbour change - change an existing entry
720 .SS ip neighbour replace - add a new entry or change an existing one
722 These commands create new neighbour records or update existing ones.
725 .BI to " ADDRESS " (default)
726 the protocol address of the neighbour. It is either an IPv4 or IPv6 address.
729 .BI dev " NAME"
730 the interface to which this neighbour is attached.
733 .BI lladdr " LLADDRESS"
734 the link layer address of the neighbour.
735 .I LLADDRESS
736 can also be
737 .BR "null" .
740 .BI nud " NUD_STATE"
741 the state of the neighbour entry.
742 .B nud
743 is an abbreviation for 'Neigh bour Unreachability Detection'.
744 The state can take one of the following values:
746 .in +8
747 .B permanent
748 - the neighbour entry is valid forever and can be only
749 be removed administratively.
752 .B noarp
753 - the neighbour entry is valid. No attempts to validate
754 this entry will be made but it can be removed when its lifetime expires.
757 .B reachable
758 - the neighbour entry is valid until the reachability
759 timeout expires.
762 .B stale
763 - the neighbour entry is valid but suspicious.
764 This option to
765 .B ip neigh
766 does not change the neighbour state if it was valid and the address
767 is not changed by this command.
768 .in -8
770 .SS ip neighbour delete - delete a neighbour entry
771 This command invalidates a neighbour entry.
774 The arguments are the same as with
775 .BR "ip neigh add" ,
776 except that
777 .B lladdr
779 .B nud
780 are ignored.
783 .B Warning:
784 Attempts to delete or manually change a
785 .B noarp
786 entry created by the kernel may result in unpredictable behaviour.
787 Particularly, the kernel may try to resolve this address even
788 on a
789 .B NOARP
790 interface or if the address is multicast or broadcast.
792 .SS ip neighbour show - list neighbour entries
794 This commands displays neighbour tables.
797 .BI to " ADDRESS " (default)
798 the prefix selecting the neighbours to list.
801 .BI dev " NAME"
802 only list the neighbours attached to this device.
805 .B unused
806 only list neighbours which are not currently in use.
809 .BI nud " NUD_STATE"
810 only list neighbour entries in this state.
811 .I NUD_STATE
812 takes values listed below or the special value
813 .B all
814 which means all states.  This option may occur more than once.
815 If this option is absent,
816 .B ip
817 lists all entries except for
818 .B none
820 .BR "noarp" .
822 .SS ip neighbour flush - flush neighbour entries
823 This command flushes neighbour tables, selecting
824 entries to flush by some criteria.
827 This command has the same arguments as
828 .B show.
829 The differences are that it does not run when no arguments are given,
830 and that the default neighbour states to be flushed do not include
831 .B permanent
833 .BR "noarp" .
836 With the
837 .B -statistics
838 option, the command becomes verbose.  It prints out the number of
839 deleted neighbours and the number of rounds made to flush the
840 neighbour table.  If the option is given
841 twice,
842 .B ip neigh flush
843 also dumps all the deleted neighbours.
845 .SH ip route - routing table management
846 Manipulate route entries in the kernel routing tables keep
847 information about paths to other networked nodes.
849 .B Route types:
851 .in +8
852 .B unicast
853 - the route entry describes real paths to the destinations covered
854 by the route prefix.
857 .B unreachable
858 - these destinations are unreachable.  Packets are discarded and the
859 ICMP message
860 .I host unreachable
861 is generated.
862 The local senders get an
863 .I EHOSTUNREACH
864 error.
867 .B blackhole
868 - these destinations are unreachable.  Packets are discarded silently.
869 The local senders get an
870 .I EINVAL
871 error.
874 .B prohibit
875 - these destinations are unreachable.  Packets are discarded and the
876 ICMP message
877 .I communication administratively prohibited
878 is generated.  The local senders get an
879 .I EACCES
880 error.
883 .B local
884 - the destinations are assigned to this host.  The packets are looped
885 back and delivered locally.
888 .B broadcast
889 - the destinations are broadcast addresses.  The packets are sent as
890 link broadcasts.
893 .B throw
894 - a special control route used together with policy rules. If such a
895 route is selected, lookup in this table is terminated pretending that
896 no route was found.  Without policy routing it is equivalent to the
897 absence of the route in the routing table.  The packets are dropped
898 and the ICMP message
899 .I net unreachable
900 is generated.  The local senders get an
901 .I ENETUNREACH
902 error.
905 .B nat
906 - a special NAT route.  Destinations covered by the prefix
907 are considered to be dummy (or external) addresses which require translation
908 to real (or internal) ones before forwarding.  The addresses to translate to
909 are selected with the attribute
910 .BR "via" .
913 .B anycast
914 .RI "- " "not implemented"
915 the destinations are
916 .I anycast
917 addresses assigned to this host.  They are mainly equivalent
919 .B local
920 with one difference: such addresses are invalid when used
921 as the source address of any packet.
924 .B multicast
925 - a special type used for multicast routing.  It is not present in
926 normal routing tables.
927 .in -8
930 .B Route tables:
931 Linux-2.x can pack routes into several routing
932 tables identified by a number in the range from 1 to 255 or by
933 name from the file
934 .B /etc/iproute2/rt_tables
935 . By default all normal routes are inserted into the
936 .B main
937 table (ID 254) and the kernel only uses this table when calculating routes.
940 Actually, one other table always exists, which is invisible but
941 even more important.  It is the
942 .B local
943 table (ID 255).  This table
944 consists of routes for local and broadcast addresses.  The kernel maintains
945 this table automatically and the administrator usually need not modify it
946 or even look at it.
948 The multiple routing tables enter the game when
949 .I policy routing
950 is used.
952 .SS ip route add - add new route
953 .SS ip route change - change route
954 .SS ip route replace - change or add new one
957 .BI to " TYPE PREFIX " (default)
958 the destination prefix of the route.  If
959 .I TYPE
960 is omitted,
961 .B ip
962 assumes type
963 .BR "unicast" .
964 Other values of
965 .I TYPE
966 are listed above.
967 .I PREFIX
968 is an IP or IPv6 address optionally followed by a slash and the
969 prefix length.  If the length of the prefix is missing,
970 .B ip
971 assumes a full-length host route.  There is also a special
972 .I PREFIX
973 .B default
974 - which is equivalent to IP
975 .B 0/0
976 or to IPv6
977 .BR "::/0" .
980 .BI tos " TOS"
982 .BI dsfield " TOS"
983 the Type Of Service (TOS) key.  This key has no associated mask and
984 the longest match is understood as: First, compare the TOS
985 of the route and of the packet.  If they are not equal, then the packet
986 may still match a route with a zero TOS.
987 .I TOS
988 is either an 8 bit hexadecimal number or an identifier
989 from
990 .BR "/etc/iproute2/rt_dsfield" .
993 .BI metric " NUMBER"
995 .BI preference " NUMBER"
996 the preference value of the route.
997 .I NUMBER
998 is an arbitrary 32bit number.
1001 .BI table " TABLEID"
1002 the table to add this route to.
1003 .I TABLEID
1004 may be a number or a string from the file
1005 .BR "/etc/iproute2/rt_tables" .
1006 If this parameter is omitted,
1007 .B ip
1008 assumes the
1009 .B main
1010 table, with the exception of
1011 .BR local " , " broadcast " and " nat
1012 routes, which are put into the
1013 .B local
1014 table by default.
1017 .BI dev " NAME"
1018 the output device name.
1021 .BI via " ADDRESS"
1022 the address of the nexthop router.  Actually, the sense of this field
1023 depends on the route type.  For normal
1024 .B unicast
1025 routes it is either the true next hop router or, if it is a direct
1026 route installed in BSD compatibility mode, it can be a local address
1027 of the interface.  For NAT routes it is the first address of the block
1028 of translated IP destinations.
1031 .BI src " ADDRESS"
1032 the source address to prefer when sending to the destinations
1033 covered by the route prefix.
1036 .BI realm " REALMID"
1037 the realm to which this route is assigned.
1038 .I REALMID
1039 may be a number or a string from the file
1040 .BR "/etc/iproute2/rt_realms" .
1043 .BI mtu " MTU"
1045 .BI "mtu lock" " MTU"
1046 the MTU along the path to the destination.  If the modifier
1047 .B lock
1048 is not used, the MTU may be updated by the kernel due to
1049 Path MTU Discovery.  If the modifier
1050 .B lock
1051 is used, no path MTU discovery will be tried, all packets
1052 will be sent without the DF bit in IPv4 case or fragmented
1053 to MTU for IPv6.
1056 .BI window " NUMBER"
1057 the maximal window for TCP to advertise to these destinations,
1058 measured in bytes.  It limits maximal data bursts that our TCP
1059 peers are allowed to send to us.
1062 .BI rtt " NUMBER"
1063 the initial RTT ('Round Trip Time') estimate.
1066 .BI rttvar " NUMBER " "(2.3.15+ only)"
1067 the initial RTT variance estimate.
1070 .BI ssthresh " NUMBER " "(2.3.15+ only)"
1071 an estimate for the initial slow start threshold.
1074 .BI cwnd " NUMBER " "(2.3.15+ only)"
1075 the clamp for congestion window.  It is ignored if the
1076 .B lock
1077 flag is not used.
1080 .BI advmss " NUMBER " "(2.3.15+ only)"
1081 the MSS ('Maximal Segment Size') to advertise to these
1082 destinations when establishing TCP connections.  If it is not given,
1083 Linux uses a default value calculated from the first hop device MTU.
1084 (If the path to these destination is asymmetric, this guess may be wrong.)
1087 .BI reordering " NUMBER " "(2.3.15+ only)"
1088 Maximal reordering on the path to this destination.
1089 If it is not given, Linux uses the value selected with
1090 .B sysctl
1091 variable
1092 .BR "net/ipv4/tcp_reordering" .
1095 .BI nexthop " NEXTHOP"
1096 the nexthop of a multipath route.
1097 .I NEXTHOP
1098 is a complex value with its own syntax similar to the top level
1099 argument lists:
1101 .in +8
1102 .BI via " ADDRESS"
1103 - is the nexthop router.
1106 .BI dev " NAME"
1107 - is the output device.
1110 .BI weight " NUMBER"
1111 - is a weight for this element of a multipath
1112 route reflecting its relative bandwidth or quality.
1113 .in -8
1116 .BI scope " SCOPE_VAL"
1117 the scope of the destinations covered by the route prefix.
1118 .I SCOPE_VAL
1119 may be a number or a string from the file
1120 .BR "/etc/iproute2/rt_scopes" .
1121 If this parameter is omitted,
1122 .B ip
1123 assumes scope
1124 .B global
1125 for all gatewayed
1126 .B unicast
1127 routes, scope
1128 .B link
1129 for direct
1130 .BR unicast " and " broadcast
1131 routes and scope
1132 .BR host " for " local
1133 routes.
1136 .BI protocol " RTPROTO"
1137 the routing protocol identifier of this route.
1138 .I RTPROTO
1139 may be a number or a string from the file
1140 .BR "/etc/iproute2/rt_protos" .
1141 If the routing protocol ID is not given,
1142 .B ip assumes protocol
1143 .B boot
1144 (i.e. it assumes the route was added by someone who doesn't
1145 understand what they are doing).  Several protocol values have
1146 a fixed interpretation.
1147 Namely:
1149 .in +8
1150 .B redirect
1151 - the route was installed due to an ICMP redirect.
1154 .B kernel
1155 - the route was installed by the kernel during autoconfiguration.
1158 .B boot
1159 - the route was installed during the bootup sequence.
1160 If a routing daemon starts, it will purge all of them.
1163 .B static
1164 - the route was installed by the administrator
1165 to override dynamic routing. Routing daemon will respect them
1166 and, probably, even advertise them to its peers.
1169 .B ra
1170 - the route was installed by Router Discovery protocol.
1171 .in -8
1174 The rest of the values are not reserved and the administrator is free
1175 to assign (or not to assign) protocol tags.
1178 .B onlink
1179 pretend that the nexthop is directly attached to this link,
1180 even if it does not match any interface prefix.
1183 .B equalize
1184 allow packet by packet randomization on multipath routes.
1185 Without this modifier, the route will be frozen to one selected
1186 nexthop, so that load splitting will only occur on per-flow base.
1187 .B equalize
1188 only works if the kernel is patched.
1190 .SS ip route delete - delete route
1192 .B ip route del
1193 has the same arguments as
1194 .BR "ip route add" ,
1195 but their semantics are a bit different.
1197 Key values
1198 .RB "(" to ", " tos ", " preference " and " table ")"
1199 select the route to delete.  If optional attributes are present,
1200 .B ip
1201 verifies that they coincide with the attributes of the route to delete.
1202 If no route with the given key and attributes was found,
1203 .B ip route del
1204 fails.
1206 .SS ip route show - list routes
1207 the command displays the contents of the routing tables or the route(s)
1208 selected by some criteria.
1211 .BI to " SELECTOR " (default)
1212 only select routes from the given range of destinations.
1213 .I SELECTOR
1214 consists of an optional modifier
1215 .RB "(" root ", " match " or " exact ")"
1216 and a prefix.
1217 .BI root " PREFIX"
1218 selects routes with prefixes not shorter than
1219 .IR PREFIX "."
1220 F.e.
1221 .BI root " 0/0"
1222 selects the entire routing table.
1223 .BI match " PREFIX"
1224 selects routes with prefixes not longer than
1225 .IR PREFIX "."
1226 F.e.
1227 .BI match " 10.0/16"
1228 selects
1229 .IR 10.0/16 ","
1230 .IR 10/8 " and " 0/0 ,
1231 but it does not select
1232 .IR 10.1/16 " and " 10.0.0/24 .
1234 .BI exact " PREFIX"
1235 (or just
1236 .IR PREFIX ")"
1237 selects routes with this exact prefix. If neither of these options
1238 are present,
1239 .B ip
1240 assumes
1241 .BI root " 0/0"
1242 i.e. it lists the entire table.
1245 .BI tos " TOS"
1246 .BI dsfield " TOS"
1247 only select routes with the given TOS.
1250 .BI table " TABLEID"
1251 show the routes from this table(s).  The default setting is to show
1252 .BR table main "."
1253 .I TABLEID
1254 may either be the ID of a real table or one of the special values:
1256 .in +8
1257 .B all
1258 - list all of the tables.
1260 .B cache
1261 - dump the routing cache.
1262 .in -8
1265 .B cloned
1267 .B cached
1268 list cloned routes i.e. routes which were dynamically forked from
1269 other routes because some route attribute (f.e. MTU) was updated.
1270 Actually, it is equivalent to
1271 .BR "table cache" "."
1274 .BI from " SELECTOR"
1275 the same syntax as for
1276 .BR to ","
1277 but it binds the source address range rather than destinations.
1278 Note that the
1279 .B from
1280 option only works with cloned routes.
1283 .BI protocol " RTPROTO"
1284 only list routes of this protocol.
1287 .BI scope " SCOPE_VAL"
1288 only list routes with this scope.
1291 .BI type " TYPE"
1292 only list routes of this type.
1295 .BI dev " NAME"
1296 only list routes going via this device.
1299 .BI via " PREFIX"
1300 only list routes going via the nexthop routers selected by
1301 .IR PREFIX "."
1304 .BI src " PREFIX"
1305 only list routes with preferred source addresses selected
1307 .IR PREFIX "."
1310 .BI realm " REALMID"
1312 .BI realms " FROMREALM/TOREALM"
1313 only list routes with these realms.
1315 .SS ip route flush - flush routing tables
1316 this command flushes routes selected by some criteria.
1319 The arguments have the same syntax and semantics as the arguments of
1320 .BR "ip route show" ,
1321 but routing tables are not listed but purged.  The only difference is
1322 the default action:
1323 .B show
1324 dumps all the IP main routing table but
1325 .B flush
1326 prints the helper page.
1329 With the
1330 .B -statistics
1331 option, the command becomes verbose. It prints out the number of
1332 deleted routes and the number of rounds made to flush the routing
1333 table. If the option is given
1334 twice,
1335 .B ip route flush
1336 also dumps all the deleted routes in the format described in the
1337 previous subsection.
1339 .SS ip route get - get a single route
1340 this command gets a single route to a destination and prints its
1341 contents exactly as the kernel sees it.
1344 .BI to " ADDRESS " (default)
1345 the destination address.
1348 .BI from " ADDRESS"
1349 the source address.
1352 .BI tos " TOS"
1354 .BI dsfield " TOS"
1355 the Type Of Service.
1358 .BI iif " NAME"
1359 the device from which this packet is expected to arrive.
1362 .BI oif " NAME"
1363 force the output device on which this packet will be routed.
1366 .B connected
1367 if no source address 
1368 .RB "(option " from ")"
1369 was given, relookup the route with the source set to the preferred
1370 address received from the first lookup.
1371 If policy routing is used, it may be a different route.
1374 Note that this operation is not equivalent to
1375 .BR "ip route show" .
1376 .B show
1377 shows existing routes.
1378 .B get
1379 resolves them and creates new clones if necessary.  Essentially,
1380 .B get
1381 is equivalent to sending a packet along this path.
1382 If the
1383 .B iif
1384 argument is not given, the kernel creates a route
1385 to output packets towards the requested destination.
1386 This is equivalent to pinging the destination
1387 with a subsequent
1388 .BR "ip route ls cache" ,
1389 however, no packets are actually sent.  With the
1390 .B iif
1391 argument, the kernel pretends that a packet arrived from this interface
1392 and searches for a path to forward the packet.
1394 .SH ip rule - routing policy database management
1396 .BR "Rule" s
1397 in the routing policy database control the route selection algorithm.
1400 Classic routing algorithms used in the Internet make routing decisions
1401 based only on the destination address of packets (and in theory,
1402 but not in practice, on the TOS field).
1405 In some circumstances we want to route packets differently depending not only
1406 on destination addresses, but also on other packet fields: source address,
1407 IP protocol, transport protocol ports or even packet payload.
1408 This task is called 'policy routing'.
1411 To solve this task, the conventional destination based routing table, ordered
1412 according to the longest match rule, is replaced with a 'routing policy
1413 database' (or RPDB), which selects routes by executing some set of rules.
1416 Each policy routing rule consists of a
1417 .B selector
1418 and an
1419 .B action predicate.
1420 The RPDB is scanned in the order of increasing priority. The selector
1421 of each rule is applied to {source address, destination address, incoming
1422 interface, tos, fwmark} and, if the selector matches the packet,
1423 the action is performed.  The action predicate may return with success.
1424 In this case, it will either give a route or failure indication
1425 and the RPDB lookup is terminated. Otherwise, the RPDB program
1426 continues on the next rule.
1429 Semantically, natural action is to select the nexthop and the output device.
1432 At startup time the kernel configures the default RPDB consisting of three
1433 rules:
1437 Priority: 0, Selector: match anything, Action: lookup routing
1438 table
1439 .B local
1440 (ID 255).
1442 .B local
1443 table is a special routing table containing
1444 high priority control routes for local and broadcast addresses.
1446 Rule 0 is special. It cannot be deleted or overridden.
1450 Priority: 32766, Selector: match anything, Action: lookup routing
1451 table
1452 .B main
1453 (ID 254).
1455 .B main
1456 table is the normal routing table containing all non-policy
1457 routes. This rule may be deleted and/or overridden with other
1458 ones by the administrator.
1462 Priority: 32767, Selector: match anything, Action: lookup routing
1463 table
1464 .B default
1465 (ID 253).
1467 .B default
1468 table is empty.  It is reserved for some post-processing if no previous
1469 default rules selected the packet.
1470 This rule may also be deleted.
1473 Each RPDB entry has additional
1474 attributes.  F.e. each rule has a pointer to some routing
1475 table.  NAT and masquerading rules have an attribute to select new IP
1476 address to translate/masquerade.  Besides that, rules have some
1477 optional attributes, which routes have, namely
1478 .BR "realms" .
1479 These values do not override those contained in the routing tables.  They
1480 are only used if the route did not select any attributes.
1483 The RPDB may contain rules of the following types:
1485 .in +8
1486 .B unicast
1487 - the rule prescribes to return the route found
1488 in the routing table referenced by the rule.
1490 .B blackhole
1491 - the rule prescribes to silently drop the packet.
1493 .B unreachable
1494 - the rule prescribes to generate a 'Network is unreachable' error.
1496 .B prohibit
1497 - the rule prescribes to generate 'Communication is administratively
1498 prohibited' error.
1500 .B nat
1501 - the rule prescribes to translate the source address
1502 of the IP packet into some other value.
1503 .in -8
1505 .SS ip rule add - insert a new rule
1506 .SS ip rule delete - delete a rule
1509 .BI type " TYPE " (default)
1510 the type of this rule.  The list of valid types was given in the previous
1511 subsection.
1514 .BI from " PREFIX"
1515 select the source prefix to match.
1518 .BI to " PREFIX"
1519 select the destination prefix to match.
1522 .BI iif " NAME"
1523 select the incoming device to match.  If the interface is loopback,
1524 the rule only matches packets originating from this host.  This means
1525 that you may create separate routing tables for forwarded and local
1526 packets and, hence, completely segregate them.
1529 .BI tos " TOS"
1531 .BI dsfield " TOS"
1532 select the TOS value to match.
1535 .BI fwmark " MARK"
1536 select the
1537 .B fwmark
1538 value to match.
1541 .BI priority " PREFERENCE"
1542 the priority of this rule.  Each rule should have an explicitly
1544 .I unique
1545 priority value.
1548 .BI table " TABLEID"
1549 the routing table identifier to lookup if the rule selector matches.
1552 .BI realms " FROM/TO"
1553 Realms to select if the rule matched and the routing table lookup
1554 succeeded.  Realm 
1555 .I TO
1556 is only used if the route did not select any realm.
1559 .BI nat " ADDRESS"
1560 The base of the IP address block to translate (for source addresses).
1561 The 
1562 .I ADDRESS
1563 may be either the start of the block of NAT addresses (selected by NAT
1564 routes) or a local host address (or even zero).
1565 In the last case the router does not translate the packets, but
1566 masquerades them to this address.
1568 .B Warning:
1569 Changes to the RPDB made with these commands do not become active
1570 immediately.  It is assumed that after a script finishes a batch of
1571 updates, it flushes the routing cache with
1572 .BR "ip route flush cache" .
1574 .SS ip rule show - list rules
1575 This command has no arguments.
1577 .SH ip maddress - multicast addresses management
1579 .B maddress
1580 objects are multicast addresses.
1582 .SS ip maddress show - list multicast addresses
1585 .BI dev " NAME " (default)
1586 the device name.
1588 .SS ip maddress add - add a multicast address
1589 .SS ip maddress delete - delete a multicast address
1590 these commands attach/detach a static link layer multicast address
1591 to listen on the interface.
1592 Note that it is impossible to join protocol multicast groups
1593 statically.  This command only manages link layer addresses.
1596 .BI address " LLADDRESS " (default)
1597 the link layer multicast address.
1600 .BI dev " NAME"
1601 the device to join/leave this multicast address.
1603 .SH ip mroute - multicast routing cache management
1604 .B mroute
1605 objects are multicast routing cache entries created by a user level
1606 mrouting daemon (f.e.
1607 .B pimd
1609 .B mrouted
1612 Due to the limitations of the current interface to the multicast routing
1613 engine, it is impossible to change
1614 .B mroute
1615 objects administratively, so we may only display them.  This limitation
1616 will be removed in the future.
1618 .SS ip mroute show - list mroute cache entries
1621 .BI to " PREFIX " (default)
1622 the prefix selecting the destination multicast addresses to list.
1625 .BI iif " NAME"
1626 the interface on which multicast packets are received.
1629 .BI from " PREFIX"
1630 the prefix selecting the IP source addresses of the multicast route.
1632 .SH ip tunnel - tunnel configuration
1633 .B tunnel
1634 objects are tunnels, encapsulating packets in IPv4 packets and then
1635 sending them over the IP infrastructure.
1637 .SS ip tunnel add - add a new tunnel
1638 .SS ip tunnel change - change an existing tunnel
1639 .SS ip tunnel delete - destroy a tunnel
1642 .BI name " NAME " (default)
1643 select the tunnel device name.
1646 .BI mode " MODE"
1647 set the tunnel mode.  Three modes are currently available:
1648 .BR ipip ", " sit " and " gre "."
1651 .BI remote " ADDRESS"
1652 set the remote endpoint of the tunnel.
1655 .BI local " ADDRESS"
1656 set the fixed local address for tunneled packets.
1657 It must be an address on another interface of this host.
1660 .BI ttl " N"
1661 set a fixed TTL 
1662 .I N
1663 on tunneled packets.
1664 .I N
1665 is a number in the range 1--255. 0 is a special value
1666 meaning that packets inherit the TTL value. 
1667 The default value is:
1668 .BR "inherit" .
1671 .BI tos " T"
1673 .BI dsfield " T"
1674 set a fixed TOS
1675 .I T
1676 on tunneled packets.
1677 The default value is:
1678 .BR "inherit" .
1681 .BI dev " NAME" 
1682 bind the tunnel to the device
1683 .I NAME
1684 so that tunneled packets will only be routed via this device and will
1685 not be able to escape to another device when the route to endpoint
1686 changes.
1689 .B nopmtudisc
1690 disable Path MTU Discovery on this tunnel.
1691 It is enabled by default.  Note that a fixed ttl is incompatible
1692 with this option: tunnelling with a fixed ttl always makes pmtu
1693 discovery.
1696 .BI key " K"
1698 .BI ikey " K"
1700 .BI okey " K"
1701 .RB ( " only GRE tunnels " )
1702 use keyed GRE with key
1703 .IR K ". " K
1704 is either a number or an IP address-like dotted quad.
1706 .B key
1707 parameter sets the key to use in both directions.
1709 .BR ikey " and " okey
1710 parameters set different keys for input and output.
1711    
1713 .BR csum ", " icsum ", " ocsum
1714 .RB ( " only GRE tunnels " )
1715 generate/require checksums for tunneled packets.
1716 The 
1717 .B ocsum
1718 flag calculates checksums for outgoing packets.
1720 .B icsum
1721 flag requires that all input packets have the correct
1722 checksum.  The
1723 .B csum
1724 flag is equivalent to the combination
1725 .BR "icsum ocsum" .
1728 .BR seq ", " iseq ", " oseq
1729 .RB ( " only GRE tunnels " )
1730 serialize packets.
1732 .B oseq
1733 flag enables sequencing of outgoing packets.
1735 .B iseq
1736 flag requires that all input packets are serialized.
1738 .B  seq
1739 flag is equivalent to the combination 
1740 .BR "iseq oseq" .
1741 .B It isn't work. Don't use it.
1743 .SS ip tunnel show - list tunnels
1744 This command has no arguments.
1746 .SH ip monitor and rtmon - state monitoring
1749 .B ip
1750 utility can monitor the state of devices, addresses
1751 and routes continuously.  This option has a slightly different format.
1752 Namely, the
1753 .B monitor
1754 command is the first in the command line and then the object list follows:
1756 .BR "ip monitor" " [ " all " |"
1757 .IR LISTofOBJECTS " ]"
1759 .I OBJECT-LIST
1760 is the list of object types that we want to monitor.
1761 It may contain
1762 .BR link ", " address " and " route "."
1763 If no
1764 .B file
1765 argument is given,
1766 .B ip
1767 opens RTNETLINK, listens on it and dumps state changes in the format
1768 described in previous sections.
1771 If a file name is given, it does not listen on RTNETLINK,
1772 but opens the file containing RTNETLINK messages saved in binary format
1773 and dumps them.  Such a history file can be generated with the
1774 .B rtmon
1775 utility.  This utility has a command line syntax similar to
1776 .BR "ip monitor" .
1777 Ideally,
1778 .B rtmon
1779 should be started before the first network configuration command
1780 is issued. F.e. if you insert:
1782 .in +8
1783 rtmon file /var/log/rtmon.log
1784 .in -8
1786 in a startup script, you will be able to view the full history
1787 later.
1790 Certainly, it is possible to start
1791 .B rtmon
1792 at any time.
1793 It prepends the history with the state snapshot dumped at the moment
1794 of starting.
1796 .SH HISTORY
1798 .B ip
1799 was written by Alexey N. Kuznetsov and added in Linux 2.2.
1800 .SH SEE ALSO
1801 .BR tc (8)
1803 .RB "IP Command reference " ip-cref.ps
1805 .RB "IP tunnels " ip-cref.ps
1807 .SH AUTHOR
1809 Manpage maintained by Michail Litvak <mci@owl.openwall.com>