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 " ]"
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 " |"
221 .BR onlink " | " pervasive " ]"
225 .BR kernel " | " boot " | " static " |"
230 .RB " [ " list " | " add " | " del " | " flush " ]"
234 .IR SELECTOR " := [ "
242 .IR FWMARK[/MASK] " ] [ "
254 .BR prohibit " | " reject " | " unreachable " ] [ " realms
255 .RI "[" SRCREALM "/]" DSTREALM " ]"
258 .IR TABLE_ID " := [ "
259 .BR local " | " main " | " default " |"
263 .BR "ip neigh" " { " add " | " del " | " change " | " replace " } { "
267 .BR nud " { " permanent " | " noarp " | " stale " | " reachable " } ] | " proxy
273 .BR "ip neigh" " { " show " | " flush " } [ " to
281 .BR "ip tunnel" " { " add " | " change " | " del " | " show " }"
291 .RB "[ [" i "|" o "]" seq " ] [ [" i "|" o "]" key
293 .RB "[" i "|" o "]" csum " ] ]"
305 .RB "[ [" no "]" pmtudisc " ]"
308 .RB "[ " "dscp inherit" " ]"
312 .RB " { " ipip " | " gre " | " sit " | " isatap " | " ip6ip6 " | " ipip6 " | " any " }"
315 .IR ADDR " := { " IP_ADDRESS " |"
319 .IR TOS " := { " NUMBER " |"
329 .IR TTL " := { " 1 ".." 255 " | "
333 .IR KEY " := { " DOTTED_QUAD " | " NUMBER " }"
336 .IR TIME " := " NUMBER "[s|ms|us|ns|j]"
339 .BR "ip maddr" " [ " add " | " del " ]"
340 .IB MULTIADDR " dev " STRING
343 .BR "ip maddr show" " [ " dev
347 .BR "ip mroute show" " ["
355 .BR "ip monitor" " [ " all " |"
356 .IR LISTofOBJECTS " ]"
360 .IR XFRM_OBJECT " { " COMMAND " }"
363 .IR XFRM_OBJECT " := { " state " | " policy " | " monitor " } "
366 .BR "ip xfrm state " { " add " | " update " } "
376 .RB " [ " replay-window
390 .BR "ip xfrm state allocspi "
404 .BR "ip xfrm state" " { " delete " | " get " } "
408 .BR "ip xfrm state" " { " deleteall " | " list " } [ "
419 .BR "ip xfrm state flush" " [ " proto
423 .BR "ip xfrm state count"
437 .IR XFRM_PROTO " := "
438 .RB " [ " esp " | " ah " | " comp " | " route2 " | " hao " ] "
442 .RB " [ " transport " | " tunnel " | " ro " | " beet " ] "
443 .B (default=transport)
447 .RI " [ " FLAG-LIST " ] " FLAG
451 .RB " [ " noecn " | " decap-dscp " | " wildrecv " ] "
454 .IR ENCAP " := " ENCAP-TYPE " " SPORT " " DPORT " " OADDR
457 .IR ENCAP-TYPE " := "
463 .IR ALGO-LIST " := [ "
464 .IR ALGO-LIST " ] | [ "
475 .RB " [ " enc " | " auth " | " comp " ] "
480 .IR ADDR "[/" PLEN "]"
482 .IR ADDR "[/" PLEN "]"
483 .RI " [ " UPSPEC " ] "
502 .IR LIMIT-LIST " := [ " LIMIT-LIST " ] |"
508 .RB " [ [" time-soft "|" time-hard "|" time-use-soft "|" time-use-hard "]"
510 .RB "[ ["byte-soft "|" byte-hard "]"
513 .RB " [ ["packet-soft "|" packet-hard "]"
517 .BR "ip xfrm policy" " { " add " | " update " } " " dir "
530 .RI " [ " LIMIT-LIST " ] [ "
534 .BR "ip xfrm policy" " { " delete " | " get " } " " dir "
535 .IR DIR " [ " SELECTOR " | "
544 .BR "ip xfrm policy" " { " deleteall " | " list " } "
557 .B "ip xfrm policy flush"
566 .RB " [ " main " | " sub " ] "
571 .RB " [ " in " | " out " | " fwd " ] "
576 .IR ADDR "[/" PLEN "]"
578 .IR ADDR "[/" PLEN] " [ " UPSPEC
598 .RB " [ " allow " | " block " ]"
602 .IR LIMIT-LIST " := "
604 .IR LIMIT-LIST " ] | "
610 .RB " [ [" time-soft "|" time-hard "|" time-use-soft "|" time-use-hard "]"
612 .RB " [ [" byte-soft "|" byte-hard "]"
615 .RB "[" packet-soft "|" packet-hard "]"
621 .IR TMPL-LIST " ] | "
647 .IR XFRM_PROTO " := "
648 .RB " [ " esp " | " ah " | " comp " | " route2 " | " hao " ] "
652 .RB " [ " transport " | " tunnel " | " beet " ] "
653 .B (default=transport)
657 .RB " [ " required " | " use " ] "
658 .B (default=required)
661 .BR "ip xfrm monitor" " [ " all " | "
662 .IR LISTofOBJECTS " ] "
670 .BR "\-V" , " -Version"
671 print the version of the
676 .BR "\-s" , " \-stats", " \-statistics"
677 output more information. If the option
678 appears twice or more, the amount of information increases.
679 As a rule, the information is statistics or some time values.
682 .BR "\-f" , " \-family"
683 followed by protocol family identifier:
684 .BR "inet" , " inet6"
687 ,enforce the protocol family to use. If the option is not present,
688 the protocol family is guessed from other arguments. If the rest
689 of the command line does not give enough information to guess the
692 falls back to the default one, usually
697 is a special family identifier meaning that no networking protocol
708 .BR "\-family inet6" .
713 .BR "\-family link" .
716 .BR "\-o" , " \-oneline"
717 output each record on a single line, replacing line feeds
720 character. This is convenient when you want to count records
728 .BR "\-r" , " \-resolve"
729 use the system's name resolver to print DNS names instead of
732 .SH IP - COMMAND SYNTAX
743 - protocol (IP or IPv6) address on a device.
747 - label configuration for protocol address selection.
751 - ARP or NDISC cache entry.
755 - routing table entry.
759 - rule in routing policy database.
767 - multicast routing cache entry.
775 - framework for IPsec protocol.
778 The names of all objects may be written in full or
779 abbreviated form, f.e.
789 Specifies the action to perform on the object.
790 The set of possible actions depends on the object type.
791 As a rule, it is possible to
792 .BR "add" , " delete"
797 ) objects, but some objects do not allow all of these operations
798 or have some additional commands. The
800 command is available for all objects. It prints
801 out a list of available commands and argument syntax conventions.
803 If no command is given, some default command is assumed.
806 or, if the objects of this class cannot be listed,
809 .SH ip link - network device configuration
812 is a network device and the corresponding commands
813 display and change the state of devices.
815 .SS ip link set - change device attributes
818 .BI dev " NAME " (default)
820 specifies network device to operate on.
824 change the state of the device to
830 .BR "arp on " or " arp off"
836 .BR "multicast on " or " multicast off"
842 .BR "dynamic on " or " dynamic off"
849 change the name of the device. This operation is not
850 recommended if the device is running or has some addresses
854 .BI txqueuelen " NUMBER"
857 change the transmit queue length of the device.
866 .BI address " LLADDRESS"
867 change the station address of the interface.
870 .BI broadcast " LLADDRESS"
874 .BI peer " LLADDRESS"
875 change the link layer broadcast address or the peer address when
881 move the device to the network namespace associated with the process
886 If multiple parameter changes are requested,
888 aborts immediately after any of the changes have failed.
889 This is the only case when
891 can move the system to an unpredictable state. The solution
892 is to avoid changing several parameters with one
896 .SS ip link show - display device attributes
899 .BI dev " NAME " (default)
901 specifies the network device to show.
902 If this argument is omitted all devices are listed.
906 only display running interfaces.
908 .SH ip address - protocol address management.
912 is a protocol (IP or IPv6) address attached
913 to a network device. Each device must have at least one address
914 to use the corresponding protocol. It is possible to have several
915 different addresses attached to one device. These addresses are not
916 discriminated, so that the term
918 is not quite appropriate for them and we do not use it in this document.
922 command displays addresses and their properties, adds new addresses
923 and deletes old ones.
925 .SS ip address add - add new protocol address.
929 the name of the device to add the address to.
932 .BI local " ADDRESS " (default)
933 the address of the interface. The format of the address depends
934 on the protocol. It is a dotted quad for IP and a sequence of
935 hexadecimal halfwords separated by colons for IPv6. The
937 may be followed by a slash and a decimal number which encodes
938 the network prefix length.
942 the address of the remote endpoint for pointopoint interfaces.
945 may be followed by a slash and a decimal number, encoding the network
946 prefix length. If a peer address is specified, the local address
947 cannot have a prefix length. The network prefix is associated
948 with the peer rather than with the local address.
951 .BI broadcast " ADDRESS"
952 the broadcast address on the interface.
954 It is possible to use the special symbols
958 instead of the broadcast address. In this case, the broadcast address
959 is derived by setting/resetting the host bits of the interface prefix.
963 Each address may be tagged with a label string.
964 In order to preserve compatibility with Linux-2.0 net aliases,
965 this string must coincide with the name of the device or must be prefixed
966 with the device name followed by colon.
969 .BI scope " SCOPE_VALUE"
970 the scope of the area where this address is valid.
971 The available scopes are listed in file
972 .BR "/etc/iproute2/rt_scopes" .
973 Predefined scope values are:
977 - the address is globally valid.
980 - (IPv6 only) the address is site local, i.e. it is
981 valid inside this site.
984 - the address is link local, i.e. it is valid only on this device.
987 - the address is valid only inside this host.
990 .SS ip address delete - delete protocol address
992 coincide with the arguments of
994 The device name is a required argument. The rest are optional.
995 If no arguments are given, the first address is deleted.
997 .SS ip address show - look at protocol addresses
1000 .BI dev " NAME " (default)
1004 .BI scope " SCOPE_VAL"
1005 only list addresses with this scope.
1009 only list addresses matching this prefix.
1012 .BI label " PATTERN"
1013 only list addresses with labels matching the
1016 is a usual shell style pattern.
1019 .BR dynamic " and " permanent
1020 (IPv6 only) only list addresses installed due to stateless
1021 address configuration or only list permanent (not dynamic)
1026 (IPv6 only) only list addresses which did not pass duplicate
1031 (IPv6 only) only list deprecated addresses.
1034 .BR primary " and " secondary
1035 only list primary (or secondary) addresses.
1037 .SS ip address flush - flush protocol addresses
1038 This command flushes the protocol addresses selected by some criteria.
1041 This command has the same arguments as
1043 The difference is that it does not run when no arguments are given.
1047 This command (and other
1049 commands described below) is pretty dangerous. If you make a mistake,
1050 it will not forgive it, but will cruelly purge all the addresses.
1055 option, the command becomes verbose. It prints out the number of deleted
1056 addresses and the number of rounds made to flush the address list. If
1057 this option is given twice,
1059 also dumps all the deleted addresses in the format described in the
1060 previous subsection.
1062 .SH ip addrlabel - protocol address label management.
1064 IPv6 address label is used for address selection
1065 described in RFC 3484. Precedence is managed by userspace,
1066 and only label is stored in kernel.
1068 .SS ip addrlabel add - add an address label
1069 the command adds an address label entry to the kernel.
1071 .BI prefix " PREFIX"
1074 the outgoing interface.
1077 the label for the prefix.
1078 0xffffffff is reserved.
1079 .SS ip addrlabel del - delete an address label
1080 the command deletes an address label entry in the kernel.
1082 coincide with the arguments of
1084 but label is not required.
1085 .SS ip addrlabel list - list address labels
1086 the command show contents of address labels.
1087 .SS ip addrlabel flush - flush address labels
1088 the commoand flushes the contents of address labels and it does not restore default settings.
1089 .SH ip neighbour - neighbour/arp tables management.
1092 objects establish bindings between protocol addresses and
1093 link layer addresses for hosts sharing the same link.
1094 Neighbour entries are organized into tables. The IPv4 neighbour table
1095 is known by another name - the ARP table.
1098 The corresponding commands display neighbour bindings
1099 and their properties, add new neighbour entries and delete old ones.
1101 .SS ip neighbour add - add a new neighbour entry
1102 .SS ip neighbour change - change an existing entry
1103 .SS ip neighbour replace - add a new entry or change an existing one
1105 These commands create new neighbour records or update existing ones.
1108 .BI to " ADDRESS " (default)
1109 the protocol address of the neighbour. It is either an IPv4 or IPv6 address.
1113 the interface to which this neighbour is attached.
1116 .BI lladdr " LLADDRESS"
1117 the link layer address of the neighbour.
1123 .BI nud " NUD_STATE"
1124 the state of the neighbour entry.
1126 is an abbreviation for 'Neigh bour Unreachability Detection'.
1127 The state can take one of the following values:
1131 - the neighbour entry is valid forever and can be only
1132 be removed administratively.
1136 - the neighbour entry is valid. No attempts to validate
1137 this entry will be made but it can be removed when its lifetime expires.
1141 - the neighbour entry is valid until the reachability
1146 - the neighbour entry is valid but suspicious.
1149 does not change the neighbour state if it was valid and the address
1150 is not changed by this command.
1153 .SS ip neighbour delete - delete a neighbour entry
1154 This command invalidates a neighbour entry.
1157 The arguments are the same as with
1158 .BR "ip neigh add" ,
1167 Attempts to delete or manually change a
1169 entry created by the kernel may result in unpredictable behaviour.
1170 Particularly, the kernel may try to resolve this address even
1173 interface or if the address is multicast or broadcast.
1175 .SS ip neighbour show - list neighbour entries
1177 This commands displays neighbour tables.
1180 .BI to " ADDRESS " (default)
1181 the prefix selecting the neighbours to list.
1185 only list the neighbours attached to this device.
1189 only list neighbours which are not currently in use.
1192 .BI nud " NUD_STATE"
1193 only list neighbour entries in this state.
1195 takes values listed below or the special value
1197 which means all states. This option may occur more than once.
1198 If this option is absent,
1200 lists all entries except for
1205 .SS ip neighbour flush - flush neighbour entries
1206 This command flushes neighbour tables, selecting
1207 entries to flush by some criteria.
1210 This command has the same arguments as
1212 The differences are that it does not run when no arguments are given,
1213 and that the default neighbour states to be flushed do not include
1221 option, the command becomes verbose. It prints out the number of
1222 deleted neighbours and the number of rounds made to flush the
1223 neighbour table. If the option is given
1226 also dumps all the deleted neighbours.
1228 .SH ip route - routing table management
1229 Manipulate route entries in the kernel routing tables keep
1230 information about paths to other networked nodes.
1236 - the route entry describes real paths to the destinations covered
1237 by the route prefix.
1241 - these destinations are unreachable. Packets are discarded and the
1245 The local senders get an
1251 - these destinations are unreachable. Packets are discarded silently.
1252 The local senders get an
1258 - these destinations are unreachable. Packets are discarded and the
1260 .I communication administratively prohibited
1261 is generated. The local senders get an
1267 - the destinations are assigned to this host. The packets are looped
1268 back and delivered locally.
1272 - the destinations are broadcast addresses. The packets are sent as
1277 - a special control route used together with policy rules. If such a
1278 route is selected, lookup in this table is terminated pretending that
1279 no route was found. Without policy routing it is equivalent to the
1280 absence of the route in the routing table. The packets are dropped
1281 and the ICMP message
1283 is generated. The local senders get an
1289 - a special NAT route. Destinations covered by the prefix
1290 are considered to be dummy (or external) addresses which require translation
1291 to real (or internal) ones before forwarding. The addresses to translate to
1292 are selected with the attribute
1294 Route NAT is no longer supported in Linux 2.6.
1300 .RI "- " "not implemented"
1301 the destinations are
1303 addresses assigned to this host. They are mainly equivalent
1306 with one difference: such addresses are invalid when used
1307 as the source address of any packet.
1311 - a special type used for multicast routing. It is not present in
1312 normal routing tables.
1317 Linux-2.x can pack routes into several routing
1318 tables identified by a number in the range from 1 to 255 or by
1320 .B /etc/iproute2/rt_tables
1321 By default all normal routes are inserted into the
1323 table (ID 254) and the kernel only uses this table when calculating routes.
1326 Actually, one other table always exists, which is invisible but
1327 even more important. It is the
1329 table (ID 255). This table
1330 consists of routes for local and broadcast addresses. The kernel maintains
1331 this table automatically and the administrator usually need not modify it
1334 The multiple routing tables enter the game when
1338 .SS ip route add - add new route
1339 .SS ip route change - change route
1340 .SS ip route replace - change or add new one
1343 .BI to " TYPE PREFIX " (default)
1344 the destination prefix of the route. If
1354 is an IP or IPv6 address optionally followed by a slash and the
1355 prefix length. If the length of the prefix is missing,
1357 assumes a full-length host route. There is also a special
1360 - which is equivalent to IP
1369 the Type Of Service (TOS) key. This key has no associated mask and
1370 the longest match is understood as: First, compare the TOS
1371 of the route and of the packet. If they are not equal, then the packet
1372 may still match a route with a zero TOS.
1374 is either an 8 bit hexadecimal number or an identifier
1376 .BR "/etc/iproute2/rt_dsfield" .
1379 .BI metric " NUMBER"
1381 .BI preference " NUMBER"
1382 the preference value of the route.
1384 is an arbitrary 32bit number.
1387 .BI table " TABLEID"
1388 the table to add this route to.
1390 may be a number or a string from the file
1391 .BR "/etc/iproute2/rt_tables" .
1392 If this parameter is omitted,
1396 table, with the exception of
1397 .BR local " , " broadcast " and " nat
1398 routes, which are put into the
1404 the output device name.
1408 the address of the nexthop router. Actually, the sense of this field
1409 depends on the route type. For normal
1411 routes it is either the true next hop router or, if it is a direct
1412 route installed in BSD compatibility mode, it can be a local address
1413 of the interface. For NAT routes it is the first address of the block
1414 of translated IP destinations.
1418 the source address to prefer when sending to the destinations
1419 covered by the route prefix.
1422 .BI realm " REALMID"
1423 the realm to which this route is assigned.
1425 may be a number or a string from the file
1426 .BR "/etc/iproute2/rt_realms" .
1431 .BI "mtu lock" " MTU"
1432 the MTU along the path to the destination. If the modifier
1434 is not used, the MTU may be updated by the kernel due to
1435 Path MTU Discovery. If the modifier
1437 is used, no path MTU discovery will be tried, all packets
1438 will be sent without the DF bit in IPv4 case or fragmented
1442 .BI window " NUMBER"
1443 the maximal window for TCP to advertise to these destinations,
1444 measured in bytes. It limits maximal data bursts that our TCP
1445 peers are allowed to send to us.
1449 the initial RTT ('Round Trip Time') estimate. If no suffix is
1450 specified the units are raw values passed directly to the
1451 routing code to maintain compatability with previous releases.
1452 Otherwise if a suffix of s, sec or secs is used to specify
1453 seconds; ms, msec or msecs to specify milliseconds; us, usec
1454 or usecs to specify microseconds; ns, nsec or nsecs to specify
1455 nanoseconds; j, hz or jiffies to specify jiffies, the value is
1456 converted to what the routing code expects.
1460 .BI rttvar " TIME " "(2.3.15+ only)"
1461 the initial RTT variance estimate. Values are specified as with
1466 .BI rto_min " TIME " "(2.6.23+ only)"
1467 the minimum TCP Retransmission TimeOut to use when communicating with this
1468 destination. Values are specified as with
1473 .BI ssthresh " NUMBER " "(2.3.15+ only)"
1474 an estimate for the initial slow start threshold.
1477 .BI cwnd " NUMBER " "(2.3.15+ only)"
1478 the clamp for congestion window. It is ignored if the
1483 .BI advmss " NUMBER " "(2.3.15+ only)"
1484 the MSS ('Maximal Segment Size') to advertise to these
1485 destinations when establishing TCP connections. If it is not given,
1486 Linux uses a default value calculated from the first hop device MTU.
1487 (If the path to these destination is asymmetric, this guess may be wrong.)
1490 .BI reordering " NUMBER " "(2.3.15+ only)"
1491 Maximal reordering on the path to this destination.
1492 If it is not given, Linux uses the value selected with
1495 .BR "net/ipv4/tcp_reordering" .
1498 .BI nexthop " NEXTHOP"
1499 the nexthop of a multipath route.
1501 is a complex value with its own syntax similar to the top level
1506 - is the nexthop router.
1510 - is the output device.
1513 .BI weight " NUMBER"
1514 - is a weight for this element of a multipath
1515 route reflecting its relative bandwidth or quality.
1519 .BI scope " SCOPE_VAL"
1520 the scope of the destinations covered by the route prefix.
1522 may be a number or a string from the file
1523 .BR "/etc/iproute2/rt_scopes" .
1524 If this parameter is omitted,
1533 .BR unicast " and " broadcast
1535 .BR host " for " local
1539 .BI protocol " RTPROTO"
1540 the routing protocol identifier of this route.
1542 may be a number or a string from the file
1543 .BR "/etc/iproute2/rt_protos" .
1544 If the routing protocol ID is not given,
1545 .B ip assumes protocol
1547 (i.e. it assumes the route was added by someone who doesn't
1548 understand what they are doing). Several protocol values have
1549 a fixed interpretation.
1554 - the route was installed due to an ICMP redirect.
1558 - the route was installed by the kernel during autoconfiguration.
1562 - the route was installed during the bootup sequence.
1563 If a routing daemon starts, it will purge all of them.
1567 - the route was installed by the administrator
1568 to override dynamic routing. Routing daemon will respect them
1569 and, probably, even advertise them to its peers.
1573 - the route was installed by Router Discovery protocol.
1577 The rest of the values are not reserved and the administrator is free
1578 to assign (or not to assign) protocol tags.
1582 pretend that the nexthop is directly attached to this link,
1583 even if it does not match any interface prefix.
1587 allow packet by packet randomization on multipath routes.
1588 Without this modifier, the route will be frozen to one selected
1589 nexthop, so that load splitting will only occur on per-flow base.
1591 only works if the kernel is patched.
1593 .SS ip route delete - delete route
1596 has the same arguments as
1597 .BR "ip route add" ,
1598 but their semantics are a bit different.
1601 .RB "(" to ", " tos ", " preference " and " table ")"
1602 select the route to delete. If optional attributes are present,
1604 verifies that they coincide with the attributes of the route to delete.
1605 If no route with the given key and attributes was found,
1609 .SS ip route show - list routes
1610 the command displays the contents of the routing tables or the route(s)
1611 selected by some criteria.
1614 .BI to " SELECTOR " (default)
1615 only select routes from the given range of destinations.
1617 consists of an optional modifier
1618 .RB "(" root ", " match " or " exact ")"
1621 selects routes with prefixes not shorter than
1625 selects the entire routing table.
1627 selects routes with prefixes not longer than
1630 .BI match " 10.0/16"
1633 .IR 10/8 " and " 0/0 ,
1634 but it does not select
1635 .IR 10.1/16 " and " 10.0.0/24 .
1640 selects routes with this exact prefix. If neither of these options
1645 i.e. it lists the entire table.
1650 only select routes with the given TOS.
1653 .BI table " TABLEID"
1654 show the routes from this table(s). The default setting is to show
1657 may either be the ID of a real table or one of the special values:
1661 - list all of the tables.
1664 - dump the routing cache.
1671 list cloned routes i.e. routes which were dynamically forked from
1672 other routes because some route attribute (f.e. MTU) was updated.
1673 Actually, it is equivalent to
1674 .BR "table cache" "."
1677 .BI from " SELECTOR"
1678 the same syntax as for
1680 but it binds the source address range rather than destinations.
1683 option only works with cloned routes.
1686 .BI protocol " RTPROTO"
1687 only list routes of this protocol.
1690 .BI scope " SCOPE_VAL"
1691 only list routes with this scope.
1695 only list routes of this type.
1699 only list routes going via this device.
1703 only list routes going via the nexthop routers selected by
1708 only list routes with preferred source addresses selected
1713 .BI realm " REALMID"
1715 .BI realms " FROMREALM/TOREALM"
1716 only list routes with these realms.
1718 .SS ip route flush - flush routing tables
1719 this command flushes routes selected by some criteria.
1722 The arguments have the same syntax and semantics as the arguments of
1723 .BR "ip route show" ,
1724 but routing tables are not listed but purged. The only difference is
1727 dumps all the IP main routing table but
1729 prints the helper page.
1734 option, the command becomes verbose. It prints out the number of
1735 deleted routes and the number of rounds made to flush the routing
1736 table. If the option is given
1739 also dumps all the deleted routes in the format described in the
1740 previous subsection.
1742 .SS ip route get - get a single route
1743 this command gets a single route to a destination and prints its
1744 contents exactly as the kernel sees it.
1747 .BI to " ADDRESS " (default)
1748 the destination address.
1758 the Type Of Service.
1762 the device from which this packet is expected to arrive.
1766 force the output device on which this packet will be routed.
1770 if no source address
1771 .RB "(option " from ")"
1772 was given, relookup the route with the source set to the preferred
1773 address received from the first lookup.
1774 If policy routing is used, it may be a different route.
1777 Note that this operation is not equivalent to
1778 .BR "ip route show" .
1780 shows existing routes.
1782 resolves them and creates new clones if necessary. Essentially,
1784 is equivalent to sending a packet along this path.
1787 argument is not given, the kernel creates a route
1788 to output packets towards the requested destination.
1789 This is equivalent to pinging the destination
1791 .BR "ip route ls cache" ,
1792 however, no packets are actually sent. With the
1794 argument, the kernel pretends that a packet arrived from this interface
1795 and searches for a path to forward the packet.
1797 .SH ip rule - routing policy database management
1800 in the routing policy database control the route selection algorithm.
1803 Classic routing algorithms used in the Internet make routing decisions
1804 based only on the destination address of packets (and in theory,
1805 but not in practice, on the TOS field).
1808 In some circumstances we want to route packets differently depending not only
1809 on destination addresses, but also on other packet fields: source address,
1810 IP protocol, transport protocol ports or even packet payload.
1811 This task is called 'policy routing'.
1814 To solve this task, the conventional destination based routing table, ordered
1815 according to the longest match rule, is replaced with a 'routing policy
1816 database' (or RPDB), which selects routes by executing some set of rules.
1819 Each policy routing rule consists of a
1822 .B action predicate.
1823 The RPDB is scanned in the order of increasing priority. The selector
1824 of each rule is applied to {source address, destination address, incoming
1825 interface, tos, fwmark} and, if the selector matches the packet,
1826 the action is performed. The action predicate may return with success.
1827 In this case, it will either give a route or failure indication
1828 and the RPDB lookup is terminated. Otherwise, the RPDB program
1829 continues on the next rule.
1832 Semantically, natural action is to select the nexthop and the output device.
1835 At startup time the kernel configures the default RPDB consisting of three
1840 Priority: 0, Selector: match anything, Action: lookup routing
1846 table is a special routing table containing
1847 high priority control routes for local and broadcast addresses.
1849 Rule 0 is special. It cannot be deleted or overridden.
1853 Priority: 32766, Selector: match anything, Action: lookup routing
1859 table is the normal routing table containing all non-policy
1860 routes. This rule may be deleted and/or overridden with other
1861 ones by the administrator.
1865 Priority: 32767, Selector: match anything, Action: lookup routing
1871 table is empty. It is reserved for some post-processing if no previous
1872 default rules selected the packet.
1873 This rule may also be deleted.
1876 Each RPDB entry has additional
1877 attributes. F.e. each rule has a pointer to some routing
1878 table. NAT and masquerading rules have an attribute to select new IP
1879 address to translate/masquerade. Besides that, rules have some
1880 optional attributes, which routes have, namely
1882 These values do not override those contained in the routing tables. They
1883 are only used if the route did not select any attributes.
1886 The RPDB may contain rules of the following types:
1890 - the rule prescribes to return the route found
1891 in the routing table referenced by the rule.
1894 - the rule prescribes to silently drop the packet.
1897 - the rule prescribes to generate a 'Network is unreachable' error.
1900 - the rule prescribes to generate 'Communication is administratively
1904 - the rule prescribes to translate the source address
1905 of the IP packet into some other value.
1908 .SS ip rule add - insert a new rule
1909 .SS ip rule delete - delete a rule
1912 .BI type " TYPE " (default)
1913 the type of this rule. The list of valid types was given in the previous
1918 select the source prefix to match.
1922 select the destination prefix to match.
1926 select the incoming device to match. If the interface is loopback,
1927 the rule only matches packets originating from this host. This means
1928 that you may create separate routing tables for forwarded and local
1929 packets and, hence, completely segregate them.
1935 select the TOS value to match.
1944 .BI priority " PREFERENCE"
1945 the priority of this rule. Each rule should have an explicitly
1949 The options preference and order are synonyms with priority.
1952 .BI table " TABLEID"
1953 the routing table identifier to lookup if the rule selector matches.
1954 It is also possible to use lookup instead of table.
1957 .BI realms " FROM/TO"
1958 Realms to select if the rule matched and the routing table lookup
1961 is only used if the route did not select any realm.
1965 The base of the IP address block to translate (for source addresses).
1968 may be either the start of the block of NAT addresses (selected by NAT
1969 routes) or a local host address (or even zero).
1970 In the last case the router does not translate the packets, but
1971 masquerades them to this address.
1972 Using map-to instead of nat means the same thing.
1975 Changes to the RPDB made with these commands do not become active
1976 immediately. It is assumed that after a script finishes a batch of
1977 updates, it flushes the routing cache with
1978 .BR "ip route flush cache" .
1980 .SS ip rule flush - also dumps all the deleted rules.
1981 This command has no arguments.
1983 .SS ip rule show - list rules
1984 This command has no arguments.
1985 The options list or lst are synonyms with show.
1987 .SH ip maddress - multicast addresses management
1990 objects are multicast addresses.
1992 .SS ip maddress show - list multicast addresses
1995 .BI dev " NAME " (default)
1998 .SS ip maddress add - add a multicast address
1999 .SS ip maddress delete - delete a multicast address
2000 these commands attach/detach a static link layer multicast address
2001 to listen on the interface.
2002 Note that it is impossible to join protocol multicast groups
2003 statically. This command only manages link layer addresses.
2006 .BI address " LLADDRESS " (default)
2007 the link layer multicast address.
2011 the device to join/leave this multicast address.
2013 .SH ip mroute - multicast routing cache management
2015 objects are multicast routing cache entries created by a user level
2016 mrouting daemon (f.e.
2022 Due to the limitations of the current interface to the multicast routing
2023 engine, it is impossible to change
2025 objects administratively, so we may only display them. This limitation
2026 will be removed in the future.
2028 .SS ip mroute show - list mroute cache entries
2031 .BI to " PREFIX " (default)
2032 the prefix selecting the destination multicast addresses to list.
2036 the interface on which multicast packets are received.
2040 the prefix selecting the IP source addresses of the multicast route.
2042 .SH ip tunnel - tunnel configuration
2044 objects are tunnels, encapsulating packets in IP packets and then
2045 sending them over the IP infrastructure.
2046 The encapulating (or outer) address family is specified by the
2048 option. The default is IPv4.
2050 .SS ip tunnel add - add a new tunnel
2051 .SS ip tunnel change - change an existing tunnel
2052 .SS ip tunnel delete - destroy a tunnel
2055 .BI name " NAME " (default)
2056 select the tunnel device name.
2060 set the tunnel mode. Available modes depend on the encapsulating address family.
2062 Modes for IPv4 encapsulation available:
2063 .BR ipip ", " sit ", " isatap " and " gre "."
2065 Modes for IPv6 encapsulation available:
2066 .BR ip6ip6 ", " ipip6 " and " any "."
2069 .BI remote " ADDRESS"
2070 set the remote endpoint of the tunnel.
2073 .BI local " ADDRESS"
2074 set the fixed local address for tunneled packets.
2075 It must be an address on another interface of this host.
2081 on tunneled packets.
2083 is a number in the range 1--255. 0 is a special value
2084 meaning that packets inherit the TTL value.
2085 The default value for IPv4 tunnels is:
2087 The default value for IPv6 tunnels is:
2097 set a fixed TOS (or traffic class in IPv6)
2099 on tunneled packets.
2100 The default value is:
2105 bind the tunnel to the device
2107 so that tunneled packets will only be routed via this device and will
2108 not be able to escape to another device when the route to endpoint
2113 disable Path MTU Discovery on this tunnel.
2114 It is enabled by default. Note that a fixed ttl is incompatible
2115 with this option: tunnelling with a fixed ttl always makes pmtu
2124 .RB ( " only GRE tunnels " )
2125 use keyed GRE with key
2127 is either a number or an IP address-like dotted quad.
2130 parameter sets the key to use in both directions.
2132 .BR ikey " and " okey
2133 parameters set different keys for input and output.
2136 .BR csum ", " icsum ", " ocsum
2137 .RB ( " only GRE tunnels " )
2138 generate/require checksums for tunneled packets.
2141 flag calculates checksums for outgoing packets.
2144 flag requires that all input packets have the correct
2147 flag is equivalent to the combination
2151 .BR seq ", " iseq ", " oseq
2152 .RB ( " only GRE tunnels " )
2156 flag enables sequencing of outgoing packets.
2159 flag requires that all input packets are serialized.
2162 flag is equivalent to the combination
2164 .B It isn't work. Don't use it.
2168 .RB ( " only IPv6 tunnels " )
2169 Inherit DS field between inner and outer header.
2172 .BI encaplim " ELIM"
2173 .RB ( " only IPv6 tunnels " )
2174 set a fixed encapsulation limit. Default is 4.
2177 .BI flowlabel " FLOWLABEL"
2178 .RB ( " only IPv6 tunnels " )
2179 set a fixed flowlabel.
2181 .SS ip tunnel show - list tunnels
2182 This command has no arguments.
2184 .SH ip monitor and rtmon - state monitoring
2188 utility can monitor the state of devices, addresses
2189 and routes continuously. This option has a slightly different format.
2192 command is the first in the command line and then the object list follows:
2194 .BR "ip monitor" " [ " all " |"
2195 .IR LISTofOBJECTS " ]"
2198 is the list of object types that we want to monitor.
2200 .BR link ", " address " and " route "."
2205 opens RTNETLINK, listens on it and dumps state changes in the format
2206 described in previous sections.
2209 If a file name is given, it does not listen on RTNETLINK,
2210 but opens the file containing RTNETLINK messages saved in binary format
2211 and dumps them. Such a history file can be generated with the
2213 utility. This utility has a command line syntax similar to
2217 should be started before the first network configuration command
2218 is issued. F.e. if you insert:
2221 rtmon file /var/log/rtmon.log
2224 in a startup script, you will be able to view the full history
2228 Certainly, it is possible to start
2231 It prepends the history with the state snapshot dumped at the moment
2234 .SH ip xfrm - setting xfrm
2235 xfrm is an IP framework, which can transform format of the datagrams,
2237 i.e. encrypt the packets with some algorithm. xfrm policy and xfrm state
2238 are associated through templates
2240 This framework is used as a part of IPsec protocol.
2242 .SS ip xfrm state add - add new state into xfrm
2244 .SS ip xfrm state update - update existing xfrm state
2246 .SS ip xfrm state allocspi - allocate SPI value
2250 is set as default to
2252 but it could be set to
2253 .BR tunnel "," ro " or " beet "."
2257 contains one or more flags.
2262 .BR noecn ", " decap-dscp " or " wildrecv "."
2266 encapsulation is set to encapsulation type
2267 .IR ENCAP-TYPE ", source port " SPORT ", destination port " DPORT " and " OADDR "."
2272 .BR espinudp " or " espinudp-nonike "."
2276 contains one or more algorithms
2278 which depend on the type of algorithm set by
2280 It can be used these algoritms
2281 .BR enc ", " auth " or " comp "."
2283 .SS ip xfrm policy add - add a new policy
2285 .SS ip xfrm policy update - update an existing policy
2287 .SS ip xfrm policy delete - delete existing policy
2289 .SS ip xfrm policy get - get existing policy
2291 .SS ip xfrm policy deleteall - delete all existing xfrm policy
2293 .SS ip xfrm policy list - print out the list of xfrm policy
2295 .SS ip xfrm policy flush - flush policies
2298 policies or only those specified with
2303 directory could be one of these:
2304 .BR "inp", " out " or " fwd".
2308 selects for which addresses will be set up the policy. The selector
2309 is defined by source and destination address.
2313 is defined by source port
2323 specify network device.
2327 the number of indexed policy.
2331 type is set as default on
2337 .BI action " ACTION "
2338 is set as default on
2340 It could be switch on
2344 .BI priority " PRIORITY "
2345 priority is a number. Default priority is set on zero.
2349 limits are set in seconds, bytes or numbers of packets.
2353 template list is based on
2355 .BR mode ", " reqid " and " level ". "
2359 is specified by source address, destination address,
2367 .BR esp ", " ah ", " comp ", " route2 " or " hao "."
2371 is set as default on
2373 but it could be set on
2374 .BR tunnel " or " beet "."
2378 is set as default on
2380 and the other choice is
2392 .SS ip xfrm monitor - is used for listing all objects or defined group of them.
2395 can monitor the policies for all objects or defined group of them.
2399 was written by Alexey N. Kuznetsov and added in Linux 2.2.
2403 .RB "IP Command reference " ip-cref.ps
2405 .RB "IP tunnels " ip-cref.ps
2407 .RB "User documentation at " http://lartc.org/ ", but please direct bugreports and patches to: " <netdev@vger.kernel.org>
2410 Original Manpage by Michail Litvak <mci@owl.openwall.com>