1 .TH IP 8 "17 January 2002" "iproute2" "Linux"
3 ip \- show / manipulate routing, devices, policy routing and tunnels
10 .RI "[ " OPTIONS " ] " OBJECT " { " COMMAND " | "
16 .BR link " | " addr " | " addrlabel " | " route " | " rule " | " neigh " | "\
17 tunnel " | " maddr " | " mroute " | " monitor " }"
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] }
30 .BI "ip link set " DEVICE
31 .RB "{ " up " | " down " | " arp " { " on " | " off " } |"
33 .BR promisc " { " on " | " off " } |"
35 .BR allmulticast " { " on " | " off " } |"
37 .BR dynamic " { " on " | " off " } |"
39 .BR multicast " { " on " | " off " } |"
60 .BR "ip addr" " { " add " | " del " } "
61 .IB IFADDR " dev " STRING
64 .BR "ip addr" " { " show " | " flush " } [ " dev
69 .IR PREFIX " ] [ " FLAG-LIST " ] [ "
74 .IR IFADDR " := " PREFIX " | " ADDR
88 .RB "[ " host " | " link " | " global " | "
92 .IR FLAG-LIST " := [ " FLAG-LIST " ] " FLAG
96 .RB "[ " permanent " | " dynamic " | " secondary " | " primary " | "\
97 tentative " | " deprecated " ]"
100 .BR "ip addrlabel" " { " add " | " del " } " prefix
108 .BR "ip addrlabel" " { " list " | " flush " }"
112 .BR list " | " flush " } "
118 .BI from " ADDRESS " iif " STRING"
125 .BR "ip route" " { " add " | " del " | " change " | " append " | "\
126 replace " | " monitor " } "
147 .IR ROUTE " := " NODE_SPEC " [ " INFO_SPEC " ]"
150 .IR NODE_SPEC " := [ " TYPE " ] " PREFIX " ["
163 .IR INFO_SPEC " := " "NH OPTIONS FLAGS" " ["
174 .IR NUMBER " ] " NHFLAGS
177 .IR OPTIONS " := " FLAGS " [ "
199 .BR unicast " | " local " | " broadcast " | " multicast " | "\
200 throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]"
203 .IR TABLE_ID " := [ "
204 .BR local "| " main " | " default " | " all " |"
209 .BR host " | " link " | " global " |"
218 .BR onlink " | " pervasive " ]"
222 .BR kernel " | " boot " | " static " |"
227 .RB " [ " list " | " add " | " del " | " flush " ]"
231 .IR SELECTOR " := [ "
239 .IR FWMARK[/MASK] " ] [ "
251 .BR prohibit " | " reject " | " unreachable " ] [ " realms
252 .RI "[" SRCREALM "/]" DSTREALM " ]"
255 .IR TABLE_ID " := [ "
256 .BR local " | " main " | " default " |"
260 .BR "ip neigh" " { " add " | " del " | " change " | " replace " } { "
264 .BR nud " { " permanent " | " noarp " | " stale " | " reachable " } ] | " proxy
270 .BR "ip neigh" " { " show " | " flush " } [ " to
278 .BR "ip tunnel" " { " add " | " change " | " del " | " show " }"
288 .RB "[ [" i "|" o "]" seq " ] [ [" i "|" o "]" key
290 .RB "[" i "|" o "]" csum " ] ]"
302 .RB "[ [" no "]" pmtudisc " ]"
305 .RB "[ " "dscp inherit" " ]"
309 .RB " { " ipip " | " gre " | " sit " | " isatap " | " ip6ip6 " | " ipip6 " | " any " }"
312 .IR ADDR " := { " IP_ADDRESS " |"
316 .IR TOS " := { " NUMBER " |"
326 .IR TTL " := { " 1 ".." 255 " | "
330 .IR KEY " := { " DOTTED_QUAD " | " NUMBER " }"
333 .IR TIME " := " NUMBER "[s|ms|us|ns|j]"
336 .BR "ip maddr" " [ " add " | " del " ]"
337 .IB MULTIADDR " dev " STRING
340 .BR "ip maddr show" " [ " dev
344 .BR "ip mroute show" " ["
352 .BR "ip monitor" " [ " all " |"
353 .IR LISTofOBJECTS " ]"
360 .BR "\-V" , " -Version"
361 print the version of the
366 .BR "\-s" , " \-stats", " \-statistics"
367 output more information. If the option
368 appears twice or more, the amount of information increases.
369 As a rule, the information is statistics or some time values.
372 .BR "\-f" , " \-family"
373 followed by protocol family identifier:
374 .BR "inet" , " inet6"
377 ,enforce the protocol family to use. If the option is not present,
378 the protocol family is guessed from other arguments. If the rest
379 of the command line does not give enough information to guess the
382 falls back to the default one, usually
387 is a special family identifier meaning that no networking protocol
398 .BR "\-family inet6" .
403 .BR "\-family link" .
406 .BR "\-o" , " \-oneline"
407 output each record on a single line, replacing line feeds
410 character. This is convenient when you want to count records
418 .BR "\-r" , " \-resolve"
419 use the system's name resolver to print DNS names instead of
422 .SH IP - COMMAND SYNTAX
433 - protocol (IP or IPv6) address on a device.
437 - label configuration for protocol address selection.
441 - ARP or NDISC cache entry.
445 - routing table entry.
449 - rule in routing policy database.
457 - multicast routing cache entry.
464 The names of all objects may be written in full or
465 abbreviated form, f.e.
475 Specifies the action to perform on the object.
476 The set of possible actions depends on the object type.
477 As a rule, it is possible to
478 .BR "add" , " delete"
483 ) objects, but some objects do not allow all of these operations
484 or have some additional commands. The
486 command is available for all objects. It prints
487 out a list of available commands and argument syntax conventions.
489 If no command is given, some default command is assumed.
492 or, if the objects of this class cannot be listed,
495 .SH ip link - network device configuration
498 is a network device and the corresponding commands
499 display and change the state of devices.
501 .SS ip link set - change device attributes
504 .BI dev " NAME " (default)
506 specifies network device to operate on.
510 change the state of the device to
516 .BR "arp on " or " arp off"
522 .BR "multicast on " or " multicast off"
528 .BR "dynamic on " or " dynamic off"
535 change the name of the device. This operation is not
536 recommended if the device is running or has some addresses
540 .BI txqueuelen " NUMBER"
543 change the transmit queue length of the device.
552 .BI address " LLADDRESS"
553 change the station address of the interface.
556 .BI broadcast " LLADDRESS"
560 .BI peer " LLADDRESS"
561 change the link layer broadcast address or the peer address when
567 If multiple parameter changes are requested,
569 aborts immediately after any of the changes have failed.
570 This is the only case when
572 can move the system to an unpredictable state. The solution
573 is to avoid changing several parameters with one
577 .SS ip link show - display device attributes
580 .BI dev " NAME " (default)
582 specifies the network device to show.
583 If this argument is omitted all devices are listed.
587 only display running interfaces.
589 .SH ip address - protocol address management.
593 is a protocol (IP or IPv6) address attached
594 to a network device. Each device must have at least one address
595 to use the corresponding protocol. It is possible to have several
596 different addresses attached to one device. These addresses are not
597 discriminated, so that the term
599 is not quite appropriate for them and we do not use it in this document.
603 command displays addresses and their properties, adds new addresses
604 and deletes old ones.
606 .SS ip address add - add new protocol address.
610 the name of the device to add the address to.
613 .BI local " ADDRESS " (default)
614 the address of the interface. The format of the address depends
615 on the protocol. It is a dotted quad for IP and a sequence of
616 hexadecimal halfwords separated by colons for IPv6. The
618 may be followed by a slash and a decimal number which encodes
619 the network prefix length.
623 the address of the remote endpoint for pointopoint interfaces.
626 may be followed by a slash and a decimal number, encoding the network
627 prefix length. If a peer address is specified, the local address
628 cannot have a prefix length. The network prefix is associated
629 with the peer rather than with the local address.
632 .BI broadcast " ADDRESS"
633 the broadcast address on the interface.
635 It is possible to use the special symbols
639 instead of the broadcast address. In this case, the broadcast address
640 is derived by setting/resetting the host bits of the interface prefix.
644 Each address may be tagged with a label string.
645 In order to preserve compatibility with Linux-2.0 net aliases,
646 this string must coincide with the name of the device or must be prefixed
647 with the device name followed by colon.
650 .BI scope " SCOPE_VALUE"
651 the scope of the area where this address is valid.
652 The available scopes are listed in file
653 .BR "/etc/iproute2/rt_scopes" .
654 Predefined scope values are:
658 - the address is globally valid.
661 - (IPv6 only) the address is site local, i.e. it is
662 valid inside this site.
665 - the address is link local, i.e. it is valid only on this device.
668 - the address is valid only inside this host.
671 .SS ip address delete - delete protocol address
673 coincide with the arguments of
675 The device name is a required argument. The rest are optional.
676 If no arguments are given, the first address is deleted.
678 .SS ip address show - look at protocol addresses
681 .BI dev " NAME " (default)
685 .BI scope " SCOPE_VAL"
686 only list addresses with this scope.
690 only list addresses matching this prefix.
694 only list addresses with labels matching the
697 is a usual shell style pattern.
700 .BR dynamic " and " permanent
701 (IPv6 only) only list addresses installed due to stateless
702 address configuration or only list permanent (not dynamic)
707 (IPv6 only) only list addresses which did not pass duplicate
712 (IPv6 only) only list deprecated addresses.
715 .BR primary " and " secondary
716 only list primary (or secondary) addresses.
718 .SS ip address flush - flush protocol addresses
719 This command flushes the protocol addresses selected by some criteria.
722 This command has the same arguments as
724 The difference is that it does not run when no arguments are given.
728 This command (and other
730 commands described below) is pretty dangerous. If you make a mistake,
731 it will not forgive it, but will cruelly purge all the addresses.
736 option, the command becomes verbose. It prints out the number of deleted
737 addresses and the number of rounds made to flush the address list. If
738 this option is given twice,
740 also dumps all the deleted addresses in the format described in the
743 .SH ip addrlabel - protocol address label management.
745 IPv6 address label is used for address selection
746 described in RFC 3484. Precedence is managed by userspace,
747 and only label is stored in kernel.
749 .SS ip addrlabel add - add an address label
750 the command adds an address label entry to the kernel.
755 the outgoing interface.
758 the label for the prefix.
759 0xffffffff is reserved.
760 .SS ip addrlabel del - delete an address label
761 the command deletes an address label entry in the kernel.
763 coincide with the arguments of
765 but label is not required.
766 .SS ip addrlabel list - list address labels
767 the command show contents of address labels.
768 .SS ip addrlabel flush - flush address labels
769 the commoand flushes the contents of address labels and it does not restore default settings.
770 .SH ip neighbour - neighbour/arp tables management.
773 objects establish bindings between protocol addresses and
774 link layer addresses for hosts sharing the same link.
775 Neighbour entries are organized into tables. The IPv4 neighbour table
776 is known by another name - the ARP table.
779 The corresponding commands display neighbour bindings
780 and their properties, add new neighbour entries and delete old ones.
782 .SS ip neighbour add - add a new neighbour entry
783 .SS ip neighbour change - change an existing entry
784 .SS ip neighbour replace - add a new entry or change an existing one
786 These commands create new neighbour records or update existing ones.
789 .BI to " ADDRESS " (default)
790 the protocol address of the neighbour. It is either an IPv4 or IPv6 address.
794 the interface to which this neighbour is attached.
797 .BI lladdr " LLADDRESS"
798 the link layer address of the neighbour.
805 the state of the neighbour entry.
807 is an abbreviation for 'Neigh bour Unreachability Detection'.
808 The state can take one of the following values:
812 - the neighbour entry is valid forever and can be only
813 be removed administratively.
817 - the neighbour entry is valid. No attempts to validate
818 this entry will be made but it can be removed when its lifetime expires.
822 - the neighbour entry is valid until the reachability
827 - the neighbour entry is valid but suspicious.
830 does not change the neighbour state if it was valid and the address
831 is not changed by this command.
834 .SS ip neighbour delete - delete a neighbour entry
835 This command invalidates a neighbour entry.
838 The arguments are the same as with
848 Attempts to delete or manually change a
850 entry created by the kernel may result in unpredictable behaviour.
851 Particularly, the kernel may try to resolve this address even
854 interface or if the address is multicast or broadcast.
856 .SS ip neighbour show - list neighbour entries
858 This commands displays neighbour tables.
861 .BI to " ADDRESS " (default)
862 the prefix selecting the neighbours to list.
866 only list the neighbours attached to this device.
870 only list neighbours which are not currently in use.
874 only list neighbour entries in this state.
876 takes values listed below or the special value
878 which means all states. This option may occur more than once.
879 If this option is absent,
881 lists all entries except for
886 .SS ip neighbour flush - flush neighbour entries
887 This command flushes neighbour tables, selecting
888 entries to flush by some criteria.
891 This command has the same arguments as
893 The differences are that it does not run when no arguments are given,
894 and that the default neighbour states to be flushed do not include
902 option, the command becomes verbose. It prints out the number of
903 deleted neighbours and the number of rounds made to flush the
904 neighbour table. If the option is given
907 also dumps all the deleted neighbours.
909 .SH ip route - routing table management
910 Manipulate route entries in the kernel routing tables keep
911 information about paths to other networked nodes.
917 - the route entry describes real paths to the destinations covered
922 - these destinations are unreachable. Packets are discarded and the
926 The local senders get an
932 - these destinations are unreachable. Packets are discarded silently.
933 The local senders get an
939 - these destinations are unreachable. Packets are discarded and the
941 .I communication administratively prohibited
942 is generated. The local senders get an
948 - the destinations are assigned to this host. The packets are looped
949 back and delivered locally.
953 - the destinations are broadcast addresses. The packets are sent as
958 - a special control route used together with policy rules. If such a
959 route is selected, lookup in this table is terminated pretending that
960 no route was found. Without policy routing it is equivalent to the
961 absence of the route in the routing table. The packets are dropped
964 is generated. The local senders get an
970 - a special NAT route. Destinations covered by the prefix
971 are considered to be dummy (or external) addresses which require translation
972 to real (or internal) ones before forwarding. The addresses to translate to
973 are selected with the attribute
975 Route NAT is no longer supported in Linux 2.6.
981 .RI "- " "not implemented"
984 addresses assigned to this host. They are mainly equivalent
987 with one difference: such addresses are invalid when used
988 as the source address of any packet.
992 - a special type used for multicast routing. It is not present in
993 normal routing tables.
998 Linux-2.x can pack routes into several routing
999 tables identified by a number in the range from 1 to 255 or by
1001 .B /etc/iproute2/rt_tables
1002 By default all normal routes are inserted into the
1004 table (ID 254) and the kernel only uses this table when calculating routes.
1007 Actually, one other table always exists, which is invisible but
1008 even more important. It is the
1010 table (ID 255). This table
1011 consists of routes for local and broadcast addresses. The kernel maintains
1012 this table automatically and the administrator usually need not modify it
1015 The multiple routing tables enter the game when
1019 .SS ip route add - add new route
1020 .SS ip route change - change route
1021 .SS ip route replace - change or add new one
1024 .BI to " TYPE PREFIX " (default)
1025 the destination prefix of the route. If
1035 is an IP or IPv6 address optionally followed by a slash and the
1036 prefix length. If the length of the prefix is missing,
1038 assumes a full-length host route. There is also a special
1041 - which is equivalent to IP
1050 the Type Of Service (TOS) key. This key has no associated mask and
1051 the longest match is understood as: First, compare the TOS
1052 of the route and of the packet. If they are not equal, then the packet
1053 may still match a route with a zero TOS.
1055 is either an 8 bit hexadecimal number or an identifier
1057 .BR "/etc/iproute2/rt_dsfield" .
1060 .BI metric " NUMBER"
1062 .BI preference " NUMBER"
1063 the preference value of the route.
1065 is an arbitrary 32bit number.
1068 .BI table " TABLEID"
1069 the table to add this route to.
1071 may be a number or a string from the file
1072 .BR "/etc/iproute2/rt_tables" .
1073 If this parameter is omitted,
1077 table, with the exception of
1078 .BR local " , " broadcast " and " nat
1079 routes, which are put into the
1085 the output device name.
1089 the address of the nexthop router. Actually, the sense of this field
1090 depends on the route type. For normal
1092 routes it is either the true next hop router or, if it is a direct
1093 route installed in BSD compatibility mode, it can be a local address
1094 of the interface. For NAT routes it is the first address of the block
1095 of translated IP destinations.
1099 the source address to prefer when sending to the destinations
1100 covered by the route prefix.
1103 .BI realm " REALMID"
1104 the realm to which this route is assigned.
1106 may be a number or a string from the file
1107 .BR "/etc/iproute2/rt_realms" .
1112 .BI "mtu lock" " MTU"
1113 the MTU along the path to the destination. If the modifier
1115 is not used, the MTU may be updated by the kernel due to
1116 Path MTU Discovery. If the modifier
1118 is used, no path MTU discovery will be tried, all packets
1119 will be sent without the DF bit in IPv4 case or fragmented
1123 .BI window " NUMBER"
1124 the maximal window for TCP to advertise to these destinations,
1125 measured in bytes. It limits maximal data bursts that our TCP
1126 peers are allowed to send to us.
1130 the initial RTT ('Round Trip Time') estimate. If no suffix is
1131 specified the units are raw values passed directly to the
1132 routing code to maintain compatability with previous releases.
1133 Otherwise if a suffix of s, sec or secs is used to specify
1134 seconds; ms, msec or msecs to specify milliseconds; us, usec
1135 or usecs to specify microseconds; ns, nsec or nsecs to specify
1136 nanoseconds; j, hz or jiffies to specify jiffies, the value is
1137 converted to what the routing code expects.
1141 .BI rttvar " TIME " "(2.3.15+ only)"
1142 the initial RTT variance estimate. Values are specified as with
1147 .BI rto_min " TIME " "(2.6.23+ only)"
1148 the minimum TCP Retransmission TimeOut to use when communicating with this
1149 destination. Values are specified as with
1154 .BI ssthresh " NUMBER " "(2.3.15+ only)"
1155 an estimate for the initial slow start threshold.
1158 .BI cwnd " NUMBER " "(2.3.15+ only)"
1159 the clamp for congestion window. It is ignored if the
1164 .BI advmss " NUMBER " "(2.3.15+ only)"
1165 the MSS ('Maximal Segment Size') to advertise to these
1166 destinations when establishing TCP connections. If it is not given,
1167 Linux uses a default value calculated from the first hop device MTU.
1168 (If the path to these destination is asymmetric, this guess may be wrong.)
1171 .BI reordering " NUMBER " "(2.3.15+ only)"
1172 Maximal reordering on the path to this destination.
1173 If it is not given, Linux uses the value selected with
1176 .BR "net/ipv4/tcp_reordering" .
1179 .BI nexthop " NEXTHOP"
1180 the nexthop of a multipath route.
1182 is a complex value with its own syntax similar to the top level
1187 - is the nexthop router.
1191 - is the output device.
1194 .BI weight " NUMBER"
1195 - is a weight for this element of a multipath
1196 route reflecting its relative bandwidth or quality.
1200 .BI scope " SCOPE_VAL"
1201 the scope of the destinations covered by the route prefix.
1203 may be a number or a string from the file
1204 .BR "/etc/iproute2/rt_scopes" .
1205 If this parameter is omitted,
1214 .BR unicast " and " broadcast
1216 .BR host " for " local
1220 .BI protocol " RTPROTO"
1221 the routing protocol identifier of this route.
1223 may be a number or a string from the file
1224 .BR "/etc/iproute2/rt_protos" .
1225 If the routing protocol ID is not given,
1226 .B ip assumes protocol
1228 (i.e. it assumes the route was added by someone who doesn't
1229 understand what they are doing). Several protocol values have
1230 a fixed interpretation.
1235 - the route was installed due to an ICMP redirect.
1239 - the route was installed by the kernel during autoconfiguration.
1243 - the route was installed during the bootup sequence.
1244 If a routing daemon starts, it will purge all of them.
1248 - the route was installed by the administrator
1249 to override dynamic routing. Routing daemon will respect them
1250 and, probably, even advertise them to its peers.
1254 - the route was installed by Router Discovery protocol.
1258 The rest of the values are not reserved and the administrator is free
1259 to assign (or not to assign) protocol tags.
1263 pretend that the nexthop is directly attached to this link,
1264 even if it does not match any interface prefix.
1268 allow packet by packet randomization on multipath routes.
1269 Without this modifier, the route will be frozen to one selected
1270 nexthop, so that load splitting will only occur on per-flow base.
1272 only works if the kernel is patched.
1274 .SS ip route delete - delete route
1277 has the same arguments as
1278 .BR "ip route add" ,
1279 but their semantics are a bit different.
1282 .RB "(" to ", " tos ", " preference " and " table ")"
1283 select the route to delete. If optional attributes are present,
1285 verifies that they coincide with the attributes of the route to delete.
1286 If no route with the given key and attributes was found,
1290 .SS ip route show - list routes
1291 the command displays the contents of the routing tables or the route(s)
1292 selected by some criteria.
1295 .BI to " SELECTOR " (default)
1296 only select routes from the given range of destinations.
1298 consists of an optional modifier
1299 .RB "(" root ", " match " or " exact ")"
1302 selects routes with prefixes not shorter than
1306 selects the entire routing table.
1308 selects routes with prefixes not longer than
1311 .BI match " 10.0/16"
1314 .IR 10/8 " and " 0/0 ,
1315 but it does not select
1316 .IR 10.1/16 " and " 10.0.0/24 .
1321 selects routes with this exact prefix. If neither of these options
1326 i.e. it lists the entire table.
1331 only select routes with the given TOS.
1334 .BI table " TABLEID"
1335 show the routes from this table(s). The default setting is to show
1338 may either be the ID of a real table or one of the special values:
1342 - list all of the tables.
1345 - dump the routing cache.
1352 list cloned routes i.e. routes which were dynamically forked from
1353 other routes because some route attribute (f.e. MTU) was updated.
1354 Actually, it is equivalent to
1355 .BR "table cache" "."
1358 .BI from " SELECTOR"
1359 the same syntax as for
1361 but it binds the source address range rather than destinations.
1364 option only works with cloned routes.
1367 .BI protocol " RTPROTO"
1368 only list routes of this protocol.
1371 .BI scope " SCOPE_VAL"
1372 only list routes with this scope.
1376 only list routes of this type.
1380 only list routes going via this device.
1384 only list routes going via the nexthop routers selected by
1389 only list routes with preferred source addresses selected
1394 .BI realm " REALMID"
1396 .BI realms " FROMREALM/TOREALM"
1397 only list routes with these realms.
1399 .SS ip route flush - flush routing tables
1400 this command flushes routes selected by some criteria.
1403 The arguments have the same syntax and semantics as the arguments of
1404 .BR "ip route show" ,
1405 but routing tables are not listed but purged. The only difference is
1408 dumps all the IP main routing table but
1410 prints the helper page.
1415 option, the command becomes verbose. It prints out the number of
1416 deleted routes and the number of rounds made to flush the routing
1417 table. If the option is given
1420 also dumps all the deleted routes in the format described in the
1421 previous subsection.
1423 .SS ip route get - get a single route
1424 this command gets a single route to a destination and prints its
1425 contents exactly as the kernel sees it.
1428 .BI to " ADDRESS " (default)
1429 the destination address.
1439 the Type Of Service.
1443 the device from which this packet is expected to arrive.
1447 force the output device on which this packet will be routed.
1451 if no source address
1452 .RB "(option " from ")"
1453 was given, relookup the route with the source set to the preferred
1454 address received from the first lookup.
1455 If policy routing is used, it may be a different route.
1458 Note that this operation is not equivalent to
1459 .BR "ip route show" .
1461 shows existing routes.
1463 resolves them and creates new clones if necessary. Essentially,
1465 is equivalent to sending a packet along this path.
1468 argument is not given, the kernel creates a route
1469 to output packets towards the requested destination.
1470 This is equivalent to pinging the destination
1472 .BR "ip route ls cache" ,
1473 however, no packets are actually sent. With the
1475 argument, the kernel pretends that a packet arrived from this interface
1476 and searches for a path to forward the packet.
1478 .SH ip rule - routing policy database management
1481 in the routing policy database control the route selection algorithm.
1484 Classic routing algorithms used in the Internet make routing decisions
1485 based only on the destination address of packets (and in theory,
1486 but not in practice, on the TOS field).
1489 In some circumstances we want to route packets differently depending not only
1490 on destination addresses, but also on other packet fields: source address,
1491 IP protocol, transport protocol ports or even packet payload.
1492 This task is called 'policy routing'.
1495 To solve this task, the conventional destination based routing table, ordered
1496 according to the longest match rule, is replaced with a 'routing policy
1497 database' (or RPDB), which selects routes by executing some set of rules.
1500 Each policy routing rule consists of a
1503 .B action predicate.
1504 The RPDB is scanned in the order of increasing priority. The selector
1505 of each rule is applied to {source address, destination address, incoming
1506 interface, tos, fwmark} and, if the selector matches the packet,
1507 the action is performed. The action predicate may return with success.
1508 In this case, it will either give a route or failure indication
1509 and the RPDB lookup is terminated. Otherwise, the RPDB program
1510 continues on the next rule.
1513 Semantically, natural action is to select the nexthop and the output device.
1516 At startup time the kernel configures the default RPDB consisting of three
1521 Priority: 0, Selector: match anything, Action: lookup routing
1527 table is a special routing table containing
1528 high priority control routes for local and broadcast addresses.
1530 Rule 0 is special. It cannot be deleted or overridden.
1534 Priority: 32766, Selector: match anything, Action: lookup routing
1540 table is the normal routing table containing all non-policy
1541 routes. This rule may be deleted and/or overridden with other
1542 ones by the administrator.
1546 Priority: 32767, Selector: match anything, Action: lookup routing
1552 table is empty. It is reserved for some post-processing if no previous
1553 default rules selected the packet.
1554 This rule may also be deleted.
1557 Each RPDB entry has additional
1558 attributes. F.e. each rule has a pointer to some routing
1559 table. NAT and masquerading rules have an attribute to select new IP
1560 address to translate/masquerade. Besides that, rules have some
1561 optional attributes, which routes have, namely
1563 These values do not override those contained in the routing tables. They
1564 are only used if the route did not select any attributes.
1567 The RPDB may contain rules of the following types:
1571 - the rule prescribes to return the route found
1572 in the routing table referenced by the rule.
1575 - the rule prescribes to silently drop the packet.
1578 - the rule prescribes to generate a 'Network is unreachable' error.
1581 - the rule prescribes to generate 'Communication is administratively
1585 - the rule prescribes to translate the source address
1586 of the IP packet into some other value.
1589 .SS ip rule add - insert a new rule
1590 .SS ip rule delete - delete a rule
1593 .BI type " TYPE " (default)
1594 the type of this rule. The list of valid types was given in the previous
1599 select the source prefix to match.
1603 select the destination prefix to match.
1607 select the incoming device to match. If the interface is loopback,
1608 the rule only matches packets originating from this host. This means
1609 that you may create separate routing tables for forwarded and local
1610 packets and, hence, completely segregate them.
1616 select the TOS value to match.
1625 .BI priority " PREFERENCE"
1626 the priority of this rule. Each rule should have an explicitly
1630 The options preference and order are synonyms with priority.
1633 .BI table " TABLEID"
1634 the routing table identifier to lookup if the rule selector matches.
1635 It is also possible to use lookup instead of table.
1638 .BI realms " FROM/TO"
1639 Realms to select if the rule matched and the routing table lookup
1642 is only used if the route did not select any realm.
1646 The base of the IP address block to translate (for source addresses).
1649 may be either the start of the block of NAT addresses (selected by NAT
1650 routes) or a local host address (or even zero).
1651 In the last case the router does not translate the packets, but
1652 masquerades them to this address.
1653 Using map-to instead of nat means the same thing.
1656 Changes to the RPDB made with these commands do not become active
1657 immediately. It is assumed that after a script finishes a batch of
1658 updates, it flushes the routing cache with
1659 .BR "ip route flush cache" .
1661 .SS ip rule flush - also dumps all the deleted rules.
1662 This command has no arguments.
1664 .SS ip rule show - list rules
1665 This command has no arguments.
1666 The options list or lst are synonyms with show.
1668 .SH ip maddress - multicast addresses management
1671 objects are multicast addresses.
1673 .SS ip maddress show - list multicast addresses
1676 .BI dev " NAME " (default)
1679 .SS ip maddress add - add a multicast address
1680 .SS ip maddress delete - delete a multicast address
1681 these commands attach/detach a static link layer multicast address
1682 to listen on the interface.
1683 Note that it is impossible to join protocol multicast groups
1684 statically. This command only manages link layer addresses.
1687 .BI address " LLADDRESS " (default)
1688 the link layer multicast address.
1692 the device to join/leave this multicast address.
1694 .SH ip mroute - multicast routing cache management
1696 objects are multicast routing cache entries created by a user level
1697 mrouting daemon (f.e.
1703 Due to the limitations of the current interface to the multicast routing
1704 engine, it is impossible to change
1706 objects administratively, so we may only display them. This limitation
1707 will be removed in the future.
1709 .SS ip mroute show - list mroute cache entries
1712 .BI to " PREFIX " (default)
1713 the prefix selecting the destination multicast addresses to list.
1717 the interface on which multicast packets are received.
1721 the prefix selecting the IP source addresses of the multicast route.
1723 .SH ip tunnel - tunnel configuration
1725 objects are tunnels, encapsulating packets in IP packets and then
1726 sending them over the IP infrastructure.
1727 The encapulating (or outer) address family is specified by the
1729 option. The default is IPv4.
1731 .SS ip tunnel add - add a new tunnel
1732 .SS ip tunnel change - change an existing tunnel
1733 .SS ip tunnel delete - destroy a tunnel
1736 .BI name " NAME " (default)
1737 select the tunnel device name.
1741 set the tunnel mode. Available modes depend on the encapsulating address family.
1743 Modes for IPv4 encapsulation available:
1744 .BR ipip ", " sit ", " isatap " and " gre "."
1746 Modes for IPv6 encapsulation available:
1747 .BR ip6ip6 ", " ipip6 " and " any "."
1750 .BI remote " ADDRESS"
1751 set the remote endpoint of the tunnel.
1754 .BI local " ADDRESS"
1755 set the fixed local address for tunneled packets.
1756 It must be an address on another interface of this host.
1762 on tunneled packets.
1764 is a number in the range 1--255. 0 is a special value
1765 meaning that packets inherit the TTL value.
1766 The default value for IPv4 tunnels is:
1768 The default value for IPv6 tunnels is:
1778 set a fixed TOS (or traffic class in IPv6)
1780 on tunneled packets.
1781 The default value is:
1786 bind the tunnel to the device
1788 so that tunneled packets will only be routed via this device and will
1789 not be able to escape to another device when the route to endpoint
1794 disable Path MTU Discovery on this tunnel.
1795 It is enabled by default. Note that a fixed ttl is incompatible
1796 with this option: tunnelling with a fixed ttl always makes pmtu
1805 .RB ( " only GRE tunnels " )
1806 use keyed GRE with key
1808 is either a number or an IP address-like dotted quad.
1811 parameter sets the key to use in both directions.
1813 .BR ikey " and " okey
1814 parameters set different keys for input and output.
1817 .BR csum ", " icsum ", " ocsum
1818 .RB ( " only GRE tunnels " )
1819 generate/require checksums for tunneled packets.
1822 flag calculates checksums for outgoing packets.
1825 flag requires that all input packets have the correct
1828 flag is equivalent to the combination
1832 .BR seq ", " iseq ", " oseq
1833 .RB ( " only GRE tunnels " )
1837 flag enables sequencing of outgoing packets.
1840 flag requires that all input packets are serialized.
1843 flag is equivalent to the combination
1845 .B It isn't work. Don't use it.
1850 .RB ( " only IPv6 tunnels " )
1851 Inherit DS field between inner and outer header.
1855 .BI encaplim " ELIM"
1856 .RB ( " only IPv6 tunnels " )
1857 set a fixed encapsulation limit. Default is 4.
1861 .BI flowlabel " FLOWLABEL"
1862 .RB ( " only IPv6 tunnels " )
1863 set a fixed flowlabel.
1865 .SS ip tunnel show - list tunnels
1866 This command has no arguments.
1868 .SH ip monitor and rtmon - state monitoring
1872 utility can monitor the state of devices, addresses
1873 and routes continuously. This option has a slightly different format.
1876 command is the first in the command line and then the object list follows:
1878 .BR "ip monitor" " [ " all " |"
1879 .IR LISTofOBJECTS " ]"
1882 is the list of object types that we want to monitor.
1884 .BR link ", " address " and " route "."
1889 opens RTNETLINK, listens on it and dumps state changes in the format
1890 described in previous sections.
1893 If a file name is given, it does not listen on RTNETLINK,
1894 but opens the file containing RTNETLINK messages saved in binary format
1895 and dumps them. Such a history file can be generated with the
1897 utility. This utility has a command line syntax similar to
1901 should be started before the first network configuration command
1902 is issued. F.e. if you insert:
1905 rtmon file /var/log/rtmon.log
1908 in a startup script, you will be able to view the full history
1912 Certainly, it is possible to start
1915 It prepends the history with the state snapshot dumped at the moment
1920 was written by Alexey N. Kuznetsov and added in Linux 2.2.
1924 .RB "IP Command reference " ip-cref.ps
1926 .RB "IP tunnels " ip-cref.ps
1928 .RB "User documentation at " http://lartc.org/ ", but please direct bugreports and patches to: " <netdev@vger.kernel.org>
1931 Original Manpage by Michail Litvak <mci@owl.openwall.com>