|
|
049c96 |
From de15ee438be780578c0dec2ece6f96cd511b43e5 Mon Sep 17 00:00:00 2001
|
|
|
049c96 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
049c96 |
Date: Thu, 18 Feb 2016 13:21:45 +0100
|
|
|
049c96 |
Subject: [PATCH] ip-address: fix and extend documentation
|
|
|
049c96 |
MIME-Version: 1.0
|
|
|
049c96 |
Content-Type: text/plain; charset=UTF-8
|
|
|
049c96 |
Content-Transfer-Encoding: 8bit
|
|
|
049c96 |
|
|
|
049c96 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1231898
|
|
|
049c96 |
Upstream Status: iproute2.git commit 4e972d5ef41b2
|
|
|
049c96 |
|
|
|
049c96 |
commit 4e972d5ef41b28679a8125ed5289496284a9157f
|
|
|
049c96 |
Author: Pavel Šimerda <psimerda@redhat.com>
|
|
|
049c96 |
Date: Wed Aug 12 22:04:08 2015 +0200
|
|
|
049c96 |
|
|
|
049c96 |
ip-address: fix and extend documentation
|
|
|
049c96 |
|
|
|
049c96 |
* Improve manual page synopsis and built-it help
|
|
|
049c96 |
* Use full subcommand names (e.g. 'address' and 'maddress')
|
|
|
049c96 |
* Specify when IPv4, IPv6 or both are affected
|
|
|
049c96 |
* Add lifetimes, home and nodad
|
|
|
049c96 |
* Remove any remaining excess spaces
|
|
|
049c96 |
|
|
|
049c96 |
Commit 43d29f7 substantially improves generated ip-address.8 instead of
|
|
|
049c96 |
ip-address.8.in and commit e419f2d removes the generated one losing the
|
|
|
049c96 |
improvements entirely. This commit recovers the lost changes, adapts
|
|
|
049c96 |
them to the current manual page and adds more man page and help
|
|
|
049c96 |
improvements.
|
|
|
049c96 |
|
|
|
049c96 |
Original commit by: Kenyon Ralph <kenyon@kenyonralph.com>
|
|
|
049c96 |
---
|
|
|
049c96 |
ip/ipaddress.c | 16 +++----
|
|
|
049c96 |
man/man8/ip-address.8.in | 117 +++++++++++++++++++++++++++++++++++++----------
|
|
|
049c96 |
2 files changed, 100 insertions(+), 33 deletions(-)
|
|
|
049c96 |
|
|
|
049c96 |
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
|
|
|
049c96 |
index 1e0728c..e4da5b1 100644
|
|
|
049c96 |
--- a/ip/ipaddress.c
|
|
|
049c96 |
+++ b/ip/ipaddress.c
|
|
|
049c96 |
@@ -68,15 +68,15 @@ static void usage(void)
|
|
|
049c96 |
if (do_link) {
|
|
|
049c96 |
iplink_usage();
|
|
|
049c96 |
}
|
|
|
049c96 |
- fprintf(stderr, "Usage: ip addr {add|change|replace} IFADDR dev STRING [ LIFETIME ]\n");
|
|
|
049c96 |
+ fprintf(stderr, "Usage: ip address {add|change|replace} IFADDR dev IFNAME [ LIFETIME ]\n");
|
|
|
049c96 |
fprintf(stderr, " [ CONFFLAG-LIST ]\n");
|
|
|
049c96 |
- fprintf(stderr, " ip addr del IFADDR dev STRING [mngtmpaddr]\n");
|
|
|
049c96 |
- fprintf(stderr, " ip addr {show|save|flush} [ dev STRING ] [ scope SCOPE-ID ]\n");
|
|
|
049c96 |
- fprintf(stderr, " [ to PREFIX ] [ FLAG-LIST ] [ label PATTERN ] [up]\n");
|
|
|
049c96 |
- fprintf(stderr, " ip addr {showdump|restore}\n");
|
|
|
049c96 |
+ fprintf(stderr, " ip address del IFADDR dev IFNAME [mngtmpaddr]\n");
|
|
|
049c96 |
+ fprintf(stderr, " ip address {show|save|flush} [ dev IFNAME ] [ scope SCOPE-ID ]\n");
|
|
|
049c96 |
+ fprintf(stderr, " [ to PREFIX ] [ FLAG-LIST ] [ label LABEL ] [up]\n");
|
|
|
049c96 |
+ fprintf(stderr, " ip address {showdump|restore}\n");
|
|
|
049c96 |
fprintf(stderr, "IFADDR := PREFIX | ADDR peer PREFIX\n");
|
|
|
049c96 |
fprintf(stderr, " [ broadcast ADDR ] [ anycast ADDR ]\n");
|
|
|
049c96 |
- fprintf(stderr, " [ label STRING ] [ scope SCOPE-ID ]\n");
|
|
|
049c96 |
+ fprintf(stderr, " [ label IFNAME ] [ scope SCOPE-ID ]\n");
|
|
|
049c96 |
fprintf(stderr, "SCOPE-ID := [ host | link | global | NUMBER ]\n");
|
|
|
049c96 |
fprintf(stderr, "FLAG-LIST := [ FLAG-LIST ] FLAG\n");
|
|
|
049c96 |
fprintf(stderr, "FLAG := [ permanent | dynamic | secondary | primary |\n");
|
|
|
049c96 |
@@ -968,7 +968,7 @@ static int ipadd_dump_check_magic(void)
|
|
|
049c96 |
__u32 magic = 0;
|
|
|
049c96 |
|
|
|
049c96 |
if (isatty(STDIN_FILENO)) {
|
|
|
049c96 |
- fprintf(stderr, "Can't restore addr dump from a terminal\n");
|
|
|
049c96 |
+ fprintf(stderr, "Can't restore address dump from a terminal\n");
|
|
|
049c96 |
return -1;
|
|
|
049c96 |
}
|
|
|
049c96 |
|
|
|
049c96 |
@@ -1606,6 +1606,6 @@ int do_ipaddr(int argc, char **argv)
|
|
|
049c96 |
return ipaddr_restore();
|
|
|
049c96 |
if (matches(*argv, "help") == 0)
|
|
|
049c96 |
usage();
|
|
|
049c96 |
- fprintf(stderr, "Command \"%s\" is unknown, try \"ip addr help\".\n", *argv);
|
|
|
049c96 |
+ fprintf(stderr, "Command \"%s\" is unknown, try \"ip address help\".\n", *argv);
|
|
|
049c96 |
exit(-1);
|
|
|
049c96 |
}
|
|
|
049c96 |
diff --git a/man/man8/ip-address.8.in b/man/man8/ip-address.8.in
|
|
|
049c96 |
index 6e46af8..2ea3e67 100644
|
|
|
049c96 |
--- a/man/man8/ip-address.8.in
|
|
|
049c96 |
+++ b/man/man8/ip-address.8.in
|
|
|
049c96 |
@@ -14,18 +14,26 @@ ip-address \- protocol address management
|
|
|
049c96 |
.sp
|
|
|
049c96 |
|
|
|
049c96 |
.ti -8
|
|
|
049c96 |
-.BR "ip address" " { " add " | " del " } "
|
|
|
049c96 |
-.IB IFADDR " dev " STRING
|
|
|
049c96 |
+.BR "ip address" " { " add " | " change " | " replace " } "
|
|
|
049c96 |
+.IB IFADDR " dev " IFNAME
|
|
|
049c96 |
+.RI "[ " LIFETIME " ] [ " CONFFLAG-LIST " ]"
|
|
|
049c96 |
|
|
|
049c96 |
.ti -8
|
|
|
049c96 |
-.BR "ip address" " { " show " | " flush " } [ " dev
|
|
|
049c96 |
-.IR STRING " ] [ "
|
|
|
049c96 |
+.BR "ip address del"
|
|
|
049c96 |
+.IB IFADDR " dev " IFNAME " [ " mngtmpaddr " ]"
|
|
|
049c96 |
+
|
|
|
049c96 |
+.ti -8
|
|
|
049c96 |
+.BR "ip address" " { " show " | " save " | " flush " } [ " dev
|
|
|
049c96 |
+.IR IFNAME " ] [ "
|
|
|
049c96 |
.B scope
|
|
|
049c96 |
.IR SCOPE-ID " ] [ "
|
|
|
049c96 |
.B to
|
|
|
049c96 |
.IR PREFIX " ] [ " FLAG-LIST " ] [ "
|
|
|
049c96 |
.B label
|
|
|
049c96 |
-.IR PATTERN " ]"
|
|
|
049c96 |
+.IR PATTERN " ] [ " up " ]"
|
|
|
049c96 |
+
|
|
|
049c96 |
+.ti -8
|
|
|
049c96 |
+.BR "ip address" " { " showdump " | " restore " }"
|
|
|
049c96 |
|
|
|
049c96 |
.ti -8
|
|
|
049c96 |
.IR IFADDR " := " PREFIX " | " ADDR
|
|
|
049c96 |
@@ -36,7 +44,7 @@ ip-address \- protocol address management
|
|
|
049c96 |
.B anycast
|
|
|
049c96 |
.IR ADDR " ] [ "
|
|
|
049c96 |
.B label
|
|
|
049c96 |
-.IR STRING " ] [ "
|
|
|
049c96 |
+.IR LABEL " ] [ "
|
|
|
049c96 |
.B scope
|
|
|
049c96 |
.IR SCOPE-ID " ]"
|
|
|
049c96 |
|
|
|
049c96 |
@@ -52,15 +60,33 @@ ip-address \- protocol address management
|
|
|
049c96 |
.IR FLAG " := "
|
|
|
049c96 |
.RB "[ " permanent " | " dynamic " | " secondary " | " primary " | \
|
|
|
049c96 |
[ - ] " tentative " | [ - ] " deprecated " | [ - ] " dadfailed " | "\
|
|
|
049c96 |
-temporary " ]"
|
|
|
049c96 |
+temporary " ] " CONFFLAG-LIST " ]"
|
|
|
049c96 |
+
|
|
|
049c96 |
+.ti -8
|
|
|
049c96 |
+.IR CONFFLAG-LIST " := [ " CONFFLAG-LIST " ] " CONFFLAG
|
|
|
049c96 |
+
|
|
|
049c96 |
+.ti -8
|
|
|
049c96 |
+.IR CONFFLAG " := "
|
|
|
049c96 |
+.RB "[ " home " | " nodad " ]"
|
|
|
049c96 |
+
|
|
|
049c96 |
+.ti -8
|
|
|
049c96 |
+.IR LIFETIME " := [ "
|
|
|
049c96 |
+.BI valid_lft " LFT"
|
|
|
049c96 |
+.RB "| " preferred_lft
|
|
|
049c96 |
+.IR LFT " ]"
|
|
|
049c96 |
+
|
|
|
049c96 |
+.ti -8
|
|
|
049c96 |
+.IR LFT " := [ "
|
|
|
049c96 |
+.BR forever " |"
|
|
|
049c96 |
+.IR SECONDS " ]"
|
|
|
049c96 |
|
|
|
049c96 |
.SH "DESCRIPTION"
|
|
|
049c96 |
The
|
|
|
049c96 |
.B address
|
|
|
049c96 |
-is a protocol (IP or IPv6) address attached
|
|
|
049c96 |
-to a network device. Each device must have at least one address
|
|
|
049c96 |
-to use the corresponding protocol. It is possible to have several
|
|
|
049c96 |
-different addresses attached to one device. These addresses are not
|
|
|
049c96 |
+is a protocol (IPv4 or IPv6) address attached
|
|
|
049c96 |
+to a network device. Each device must have at least one address
|
|
|
049c96 |
+to use the corresponding protocol. It is possible to have several
|
|
|
049c96 |
+different addresses attached to one device. These addresses are not
|
|
|
049c96 |
discriminated, so that the term
|
|
|
049c96 |
.B alias
|
|
|
049c96 |
is not quite appropriate for them and we do not use it in this document.
|
|
|
049c96 |
@@ -73,7 +99,7 @@ and deletes old ones.
|
|
|
049c96 |
.SS ip address add - add new protocol address.
|
|
|
049c96 |
|
|
|
049c96 |
.TP
|
|
|
049c96 |
-.BI dev " NAME"
|
|
|
049c96 |
+.BI dev " IFNAME "
|
|
|
049c96 |
the name of the device to add the address to.
|
|
|
049c96 |
|
|
|
049c96 |
.TP
|
|
|
049c96 |
@@ -107,7 +133,7 @@ instead of the broadcast address. In this case, the broadcast address
|
|
|
049c96 |
is derived by setting/resetting the host bits of the interface prefix.
|
|
|
049c96 |
|
|
|
049c96 |
.TP
|
|
|
049c96 |
-.BI label " NAME"
|
|
|
049c96 |
+.BI label " LABEL"
|
|
|
049c96 |
Each address may be tagged with a label string.
|
|
|
049c96 |
In order to preserve compatibility with Linux-2.0 net aliases,
|
|
|
049c96 |
this string must coincide with the name of the device or must be prefixed
|
|
|
049c96 |
@@ -125,7 +151,7 @@ Predefined scope values are:
|
|
|
049c96 |
- the address is globally valid.
|
|
|
049c96 |
.sp
|
|
|
049c96 |
.B site
|
|
|
049c96 |
-- (IPv6 only) the address is site local, i.e. it is
|
|
|
049c96 |
+- (IPv6 only, deprecated) the address is site local, i.e. it is
|
|
|
049c96 |
valid inside this site.
|
|
|
049c96 |
.sp
|
|
|
049c96 |
.B link
|
|
|
049c96 |
@@ -135,6 +161,30 @@ valid inside this site.
|
|
|
049c96 |
- the address is valid only inside this host.
|
|
|
049c96 |
.in -8
|
|
|
049c96 |
|
|
|
049c96 |
+.TP
|
|
|
049c96 |
+.BI valid_lft " LFT"
|
|
|
049c96 |
+the valid lifetime of this address; see section 5.5.4 of
|
|
|
049c96 |
+RFC 4862. When it expires, the address is removed by the kernel.
|
|
|
049c96 |
+Defaults to
|
|
|
049c96 |
+.BR "forever" .
|
|
|
049c96 |
+
|
|
|
049c96 |
+.TP
|
|
|
049c96 |
+.BI preferred_lft " LFT"
|
|
|
049c96 |
+the preferred lifetime of this address; see section 5.5.4
|
|
|
049c96 |
+of RFC 4862. When it expires, the address is no longer used for new
|
|
|
049c96 |
+outgoing connections. Defaults to
|
|
|
049c96 |
+.BR "forever" .
|
|
|
049c96 |
+
|
|
|
049c96 |
+.TP
|
|
|
049c96 |
+.B home
|
|
|
049c96 |
+(IPv6 only) designates this address the "home address" as defined in
|
|
|
049c96 |
+RFC 6275.
|
|
|
049c96 |
+
|
|
|
049c96 |
+.TP
|
|
|
049c96 |
+.B nodad
|
|
|
049c96 |
+(IPv6 only) do not perform Duplicate Address Detection (RFC 4862) when
|
|
|
049c96 |
+adding this address.
|
|
|
049c96 |
+
|
|
|
049c96 |
.SS ip address delete - delete protocol address
|
|
|
049c96 |
.B Arguments:
|
|
|
049c96 |
coincide with the arguments of
|
|
|
049c96 |
@@ -145,7 +195,7 @@ If no arguments are given, the first address is deleted.
|
|
|
049c96 |
.SS ip address show - look at protocol addresses
|
|
|
049c96 |
|
|
|
049c96 |
.TP
|
|
|
049c96 |
-.BI dev " NAME " (default)
|
|
|
049c96 |
+.BI dev " IFNAME " (default)
|
|
|
049c96 |
name of device.
|
|
|
049c96 |
|
|
|
049c96 |
.TP
|
|
|
049c96 |
@@ -219,36 +269,53 @@ The difference is that it does not run when no arguments are given.
|
|
|
049c96 |
|
|
|
049c96 |
.PP
|
|
|
049c96 |
.B Warning:
|
|
|
049c96 |
-This command (and other
|
|
|
049c96 |
+This command and other
|
|
|
049c96 |
.B flush
|
|
|
049c96 |
-commands described below) is pretty dangerous. If you make a mistake,
|
|
|
049c96 |
-it will not forgive it, but will cruelly purge all the addresses.
|
|
|
049c96 |
+commands are unforgiving. They will cruelly purge all the addresses.
|
|
|
049c96 |
|
|
|
049c96 |
.PP
|
|
|
049c96 |
With the
|
|
|
049c96 |
.B -statistics
|
|
|
049c96 |
option, the command becomes verbose. It prints out the number of deleted
|
|
|
049c96 |
-addresses and the number of rounds made to flush the address list. If
|
|
|
049c96 |
-this option is given twice,
|
|
|
049c96 |
+addresses and the number of rounds made to flush the address list.
|
|
|
049c96 |
+If this option is given twice,
|
|
|
049c96 |
.B ip address flush
|
|
|
049c96 |
also dumps all the deleted addresses in the format described in the
|
|
|
049c96 |
previous subsection.
|
|
|
049c96 |
|
|
|
049c96 |
.SH "EXAMPLES"
|
|
|
049c96 |
.PP
|
|
|
049c96 |
+ip address show
|
|
|
049c96 |
+.RS 4
|
|
|
049c96 |
+Shows IPv4 and IPv6 addresses assigned to all network interfaces. The 'show'
|
|
|
049c96 |
+subcommand can be omitted.
|
|
|
049c96 |
+.RE
|
|
|
049c96 |
+.PP
|
|
|
049c96 |
+ip address show up
|
|
|
049c96 |
+.RS 4
|
|
|
049c96 |
+Same as above except that only addresses assigned to active network interfaces
|
|
|
049c96 |
+are shown.
|
|
|
049c96 |
+.RE
|
|
|
049c96 |
+.PP
|
|
|
049c96 |
ip address show dev eth0
|
|
|
049c96 |
.RS 4
|
|
|
049c96 |
-Shows the addresses assigned to network interface eth0
|
|
|
049c96 |
+Shows IPv4 and IPv6 addresses assigned to network interface eth0.
|
|
|
049c96 |
+.RE
|
|
|
049c96 |
+.PP
|
|
|
049c96 |
+ip address add 2001:0db8:85a3::0370:7334/64 dev eth1
|
|
|
049c96 |
+.RS 4
|
|
|
049c96 |
+Adds an IPv6 address to network interface eth1.
|
|
|
049c96 |
.RE
|
|
|
049c96 |
.PP
|
|
|
049c96 |
-ip addr add 2001:0db8:85a3::0370:7334/64 dev eth1
|
|
|
049c96 |
+ip address delete 2001:0db8:85a3::0370:7334/64 dev eth1
|
|
|
049c96 |
.RS 4
|
|
|
049c96 |
-Adds an IPv6 address to network interface eth1
|
|
|
049c96 |
+Delete the IPv6 address added above.
|
|
|
049c96 |
.RE
|
|
|
049c96 |
.PP
|
|
|
049c96 |
-ip addr flush dev eth4
|
|
|
049c96 |
+ip address flush dev eth4 scope global
|
|
|
049c96 |
.RS 4
|
|
|
049c96 |
-Removes all addresses from device eth4
|
|
|
049c96 |
+Removes all global IPv4 and IPv6 addresses from device eth4. Without 'scope
|
|
|
049c96 |
+global' it would remove all addresses including IPv6 link-local ones.
|
|
|
049c96 |
.RE
|
|
|
049c96 |
|
|
|
049c96 |
.SH SEE ALSO
|
|
|
049c96 |
--
|
|
|
049c96 |
1.8.3.1
|
|
|
049c96 |
|