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 " } |"
63 .BR "ip addr" " { " add " | " del " } "
64 .IB IFADDR " dev " STRING
67 .BR "ip addr" " { " show " | " flush " } [ " dev
72 .IR PREFIX " ] [ " FLAG-LIST " ] [ "
77 .IR IFADDR " := " PREFIX " | " ADDR
91 .RB "[ " host " | " link " | " global " | "
95 .IR FLAG-LIST " := [ " FLAG-LIST " ] " FLAG
99 .RB "[ " permanent " | " dynamic " | " secondary " | " primary " | "\
100 tentative " | " deprecated " | " dadfailed " | " temporary " ]"
103 .BR "ip addrlabel" " { " add " | " del " } " prefix
111 .BR "ip addrlabel" " { " list " | " flush " }"
115 .BR list " | " flush " } "
121 .BI from " ADDRESS " iif " STRING"
128 .BR "ip route" " { " add " | " del " | " change " | " append " | "\
129 replace " | " monitor " } "
150 .IR ROUTE " := " NODE_SPEC " [ " INFO_SPEC " ]"
153 .IR NODE_SPEC " := [ " TYPE " ] " PREFIX " ["
166 .IR INFO_SPEC " := " "NH OPTIONS FLAGS" " ["
177 .IR NUMBER " ] " NHFLAGS
180 .IR OPTIONS " := " FLAGS " [ "
202 .BR unicast " | " local " | " broadcast " | " multicast " | "\
203 throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]"
206 .IR TABLE_ID " := [ "
207 .BR local "| " main " | " default " | " all " |"
212 .BR host " | " link " | " global " |"
217 .BR onlink " | " pervasive " ]"
221 .BR kernel " | " boot " | " static " |"
226 .RB " [ " list " | " add " | " del " | " flush " ]"
230 .IR SELECTOR " := [ "
238 .IR FWMARK[/MASK] " ] [ "
252 .BR prohibit " | " reject " | " unreachable " ] [ " realms
253 .RI "[" SRCREALM "/]" DSTREALM " ]"
256 .IR TABLE_ID " := [ "
257 .BR local " | " main " | " default " |"
261 .BR "ip neigh" " { " add " | " del " | " change " | " replace " } { "
265 .BR nud " { " permanent " | " noarp " | " stale " | " reachable " } ] | " proxy
271 .BR "ip neigh" " { " show " | " flush " } [ " to
279 .BR "ip tunnel" " { " add " | " change " | " del " | " show " | " prl " }"
289 .RB "[ [" i "|" o "]" seq " ] [ [" i "|" o "]" key
291 .RB "[" i "|" o "]" csum " ] ]"
310 .RB "[ [" no "]" pmtudisc " ]"
313 .RB "[ " "dscp inherit" " ]"
317 .RB " { " ipip " | " gre " | " sit " | " isatap " | " ip6ip6 " | " ipip6 " | " any " }"
320 .IR ADDR " := { " IP_ADDRESS " |"
324 .IR TOS " := { " NUMBER " |"
334 .IR TTL " := { " 1 ".." 255 " | "
338 .IR KEY " := { " DOTTED_QUAD " | " NUMBER " }"
341 .IR TIME " := " NUMBER "[s|ms|us|ns|j]"
344 .BR "ip maddr" " [ " add " | " del " ]"
345 .IB MULTIADDR " dev " STRING
348 .BR "ip maddr show" " [ " dev
352 .BR "ip mroute show" " ["
360 .BR "ip monitor" " [ " all " |"
361 .IR LISTofOBJECTS " ]"
365 .IR XFRM_OBJECT " { " COMMAND " }"
368 .IR XFRM_OBJECT " := { " state " | " policy " | " monitor " } "
371 .BR "ip xfrm state " { " add " | " update " } "
381 .RB " [ " replay-window
395 .BR "ip xfrm state allocspi "
409 .BR "ip xfrm state" " { " delete " | " get " } "
413 .BR "ip xfrm state" " { " deleteall " | " list " } [ "
424 .BR "ip xfrm state flush" " [ " proto
428 .BR "ip xfrm state count"
442 .IR XFRM_PROTO " := "
443 .RB " [ " esp " | " ah " | " comp " | " route2 " | " hao " ] "
447 .RB " [ " transport " | " tunnel " | " ro " | " beet " ] "
448 .B (default=transport)
452 .RI " [ " FLAG-LIST " ] " FLAG
456 .RB " [ " noecn " | " decap-dscp " | " wildrecv " ] "
459 .IR ENCAP " := " ENCAP-TYPE " " SPORT " " DPORT " " OADDR
462 .IR ENCAP-TYPE " := "
468 .IR ALGO-LIST " := [ "
469 .IR ALGO-LIST " ] | [ "
480 .RB " [ " enc " | " auth " | " comp " ] "
485 .IR ADDR "[/" PLEN "]"
487 .IR ADDR "[/" PLEN "]"
488 .RI " [ " UPSPEC " ] "
507 .IR LIMIT-LIST " := [ " LIMIT-LIST " ] |"
513 .RB " [ [" time-soft "|" time-hard "|" time-use-soft "|" time-use-hard "]"
515 .RB "[ ["byte-soft "|" byte-hard "]"
518 .RB " [ ["packet-soft "|" packet-hard "]"
522 .BR "ip xfrm policy" " { " add " | " update " } " " dir "
535 .RI " [ " LIMIT-LIST " ] [ "
539 .BR "ip xfrm policy" " { " delete " | " get " } " " dir "
540 .IR DIR " [ " SELECTOR " | "
549 .BR "ip xfrm policy" " { " deleteall " | " list " } "
562 .B "ip xfrm policy flush"
571 .RB " [ " main " | " sub " ] "
576 .RB " [ " in " | " out " | " fwd " ] "
581 .IR ADDR "[/" PLEN "]"
583 .IR ADDR "[/" PLEN] " [ " UPSPEC
603 .RB " [ " allow " | " block " ]"
607 .IR LIMIT-LIST " := "
609 .IR LIMIT-LIST " ] | "
615 .RB " [ [" time-soft "|" time-hard "|" time-use-soft "|" time-use-hard "]"
617 .RB " [ [" byte-soft "|" byte-hard "]"
620 .RB "[" packet-soft "|" packet-hard "]"
626 .IR TMPL-LIST " ] | "
652 .IR XFRM_PROTO " := "
653 .RB " [ " esp " | " ah " | " comp " | " route2 " | " hao " ] "
657 .RB " [ " transport " | " tunnel " | " beet " ] "
658 .B (default=transport)
662 .RB " [ " required " | " use " ] "
663 .B (default=required)
666 .BR "ip xfrm monitor" " [ " all " | "
667 .IR LISTofOBJECTS " ] "
675 .BR "\-V" , " -Version"
676 print the version of the
681 .BR "\-s" , " \-stats", " \-statistics"
682 output more information. If the option
683 appears twice or more, the amount of information increases.
684 As a rule, the information is statistics or some time values.
687 .BR "\-f" , " \-family"
688 followed by protocol family identifier:
689 .BR "inet" , " inet6"
692 ,enforce the protocol family to use. If the option is not present,
693 the protocol family is guessed from other arguments. If the rest
694 of the command line does not give enough information to guess the
697 falls back to the default one, usually
702 is a special family identifier meaning that no networking protocol
713 .BR "\-family inet6" .
718 .BR "\-family link" .
721 .BR "\-o" , " \-oneline"
722 output each record on a single line, replacing line feeds
725 character. This is convenient when you want to count records
733 .BR "\-r" , " \-resolve"
734 use the system's name resolver to print DNS names instead of
737 .SH IP - COMMAND SYNTAX
748 - protocol (IP or IPv6) address on a device.
752 - label configuration for protocol address selection.
756 - ARP or NDISC cache entry.
760 - routing table entry.
764 - rule in routing policy database.
772 - multicast routing cache entry.
780 - framework for IPsec protocol.
783 The names of all objects may be written in full or
784 abbreviated form, f.e.
794 Specifies the action to perform on the object.
795 The set of possible actions depends on the object type.
796 As a rule, it is possible to
797 .BR "add" , " delete"
802 ) objects, but some objects do not allow all of these operations
803 or have some additional commands. The
805 command is available for all objects. It prints
806 out a list of available commands and argument syntax conventions.
808 If no command is given, some default command is assumed.
811 or, if the objects of this class cannot be listed,
814 .SH ip link - network device configuration
817 is a network device and the corresponding commands
818 display and change the state of devices.
820 .SS ip link set - change device attributes
823 .BI dev " NAME " (default)
825 specifies network device to operate on.
829 change the state of the device to
835 .BR "arp on " or " arp off"
841 .BR "multicast on " or " multicast off"
847 .BR "dynamic on " or " dynamic off"
854 change the name of the device. This operation is not
855 recommended if the device is running or has some addresses
859 .BI txqueuelen " NUMBER"
862 change the transmit queue length of the device.
871 .BI address " LLADDRESS"
872 change the station address of the interface.
875 .BI broadcast " LLADDRESS"
879 .BI peer " LLADDRESS"
880 change the link layer broadcast address or the peer address when
886 move the device to the network namespace associated with the process
891 If multiple parameter changes are requested,
893 aborts immediately after any of the changes have failed.
894 This is the only case when
896 can move the system to an unpredictable state. The solution
897 is to avoid changing several parameters with one
901 .SS ip link show - display device attributes
904 .BI dev " NAME " (default)
906 specifies the network device to show.
907 If this argument is omitted all devices are listed.
911 only display running interfaces.
913 .SH ip address - protocol address management.
917 is a protocol (IP or IPv6) address attached
918 to a network device. Each device must have at least one address
919 to use the corresponding protocol. It is possible to have several
920 different addresses attached to one device. These addresses are not
921 discriminated, so that the term
923 is not quite appropriate for them and we do not use it in this document.
927 command displays addresses and their properties, adds new addresses
928 and deletes old ones.
930 .SS ip address add - add new protocol address.
934 the name of the device to add the address to.
937 .BI local " ADDRESS " (default)
938 the address of the interface. The format of the address depends
939 on the protocol. It is a dotted quad for IP and a sequence of
940 hexadecimal halfwords separated by colons for IPv6. The
942 may be followed by a slash and a decimal number which encodes
943 the network prefix length.
947 the address of the remote endpoint for pointopoint interfaces.
950 may be followed by a slash and a decimal number, encoding the network
951 prefix length. If a peer address is specified, the local address
952 cannot have a prefix length. The network prefix is associated
953 with the peer rather than with the local address.
956 .BI broadcast " ADDRESS"
957 the broadcast address on the interface.
959 It is possible to use the special symbols
963 instead of the broadcast address. In this case, the broadcast address
964 is derived by setting/resetting the host bits of the interface prefix.
968 Each address may be tagged with a label string.
969 In order to preserve compatibility with Linux-2.0 net aliases,
970 this string must coincide with the name of the device or must be prefixed
971 with the device name followed by colon.
974 .BI scope " SCOPE_VALUE"
975 the scope of the area where this address is valid.
976 The available scopes are listed in file
977 .BR "/etc/iproute2/rt_scopes" .
978 Predefined scope values are:
982 - the address is globally valid.
985 - (IPv6 only) the address is site local, i.e. it is
986 valid inside this site.
989 - the address is link local, i.e. it is valid only on this device.
992 - the address is valid only inside this host.
995 .SS ip address delete - delete protocol address
997 coincide with the arguments of
999 The device name is a required argument. The rest are optional.
1000 If no arguments are given, the first address is deleted.
1002 .SS ip address show - look at protocol addresses
1005 .BI dev " NAME " (default)
1009 .BI scope " SCOPE_VAL"
1010 only list addresses with this scope.
1014 only list addresses matching this prefix.
1017 .BI label " PATTERN"
1018 only list addresses with labels matching the
1021 is a usual shell style pattern.
1024 .BR dynamic " and " permanent
1025 (IPv6 only) only list addresses installed due to stateless
1026 address configuration or only list permanent (not dynamic)
1031 (IPv6 only) only list addresses which have not yet passed duplicate
1036 (IPv6 only) only list deprecated addresses.
1040 (IPv6 only) only list addresses which have failed duplicate
1045 (IPv6 only) only list temporary addresses.
1048 .BR primary " and " secondary
1049 only list primary (or secondary) addresses.
1051 .SS ip address flush - flush protocol addresses
1052 This command flushes the protocol addresses selected by some criteria.
1055 This command has the same arguments as
1057 The difference is that it does not run when no arguments are given.
1061 This command (and other
1063 commands described below) is pretty dangerous. If you make a mistake,
1064 it will not forgive it, but will cruelly purge all the addresses.
1069 option, the command becomes verbose. It prints out the number of deleted
1070 addresses and the number of rounds made to flush the address list. If
1071 this option is given twice,
1073 also dumps all the deleted addresses in the format described in the
1074 previous subsection.
1076 .SH ip addrlabel - protocol address label management.
1078 IPv6 address label is used for address selection
1079 described in RFC 3484. Precedence is managed by userspace,
1080 and only label is stored in kernel.
1082 .SS ip addrlabel add - add an address label
1083 the command adds an address label entry to the kernel.
1085 .BI prefix " PREFIX"
1088 the outgoing interface.
1091 the label for the prefix.
1092 0xffffffff is reserved.
1093 .SS ip addrlabel del - delete an address label
1094 the command deletes an address label entry in the kernel.
1096 coincide with the arguments of
1098 but label is not required.
1099 .SS ip addrlabel list - list address labels
1100 the command show contents of address labels.
1101 .SS ip addrlabel flush - flush address labels
1102 the command flushes the contents of address labels and it does not restore default settings.
1103 .SH ip neighbour - neighbour/arp tables management.
1106 objects establish bindings between protocol addresses and
1107 link layer addresses for hosts sharing the same link.
1108 Neighbour entries are organized into tables. The IPv4 neighbour table
1109 is known by another name - the ARP table.
1112 The corresponding commands display neighbour bindings
1113 and their properties, add new neighbour entries and delete old ones.
1115 .SS ip neighbour add - add a new neighbour entry
1116 .SS ip neighbour change - change an existing entry
1117 .SS ip neighbour replace - add a new entry or change an existing one
1119 These commands create new neighbour records or update existing ones.
1122 .BI to " ADDRESS " (default)
1123 the protocol address of the neighbour. It is either an IPv4 or IPv6 address.
1127 the interface to which this neighbour is attached.
1130 .BI lladdr " LLADDRESS"
1131 the link layer address of the neighbour.
1137 .BI nud " NUD_STATE"
1138 the state of the neighbour entry.
1140 is an abbreviation for 'Neigh bour Unreachability Detection'.
1141 The state can take one of the following values:
1145 - the neighbour entry is valid forever and can be only
1146 be removed administratively.
1150 - the neighbour entry is valid. No attempts to validate
1151 this entry will be made but it can be removed when its lifetime expires.
1155 - the neighbour entry is valid until the reachability
1160 - the neighbour entry is valid but suspicious.
1163 does not change the neighbour state if it was valid and the address
1164 is not changed by this command.
1167 .SS ip neighbour delete - delete a neighbour entry
1168 This command invalidates a neighbour entry.
1171 The arguments are the same as with
1172 .BR "ip neigh add" ,
1181 Attempts to delete or manually change a
1183 entry created by the kernel may result in unpredictable behaviour.
1184 Particularly, the kernel may try to resolve this address even
1187 interface or if the address is multicast or broadcast.
1189 .SS ip neighbour show - list neighbour entries
1191 This commands displays neighbour tables.
1194 .BI to " ADDRESS " (default)
1195 the prefix selecting the neighbours to list.
1199 only list the neighbours attached to this device.
1203 only list neighbours which are not currently in use.
1206 .BI nud " NUD_STATE"
1207 only list neighbour entries in this state.
1209 takes values listed below or the special value
1211 which means all states. This option may occur more than once.
1212 If this option is absent,
1214 lists all entries except for
1219 .SS ip neighbour flush - flush neighbour entries
1220 This command flushes neighbour tables, selecting
1221 entries to flush by some criteria.
1224 This command has the same arguments as
1226 The differences are that it does not run when no arguments are given,
1227 and that the default neighbour states to be flushed do not include
1235 option, the command becomes verbose. It prints out the number of
1236 deleted neighbours and the number of rounds made to flush the
1237 neighbour table. If the option is given
1240 also dumps all the deleted neighbours.
1242 .SH ip route - routing table management
1243 Manipulate route entries in the kernel routing tables keep
1244 information about paths to other networked nodes.
1250 - the route entry describes real paths to the destinations covered
1251 by the route prefix.
1255 - these destinations are unreachable. Packets are discarded and the
1259 The local senders get an
1265 - these destinations are unreachable. Packets are discarded silently.
1266 The local senders get an
1272 - these destinations are unreachable. Packets are discarded and the
1274 .I communication administratively prohibited
1275 is generated. The local senders get an
1281 - the destinations are assigned to this host. The packets are looped
1282 back and delivered locally.
1286 - the destinations are broadcast addresses. The packets are sent as
1291 - a special control route used together with policy rules. If such a
1292 route is selected, lookup in this table is terminated pretending that
1293 no route was found. Without policy routing it is equivalent to the
1294 absence of the route in the routing table. The packets are dropped
1295 and the ICMP message
1297 is generated. The local senders get an
1303 - a special NAT route. Destinations covered by the prefix
1304 are considered to be dummy (or external) addresses which require translation
1305 to real (or internal) ones before forwarding. The addresses to translate to
1306 are selected with the attribute
1308 Route NAT is no longer supported in Linux 2.6.
1314 .RI "- " "not implemented"
1315 the destinations are
1317 addresses assigned to this host. They are mainly equivalent
1320 with one difference: such addresses are invalid when used
1321 as the source address of any packet.
1325 - a special type used for multicast routing. It is not present in
1326 normal routing tables.
1331 Linux-2.x can pack routes into several routing
1332 tables identified by a number in the range from 1 to 255 or by
1334 .B /etc/iproute2/rt_tables
1335 By default all normal routes are inserted into the
1337 table (ID 254) and the kernel only uses this table when calculating routes.
1340 Actually, one other table always exists, which is invisible but
1341 even more important. It is the
1343 table (ID 255). This table
1344 consists of routes for local and broadcast addresses. The kernel maintains
1345 this table automatically and the administrator usually need not modify it
1348 The multiple routing tables enter the game when
1352 .SS ip route add - add new route
1353 .SS ip route change - change route
1354 .SS ip route replace - change or add new one
1357 .BI to " TYPE PREFIX " (default)
1358 the destination prefix of the route. If
1368 is an IP or IPv6 address optionally followed by a slash and the
1369 prefix length. If the length of the prefix is missing,
1371 assumes a full-length host route. There is also a special
1374 - which is equivalent to IP
1383 the Type Of Service (TOS) key. This key has no associated mask and
1384 the longest match is understood as: First, compare the TOS
1385 of the route and of the packet. If they are not equal, then the packet
1386 may still match a route with a zero TOS.
1388 is either an 8 bit hexadecimal number or an identifier
1390 .BR "/etc/iproute2/rt_dsfield" .
1393 .BI metric " NUMBER"
1395 .BI preference " NUMBER"
1396 the preference value of the route.
1398 is an arbitrary 32bit number.
1401 .BI table " TABLEID"
1402 the table to add this route to.
1404 may be a number or a string from the file
1405 .BR "/etc/iproute2/rt_tables" .
1406 If this parameter is omitted,
1410 table, with the exception of
1411 .BR local " , " broadcast " and " nat
1412 routes, which are put into the
1418 the output device name.
1422 the address of the nexthop router. Actually, the sense of this field
1423 depends on the route type. For normal
1425 routes it is either the true next hop router or, if it is a direct
1426 route installed in BSD compatibility mode, it can be a local address
1427 of the interface. For NAT routes it is the first address of the block
1428 of translated IP destinations.
1432 the source address to prefer when sending to the destinations
1433 covered by the route prefix.
1436 .BI realm " REALMID"
1437 the realm to which this route is assigned.
1439 may be a number or a string from the file
1440 .BR "/etc/iproute2/rt_realms" .
1445 .BI "mtu lock" " MTU"
1446 the MTU along the path to the destination. If the modifier
1448 is not used, the MTU may be updated by the kernel due to
1449 Path MTU Discovery. If the modifier
1451 is used, no path MTU discovery will be tried, all packets
1452 will be sent without the DF bit in IPv4 case or fragmented
1456 .BI window " NUMBER"
1457 the maximal window for TCP to advertise to these destinations,
1458 measured in bytes. It limits maximal data bursts that our TCP
1459 peers are allowed to send to us.
1463 the initial RTT ('Round Trip Time') estimate. If no suffix is
1464 specified the units are raw values passed directly to the
1465 routing code to maintain compatability with previous releases.
1466 Otherwise if a suffix of s, sec or secs is used to specify
1467 seconds; ms, msec or msecs to specify milliseconds; us, usec
1468 or usecs to specify microseconds; ns, nsec or nsecs to specify
1469 nanoseconds; j, hz or jiffies to specify jiffies, the value is
1470 converted to what the routing code expects.
1474 .BI rttvar " TIME " "(2.3.15+ only)"
1475 the initial RTT variance estimate. Values are specified as with
1480 .BI rto_min " TIME " "(2.6.23+ only)"
1481 the minimum TCP Retransmission TimeOut to use when communicating with this
1482 destination. Values are specified as with
1487 .BI ssthresh " NUMBER " "(2.3.15+ only)"
1488 an estimate for the initial slow start threshold.
1491 .BI cwnd " NUMBER " "(2.3.15+ only)"
1492 the clamp for congestion window. It is ignored if the
1497 .BI advmss " NUMBER " "(2.3.15+ only)"
1498 the MSS ('Maximal Segment Size') to advertise to these
1499 destinations when establishing TCP connections. If it is not given,
1500 Linux uses a default value calculated from the first hop device MTU.
1501 (If the path to these destination is asymmetric, this guess may be wrong.)
1504 .BI reordering " NUMBER " "(2.3.15+ only)"
1505 Maximal reordering on the path to this destination.
1506 If it is not given, Linux uses the value selected with
1509 .BR "net/ipv4/tcp_reordering" .
1512 .BI nexthop " NEXTHOP"
1513 the nexthop of a multipath route.
1515 is a complex value with its own syntax similar to the top level
1520 - is the nexthop router.
1524 - is the output device.
1527 .BI weight " NUMBER"
1528 - is a weight for this element of a multipath
1529 route reflecting its relative bandwidth or quality.
1533 .BI scope " SCOPE_VAL"
1534 the scope of the destinations covered by the route prefix.
1536 may be a number or a string from the file
1537 .BR "/etc/iproute2/rt_scopes" .
1538 If this parameter is omitted,
1547 .BR unicast " and " broadcast
1549 .BR host " for " local
1553 .BI protocol " RTPROTO"
1554 the routing protocol identifier of this route.
1556 may be a number or a string from the file
1557 .BR "/etc/iproute2/rt_protos" .
1558 If the routing protocol ID is not given,
1559 .B ip assumes protocol
1561 (i.e. it assumes the route was added by someone who doesn't
1562 understand what they are doing). Several protocol values have
1563 a fixed interpretation.
1568 - the route was installed due to an ICMP redirect.
1572 - the route was installed by the kernel during autoconfiguration.
1576 - the route was installed during the bootup sequence.
1577 If a routing daemon starts, it will purge all of them.
1581 - the route was installed by the administrator
1582 to override dynamic routing. Routing daemon will respect them
1583 and, probably, even advertise them to its peers.
1587 - the route was installed by Router Discovery protocol.
1591 The rest of the values are not reserved and the administrator is free
1592 to assign (or not to assign) protocol tags.
1596 pretend that the nexthop is directly attached to this link,
1597 even if it does not match any interface prefix.
1599 .SS ip route delete - delete route
1602 has the same arguments as
1603 .BR "ip route add" ,
1604 but their semantics are a bit different.
1607 .RB "(" to ", " tos ", " preference " and " table ")"
1608 select the route to delete. If optional attributes are present,
1610 verifies that they coincide with the attributes of the route to delete.
1611 If no route with the given key and attributes was found,
1615 .SS ip route show - list routes
1616 the command displays the contents of the routing tables or the route(s)
1617 selected by some criteria.
1620 .BI to " SELECTOR " (default)
1621 only select routes from the given range of destinations.
1623 consists of an optional modifier
1624 .RB "(" root ", " match " or " exact ")"
1627 selects routes with prefixes not shorter than
1631 selects the entire routing table.
1633 selects routes with prefixes not longer than
1636 .BI match " 10.0/16"
1639 .IR 10/8 " and " 0/0 ,
1640 but it does not select
1641 .IR 10.1/16 " and " 10.0.0/24 .
1646 selects routes with this exact prefix. If neither of these options
1651 i.e. it lists the entire table.
1656 only select routes with the given TOS.
1659 .BI table " TABLEID"
1660 show the routes from this table(s). The default setting is to show
1663 may either be the ID of a real table or one of the special values:
1667 - list all of the tables.
1670 - dump the routing cache.
1677 list cloned routes i.e. routes which were dynamically forked from
1678 other routes because some route attribute (f.e. MTU) was updated.
1679 Actually, it is equivalent to
1680 .BR "table cache" "."
1683 .BI from " SELECTOR"
1684 the same syntax as for
1686 but it binds the source address range rather than destinations.
1689 option only works with cloned routes.
1692 .BI protocol " RTPROTO"
1693 only list routes of this protocol.
1696 .BI scope " SCOPE_VAL"
1697 only list routes with this scope.
1701 only list routes of this type.
1705 only list routes going via this device.
1709 only list routes going via the nexthop routers selected by
1714 only list routes with preferred source addresses selected
1719 .BI realm " REALMID"
1721 .BI realms " FROMREALM/TOREALM"
1722 only list routes with these realms.
1724 .SS ip route flush - flush routing tables
1725 this command flushes routes selected by some criteria.
1728 The arguments have the same syntax and semantics as the arguments of
1729 .BR "ip route show" ,
1730 but routing tables are not listed but purged. The only difference is
1733 dumps all the IP main routing table but
1735 prints the helper page.
1740 option, the command becomes verbose. It prints out the number of
1741 deleted routes and the number of rounds made to flush the routing
1742 table. If the option is given
1745 also dumps all the deleted routes in the format described in the
1746 previous subsection.
1748 .SS ip route get - get a single route
1749 this command gets a single route to a destination and prints its
1750 contents exactly as the kernel sees it.
1753 .BI to " ADDRESS " (default)
1754 the destination address.
1764 the Type Of Service.
1768 the device from which this packet is expected to arrive.
1772 force the output device on which this packet will be routed.
1776 if no source address
1777 .RB "(option " from ")"
1778 was given, relookup the route with the source set to the preferred
1779 address received from the first lookup.
1780 If policy routing is used, it may be a different route.
1783 Note that this operation is not equivalent to
1784 .BR "ip route show" .
1786 shows existing routes.
1788 resolves them and creates new clones if necessary. Essentially,
1790 is equivalent to sending a packet along this path.
1793 argument is not given, the kernel creates a route
1794 to output packets towards the requested destination.
1795 This is equivalent to pinging the destination
1797 .BR "ip route ls cache" ,
1798 however, no packets are actually sent. With the
1800 argument, the kernel pretends that a packet arrived from this interface
1801 and searches for a path to forward the packet.
1803 .SH ip rule - routing policy database management
1806 in the routing policy database control the route selection algorithm.
1809 Classic routing algorithms used in the Internet make routing decisions
1810 based only on the destination address of packets (and in theory,
1811 but not in practice, on the TOS field).
1814 In some circumstances we want to route packets differently depending not only
1815 on destination addresses, but also on other packet fields: source address,
1816 IP protocol, transport protocol ports or even packet payload.
1817 This task is called 'policy routing'.
1820 To solve this task, the conventional destination based routing table, ordered
1821 according to the longest match rule, is replaced with a 'routing policy
1822 database' (or RPDB), which selects routes by executing some set of rules.
1825 Each policy routing rule consists of a
1828 .B action predicate.
1829 The RPDB is scanned in the order of increasing priority. The selector
1830 of each rule is applied to {source address, destination address, incoming
1831 interface, tos, fwmark} and, if the selector matches the packet,
1832 the action is performed. The action predicate may return with success.
1833 In this case, it will either give a route or failure indication
1834 and the RPDB lookup is terminated. Otherwise, the RPDB program
1835 continues on the next rule.
1838 Semantically, natural action is to select the nexthop and the output device.
1841 At startup time the kernel configures the default RPDB consisting of three
1846 Priority: 0, Selector: match anything, Action: lookup routing
1852 table is a special routing table containing
1853 high priority control routes for local and broadcast addresses.
1855 Rule 0 is special. It cannot be deleted or overridden.
1859 Priority: 32766, Selector: match anything, Action: lookup routing
1865 table is the normal routing table containing all non-policy
1866 routes. This rule may be deleted and/or overridden with other
1867 ones by the administrator.
1871 Priority: 32767, Selector: match anything, Action: lookup routing
1877 table is empty. It is reserved for some post-processing if no previous
1878 default rules selected the packet.
1879 This rule may also be deleted.
1882 Each RPDB entry has additional
1883 attributes. F.e. each rule has a pointer to some routing
1884 table. NAT and masquerading rules have an attribute to select new IP
1885 address to translate/masquerade. Besides that, rules have some
1886 optional attributes, which routes have, namely
1888 These values do not override those contained in the routing tables. They
1889 are only used if the route did not select any attributes.
1892 The RPDB may contain rules of the following types:
1896 - the rule prescribes to return the route found
1897 in the routing table referenced by the rule.
1900 - the rule prescribes to silently drop the packet.
1903 - the rule prescribes to generate a 'Network is unreachable' error.
1906 - the rule prescribes to generate 'Communication is administratively
1910 - the rule prescribes to translate the source address
1911 of the IP packet into some other value.
1914 .SS ip rule add - insert a new rule
1915 .SS ip rule delete - delete a rule
1918 .BI type " TYPE " (default)
1919 the type of this rule. The list of valid types was given in the previous
1924 select the source prefix to match.
1928 select the destination prefix to match.
1932 select the incoming device to match. If the interface is loopback,
1933 the rule only matches packets originating from this host. This means
1934 that you may create separate routing tables for forwarded and local
1935 packets and, hence, completely segregate them.
1939 select the outgoing device to match. The outgoing interface is only
1940 available for packets originating from local sockets that are bound to
1947 select the TOS value to match.
1956 .BI priority " PREFERENCE"
1957 the priority of this rule. Each rule should have an explicitly
1961 The options preference and order are synonyms with priority.
1964 .BI table " TABLEID"
1965 the routing table identifier to lookup if the rule selector matches.
1966 It is also possible to use lookup instead of table.
1969 .BI realms " FROM/TO"
1970 Realms to select if the rule matched and the routing table lookup
1973 is only used if the route did not select any realm.
1977 The base of the IP address block to translate (for source addresses).
1980 may be either the start of the block of NAT addresses (selected by NAT
1981 routes) or a local host address (or even zero).
1982 In the last case the router does not translate the packets, but
1983 masquerades them to this address.
1984 Using map-to instead of nat means the same thing.
1987 Changes to the RPDB made with these commands do not become active
1988 immediately. It is assumed that after a script finishes a batch of
1989 updates, it flushes the routing cache with
1990 .BR "ip route flush cache" .
1992 .SS ip rule flush - also dumps all the deleted rules.
1993 This command has no arguments.
1995 .SS ip rule show - list rules
1996 This command has no arguments.
1997 The options list or lst are synonyms with show.
1999 .SH ip maddress - multicast addresses management
2002 objects are multicast addresses.
2004 .SS ip maddress show - list multicast addresses
2007 .BI dev " NAME " (default)
2010 .SS ip maddress add - add a multicast address
2011 .SS ip maddress delete - delete a multicast address
2012 these commands attach/detach a static link layer multicast address
2013 to listen on the interface.
2014 Note that it is impossible to join protocol multicast groups
2015 statically. This command only manages link layer addresses.
2018 .BI address " LLADDRESS " (default)
2019 the link layer multicast address.
2023 the device to join/leave this multicast address.
2025 .SH ip mroute - multicast routing cache management
2027 objects are multicast routing cache entries created by a user level
2028 mrouting daemon (f.e.
2034 Due to the limitations of the current interface to the multicast routing
2035 engine, it is impossible to change
2037 objects administratively, so we may only display them. This limitation
2038 will be removed in the future.
2040 .SS ip mroute show - list mroute cache entries
2043 .BI to " PREFIX " (default)
2044 the prefix selecting the destination multicast addresses to list.
2048 the interface on which multicast packets are received.
2052 the prefix selecting the IP source addresses of the multicast route.
2054 .SH ip tunnel - tunnel configuration
2056 objects are tunnels, encapsulating packets in IP packets and then
2057 sending them over the IP infrastructure.
2058 The encapulating (or outer) address family is specified by the
2060 option. The default is IPv4.
2062 .SS ip tunnel add - add a new tunnel
2063 .SS ip tunnel change - change an existing tunnel
2064 .SS ip tunnel delete - destroy a tunnel
2067 .BI name " NAME " (default)
2068 select the tunnel device name.
2072 set the tunnel mode. Available modes depend on the encapsulating address family.
2074 Modes for IPv4 encapsulation available:
2075 .BR ipip ", " sit ", " isatap " and " gre "."
2077 Modes for IPv6 encapsulation available:
2078 .BR ip6ip6 ", " ipip6 " and " any "."
2081 .BI remote " ADDRESS"
2082 set the remote endpoint of the tunnel.
2085 .BI local " ADDRESS"
2086 set the fixed local address for tunneled packets.
2087 It must be an address on another interface of this host.
2093 on tunneled packets.
2095 is a number in the range 1--255. 0 is a special value
2096 meaning that packets inherit the TTL value.
2097 The default value for IPv4 tunnels is:
2099 The default value for IPv6 tunnels is:
2109 set a fixed TOS (or traffic class in IPv6)
2111 on tunneled packets.
2112 The default value is:
2117 bind the tunnel to the device
2119 so that tunneled packets will only be routed via this device and will
2120 not be able to escape to another device when the route to endpoint
2125 disable Path MTU Discovery on this tunnel.
2126 It is enabled by default. Note that a fixed ttl is incompatible
2127 with this option: tunnelling with a fixed ttl always makes pmtu
2136 .RB ( " only GRE tunnels " )
2137 use keyed GRE with key
2139 is either a number or an IP address-like dotted quad.
2142 parameter sets the key to use in both directions.
2144 .BR ikey " and " okey
2145 parameters set different keys for input and output.
2148 .BR csum ", " icsum ", " ocsum
2149 .RB ( " only GRE tunnels " )
2150 generate/require checksums for tunneled packets.
2153 flag calculates checksums for outgoing packets.
2156 flag requires that all input packets have the correct
2159 flag is equivalent to the combination
2163 .BR seq ", " iseq ", " oseq
2164 .RB ( " only GRE tunnels " )
2168 flag enables sequencing of outgoing packets.
2171 flag requires that all input packets are serialized.
2174 flag is equivalent to the combination
2176 .B It isn't work. Don't use it.
2180 .RB ( " only IPv6 tunnels " )
2181 Inherit DS field between inner and outer header.
2184 .BI encaplim " ELIM"
2185 .RB ( " only IPv6 tunnels " )
2186 set a fixed encapsulation limit. Default is 4.
2189 .BI flowlabel " FLOWLABEL"
2190 .RB ( " only IPv6 tunnels " )
2191 set a fixed flowlabel.
2193 .SS ip tunnel prl - potential router list (ISATAP only)
2197 mandatory device name.
2200 .BI prl-default " ADDR"
2202 .BI prl-nodefault " ADDR"
2204 .BI prl-delete " ADDR"
2205 .RB "Add or delete " ADDR
2206 as a potential router or default router.
2208 .SS ip tunnel show - list tunnels
2209 This command has no arguments.
2211 .SH ip monitor and rtmon - state monitoring
2215 utility can monitor the state of devices, addresses
2216 and routes continuously. This option has a slightly different format.
2219 command is the first in the command line and then the object list follows:
2221 .BR "ip monitor" " [ " all " |"
2222 .IR LISTofOBJECTS " ]"
2225 is the list of object types that we want to monitor.
2227 .BR link ", " address " and " route "."
2232 opens RTNETLINK, listens on it and dumps state changes in the format
2233 described in previous sections.
2236 If a file name is given, it does not listen on RTNETLINK,
2237 but opens the file containing RTNETLINK messages saved in binary format
2238 and dumps them. Such a history file can be generated with the
2240 utility. This utility has a command line syntax similar to
2244 should be started before the first network configuration command
2245 is issued. F.e. if you insert:
2248 rtmon file /var/log/rtmon.log
2251 in a startup script, you will be able to view the full history
2255 Certainly, it is possible to start
2258 It prepends the history with the state snapshot dumped at the moment
2261 .SH ip xfrm - setting xfrm
2262 xfrm is an IP framework, which can transform format of the datagrams,
2264 i.e. encrypt the packets with some algorithm. xfrm policy and xfrm state
2265 are associated through templates
2267 This framework is used as a part of IPsec protocol.
2269 .SS ip xfrm state add - add new state into xfrm
2271 .SS ip xfrm state update - update existing xfrm state
2273 .SS ip xfrm state allocspi - allocate SPI value
2277 is set as default to
2279 but it could be set to
2280 .BR tunnel "," ro " or " beet "."
2284 contains one or more flags.
2289 .BR noecn ", " decap-dscp " or " wildrecv "."
2293 encapsulation is set to encapsulation type
2294 .IR ENCAP-TYPE ", source port " SPORT ", destination port " DPORT " and " OADDR "."
2299 .BR espinudp " or " espinudp-nonike "."
2303 contains one or more algorithms
2305 which depend on the type of algorithm set by
2307 It can be used these algoritms
2308 .BR enc ", " auth " or " comp "."
2310 .SS ip xfrm policy add - add a new policy
2312 .SS ip xfrm policy update - update an existing policy
2314 .SS ip xfrm policy delete - delete existing policy
2316 .SS ip xfrm policy get - get existing policy
2318 .SS ip xfrm policy deleteall - delete all existing xfrm policy
2320 .SS ip xfrm policy list - print out the list of xfrm policy
2322 .SS ip xfrm policy flush - flush policies
2325 policies or only those specified with
2330 directory could be one of these:
2331 .BR "inp", " out " or " fwd".
2335 selects for which addresses will be set up the policy. The selector
2336 is defined by source and destination address.
2340 is defined by source port
2350 specify network device.
2354 the number of indexed policy.
2358 type is set as default on
2364 .BI action " ACTION "
2365 is set as default on
2367 It could be switch on
2371 .BI priority " PRIORITY "
2372 priority is a number. Default priority is set on zero.
2376 limits are set in seconds, bytes or numbers of packets.
2380 template list is based on
2382 .BR mode ", " reqid " and " level ". "
2386 is specified by source address, destination address,
2394 .BR esp ", " ah ", " comp ", " route2 " or " hao "."
2398 is set as default on
2400 but it could be set on
2401 .BR tunnel " or " beet "."
2405 is set as default on
2407 and the other choice is
2419 .SS ip xfrm monitor - is used for listing all objects or defined group of them.
2422 can monitor the policies for all objects or defined group of them.
2426 was written by Alexey N. Kuznetsov and added in Linux 2.2.
2430 .RB "IP Command reference " ip-cref.ps
2432 .RB "IP tunnels " ip-cref.ps
2434 .RB "User documentation at " http://lartc.org/ ", but please direct bugreports and patches to: " <netdev@vger.kernel.org>
2437 Original Manpage by Michail Litvak <mci@owl.openwall.com>