diff options
author | hrs <hrs@FreeBSD.org> | 2013-06-20 02:29:49 +0000 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2013-06-20 02:29:49 +0000 |
commit | 754a6006f2fc6e7c09e7656fc738654fe481b4ae (patch) | |
tree | 473badaa437418b08dd688e954e3379e044324d5 /share | |
parent | 6d920417d87055c3f6c9c8e690cac2cce558c6c5 (diff) | |
download | FreeBSD-src-754a6006f2fc6e7c09e7656fc738654fe481b4ae.zip FreeBSD-src-754a6006f2fc6e7c09e7656fc738654fe481b4ae.tar.gz |
- Add CIDR notation support like 192.168.1-2.10-16/24 to $ifconfig_IF_aliasN.
This is an extended version of ipv4_addr_IF which supports both IPv4 and
IPv6, and multiple range specifications. To avoid to generate too many
addresses, the maximum number of the generated addresses is currently
limited to 31.
- Add $ifconfig_IF_aliases, which accepts multiple IP aliases in a variable.
- ipv6_prefix_IF now supports !/64 prefix length. In addition to the old
64-bit format (2001:db8:1:1), a full 128-bit format like 2001:db8:1:1::/64
is supported.
- Replace ifconfig command with $IFCONFIG_CMD variable to support
a dry-run mode in the future.
- Remove IP aliases before removing all of IPv4 addresses when doing
"rc.d/netif down".
- Add a DAD wait to network6_getladdr() because it is possible to fail to
configure an EUI64 address when ipv6_prefix_IF is specified.
A summary of the supported ifconfig_* variables is as follows:
# IPv4 configuration.
ifconfig_em0="inet 192.168.0.1"
# IPv6 configuration.
ifconfig_em0_ipv6="inet6 2001:db8::1/64"
# IPv4 address range spec. Now deprecated.
ipv4_addr_em0="10.2.1.1-10"
# IPv6 alias.
ifconfig_em0_alias0="inet6 2001:db8:5::1 prefixlen 70"
# IPv4 alias.
ifconfig_em0_alias1="inet 10.2.2.1/24"
# IPv4 alias with range spec w/o AF keyword (backward compat).
ifconfig_em0_alias2="10.3.1.1-10/32"
# IPv6 alias with range spec.
ifconfig_em0_alias3="inet6 2001:db8:20-2f::1/64"
# ifconfig_IF_aliases is just like ifconfig_IF_aliasN.
ifconfig_em0_aliases="inet 10.3.3.201-204/24 inet6 2001:db8:210-213::1/64 inet 10.1.1.1/24"
# IPv6 alias (backward compat)
ipv6_ifconfig_em0_alias0="inet6 2001:db8:f::1/64"
# IPv6 alias w/o AF keyword (backward compat)
ipv6_ifconfig_em0_alias1="2001:db8:f:1::1/64"
# IPv6 prefix.
ipv6_prefix_em0="2001:db8::/64"
Tested by: Kimmo Paasiala
Diffstat (limited to 'share')
-rw-r--r-- | share/man/man5/rc.conf.5 | 85 |
1 files changed, 59 insertions, 26 deletions
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 63c0ea2..03337cd 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 9, 2013 +.Dd June 20, 2013 .Dt RC.CONF 5 .Os .Sh NAME @@ -1124,44 +1124,63 @@ Such keywords are removed before passing the value to .Xr ifconfig 8 while the order of the other arguments is preserved. .Pp -One can configure more than one IPv4 address with the -.Va ipv4_addrs_ Ns Aq Ar interface -variable. -One or more IP addresses must be provided in Classless Inter-Domain -Routing (CIDR) address notation, whose last byte can be a range like -192.0.2.5-23/24. -In this case the address 192.0.2.5 will be configured with the +It is possible to add IP alias entries using +.Xr ifconfig 8 +syntax with the address family keyword such as +.Li inet . +Assuming that the interface in question was +.Li ed0 , +it might look something like this: +.Bd -literal +ifconfig_ed0_alias0="inet 127.0.0.253 netmask 0xffffffff" +ifconfig_ed0_alias1="inet 127.0.0.254 netmask 0xffffffff" +.Ed +.Pp +It also possible to configure multiple IP addresses in Classless +Inter-Domain Routing +.Pq CIDR +address notation, +whose each address component can be a range like +.Li inet 192.0.2.5-23/24 +or +.Li inet6 2001:db8:1-f::1/64 . +This notation allows address and prefix length part only, +not the other address modifiers. +.Pp +In the case of +.Li 192.0.2.5-23/24 , +the address 192.0.2.5 will be configured with the netmask /24 and the addresses 192.0.2.6 to 192.0.2.23 with the non-conflicting netmask /32 as explained in the .Xr ifconfig 8 alias section. +Note that this special netmask handling is only for +.Li inet , +not for the other address families such as +.Li inet6 . +.Pp With the interface in question being .Li ed0 , an example could look like: .Bd -literal -ipv4_addrs_ed0="192.0.2.129/27 192.0.2.1-5/28" +ifconfig_ed0_alias2="inet 192.0.2.129/27" +ifconfig_ed0_alias3="inet 192.0.2.1-5/28" .Ed .Pp -It is also possible to add IP alias entries using -.Xr ifconfig 8 -syntax with the -.Dq Li inet -keyword. -Assuming that the interface in question was -.Li ed0 , -it might look -something like this: -.Bd -literal -ifconfig_ed0_alias0="inet 127.0.0.253 netmask 0xffffffff" -ifconfig_ed0_alias1="inet 127.0.0.254 netmask 0xffffffff" -.Ed +and so on. +.Pp +Note that +.Va ipv4_addrs_ Ns Aq Ar interface +variable was supported for IPv4 CIDR address notation. +It is now deprecated because the functionality was integrated into +.Va ifconfig_ Ns Ao Ar interface Ac Ns Va _alias Ns Aq Ar n +though +.Va ipv4_addrs_ Ns Aq Ar interface +is still supported for backward compatibility. .Pp -And so on. For each .Va ifconfig_ Ns Ao Ar interface Ac Ns Va _alias Ns Aq Ar n -entry with the -.Dq Li inet -keyword that is found, +entry with an address family keyword, its contents are passed to .Xr ifconfig 8 . Execution stops at the first unsuccessful access, so if @@ -1182,6 +1201,20 @@ entry. Due to this difficult to manage behavior, the .Va ifconfig_ Ns Ao Ar interface Ac Ns Va _alias Ns Aq Ar n form is deprecated. +There is +.Va ifconfig_ Ns Ao Ar interface Ac Ns Va _aliases +variable, which has the same functionality as +.Va ifconfig_ Ns Ao Ar interface Ac Ns Va _alias Ns Aq Ar n +and can have all of entries in a variable like the following: +.Bd -literal +ifconfig_ed0_aliases="\\ + inet 127.0.0.251 netmask 0xffffffff \\ + inet 127.0.0.252 netmask 0xffffffff \\ + inet 127.0.0.253 netmask 0xffffffff \\ + inet 127.0.0.254 netmask 0xffffffff" +.Ed +.Pp +It also supports CIDR notation. .Pp If the .Pa /etc/start_if. Ns Aq Ar interface |