mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 04:43:53 +00:00
rc.conf.5: modernise network_interfaces
It's not 1996 anymore, and we use CIDR nowadays. Update the various ifconfig_ examples to use CIDR notation instead of netmasks, and also add an example of a basic ifconfig_ entry that most users will be interested in. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1217
This commit is contained in:
parent
894cb08f0d
commit
cb808de400
|
@ -22,7 +22,7 @@
|
||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd November 13, 2023
|
.Dd May 4, 2024
|
||||||
.Dt RC.CONF 5
|
.Dt RC.CONF 5
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -1420,13 +1420,18 @@ variables as described below.
|
||||||
.Pp
|
.Pp
|
||||||
An
|
An
|
||||||
.Va ifconfig_ Ns Aq Ar interface
|
.Va ifconfig_ Ns Aq Ar interface
|
||||||
variable is also assumed to exist for each value of
|
variable is assumed to exist for each value of
|
||||||
.Ar interface .
|
.Ar interface .
|
||||||
When an interface name contains any of the characters
|
When an interface name contains any of the characters
|
||||||
.Dq Li .-/+
|
.Dq Li .-/+
|
||||||
they are translated to
|
they are translated to
|
||||||
.Dq Li _
|
.Dq Li _
|
||||||
before lookup.
|
before lookup.
|
||||||
|
For example, the interface
|
||||||
|
.Va em0.102
|
||||||
|
would be configured using the variable
|
||||||
|
.Va ifconfig_em0_102 .
|
||||||
|
.Pp
|
||||||
The variable can contain arguments to
|
The variable can contain arguments to
|
||||||
.Xr ifconfig 8 ,
|
.Xr ifconfig 8 ,
|
||||||
as well as special case-insensitive keywords described below.
|
as well as special case-insensitive keywords described below.
|
||||||
|
@ -1434,6 +1439,18 @@ Such keywords are removed before passing the value to
|
||||||
.Xr ifconfig 8
|
.Xr ifconfig 8
|
||||||
while the order of the other arguments is preserved.
|
while the order of the other arguments is preserved.
|
||||||
.Pp
|
.Pp
|
||||||
|
For example, to assign the IPv4 address 192.0.2.1/24 to the interface em0:
|
||||||
|
.Bd -literal
|
||||||
|
ifconfig_em0="inet 192.0.2.1/24 up"
|
||||||
|
.Ed
|
||||||
|
.Pp
|
||||||
|
If the variable
|
||||||
|
.Va ifconfig_ Ns Ao Ar interface Ac Ns Pa _ipv6
|
||||||
|
is set, then
|
||||||
|
.Va ifconfig_ Ns Aq Ar interface
|
||||||
|
does not need to be set unless an IPv4 address should also be assigned to
|
||||||
|
the interface.
|
||||||
|
.Pp
|
||||||
It is possible to add IP alias entries using
|
It is possible to add IP alias entries using
|
||||||
.Xr ifconfig 8
|
.Xr ifconfig 8
|
||||||
syntax with the address family keyword such as
|
syntax with the address family keyword such as
|
||||||
|
@ -1442,8 +1459,8 @@ Assuming that the interface in question was
|
||||||
.Li em0 ,
|
.Li em0 ,
|
||||||
it might look something like this:
|
it might look something like this:
|
||||||
.Bd -literal
|
.Bd -literal
|
||||||
ifconfig_em0_alias0="inet 127.0.0.253 netmask 0xffffffff"
|
ifconfig_em0_alias0="inet 127.0.0.253/32"
|
||||||
ifconfig_em0_alias1="inet 127.0.0.254 netmask 0xffffffff"
|
ifconfig_em0_alias1="inet 127.0.0.254/32"
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
It also possible to configure multiple IP addresses in Classless
|
It also possible to configure multiple IP addresses in Classless
|
||||||
|
@ -1472,12 +1489,12 @@ netif_ipexpand_max="4096"
|
||||||
.Pp
|
.Pp
|
||||||
In the case of
|
In the case of
|
||||||
.Li 192.0.2.5-23/24 ,
|
.Li 192.0.2.5-23/24 ,
|
||||||
the address 192.0.2.5 will be configured with the
|
the address 192.0.2.5 will be configured with the prefix length /24 and the
|
||||||
netmask /24 and the addresses 192.0.2.6 to 192.0.2.23 with
|
addresses 192.0.2.6 to 192.0.2.23 with the non-conflicting prefix length /32 as
|
||||||
the non-conflicting netmask /32 as explained in the
|
explained in the
|
||||||
.Xr ifconfig 8
|
.Xr ifconfig 8
|
||||||
alias section.
|
alias section.
|
||||||
Note that this special netmask handling is only for
|
Note that this special CIDR handling is only for
|
||||||
.Li inet ,
|
.Li inet ,
|
||||||
not for the other address families such as
|
not for the other address families such as
|
||||||
.Li inet6 .
|
.Li inet6 .
|
||||||
|
@ -1509,10 +1526,10 @@ its contents are passed to
|
||||||
Execution stops at the first unsuccessful access, so if
|
Execution stops at the first unsuccessful access, so if
|
||||||
something like this is present:
|
something like this is present:
|
||||||
.Bd -literal
|
.Bd -literal
|
||||||
ifconfig_em0_alias0="inet 127.0.0.251 netmask 0xffffffff"
|
ifconfig_em0_alias0="inet 127.0.0.251/32"
|
||||||
ifconfig_em0_alias1="inet 127.0.0.252 netmask 0xffffffff"
|
ifconfig_em0_alias1="inet 127.0.0.252/32"
|
||||||
ifconfig_em0_alias2="inet 127.0.0.253 netmask 0xffffffff"
|
ifconfig_em0_alias2="inet 127.0.0.253/32"
|
||||||
ifconfig_em0_alias4="inet 127.0.0.254 netmask 0xffffffff"
|
ifconfig_em0_alias4="inet 127.0.0.254/32"
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
Then note that alias4 would
|
Then note that alias4 would
|
||||||
|
@ -1529,13 +1546,13 @@ variable, which has the same functionality as
|
||||||
and can have all of the entries in a variable like the following:
|
and can have all of the entries in a variable like the following:
|
||||||
.Bd -literal
|
.Bd -literal
|
||||||
ifconfig_em0_aliases="\\
|
ifconfig_em0_aliases="\\
|
||||||
inet 127.0.0.251 netmask 0xffffffff \\
|
inet 127.0.0.251/32 \\
|
||||||
inet 127.0.0.252 netmask 0xffffffff \\
|
inet 127.0.0.252/32 \\
|
||||||
inet 127.0.0.253 netmask 0xffffffff \\
|
inet 127.0.0.253/32 \\
|
||||||
inet 127.0.0.254 netmask 0xffffffff"
|
inet 127.0.0.254/32"
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
It also supports CIDR notation.
|
It also supports netmask notation for backward compatibility.
|
||||||
.Pp
|
.Pp
|
||||||
If the
|
If the
|
||||||
.Pa /etc/start_if . Ns Aq Ar interface
|
.Pa /etc/start_if . Ns Aq Ar interface
|
||||||
|
@ -1688,7 +1705,7 @@ variable.
|
||||||
It is also possible to rename an interface by doing:
|
It is also possible to rename an interface by doing:
|
||||||
.Bd -literal
|
.Bd -literal
|
||||||
ifconfig_em0_name="net0"
|
ifconfig_em0_name="net0"
|
||||||
ifconfig_net0="inet 192.0.2.1 netmask 0xffffff00"
|
ifconfig_net0="inet 192.0.2.1/24"
|
||||||
.Ed
|
.Ed
|
||||||
.It Va ipv6_enable
|
.It Va ipv6_enable
|
||||||
.Pq Vt bool
|
.Pq Vt bool
|
||||||
|
@ -2045,9 +2062,9 @@ interfaces with:
|
||||||
.Bd -literal
|
.Bd -literal
|
||||||
gif_interfaces="gif0 gif1"
|
gif_interfaces="gif0 gif1"
|
||||||
gifconfig_gif0="100.64.0.1 100.64.0.2"
|
gifconfig_gif0="100.64.0.1 100.64.0.2"
|
||||||
ifconfig_gif0="inet 10.0.0.1 10.0.0.2 netmask 255.255.255.252"
|
ifconfig_gif0="inet 10.0.0.1/32 10.0.0.2"
|
||||||
gifconfig_gif1="inet6 2a00::1 2a01::1"
|
gifconfig_gif1="inet6 2a00::1 2a01::1"
|
||||||
ifconfig_gif1="inet 10.1.0.1 10.1.0.2 netmask 255.255.255.252"
|
ifconfig_gif1="inet 10.1.0.1/32 10.1.0.2"
|
||||||
.Ed
|
.Ed
|
||||||
.It Va ppp_enable
|
.It Va ppp_enable
|
||||||
.Pq Vt bool
|
.Pq Vt bool
|
||||||
|
|
Loading…
Reference in a new issue