Cover using symbolic names for interfaces in VLAN article.

PR:		228231
Submitted by:	Brian Haug <haug.bsd6114 AT yahoo dot com>
Approved by:	bcr (mentor)
Differential Revision:	https://reviews.freebsd.org/D15586
This commit is contained in:
Sevan Janiyan 2018-06-10 18:31:35 +00:00
parent 2a3901d791
commit 1282c75d06
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=51813

View file

@ -5225,8 +5225,9 @@ ifconfig_carp1="vhid <replaceable>2</replaceable> advskew <replaceable>100</repl
</indexterm>
<para><acronym>VLANs</acronym> are a way of virtually dividing up
a network into many different subnetworks. Each will have its
own broadcast domain and be isolated from the rest of the
a network into many different subnetworks, also referred
to as segmenting. Each segment will have its
own broadcast domain and be isolated from other
<acronym>VLANs</acronym>.</para>
<para>On &os;, <acronym>VLANs</acronym> must be supported by the
@ -5239,7 +5240,7 @@ ifconfig_carp1="vhid <replaceable>2</replaceable> advskew <replaceable>100</repl
<para>To configure <acronym>VLANs</acronym> at run time, with a
<acronym>NIC</acronym> of <literal>em0</literal> and a
<acronym>VLAN</acronym> tag of <systemitem>5</systemitem>. The
<acronym>VLAN</acronym> tag of <systemitem>5</systemitem> the
command would look like this:</para>
<screen>&prompt.root; <userinput>ifconfig <replaceable>em0.5</replaceable> create vlan <replaceable>5</replaceable> vlandev <replaceable>em0</replaceable> inet 192.168.20.20/24</userinput></screen>
@ -5266,5 +5267,38 @@ ifconfig_<replaceable>em0</replaceable>_<replaceable>5</replaceable>="inet 192.1
<literal>vlans_<replaceable>em0</replaceable></literal>
field and adding an additional line configuring the network on
that <acronym>VLAN</acronym> tag's interface.</para>
<para>It is useful to assign a symbolic name to an interface so
that when the associated hardware is changed, only a few
configuration variables need to be updated. For example,
security cameras need to be run over VLAN 1 on
<literal>em0</literal>. Later, if the <literal>em0</literal>
card is replaced with a card that uses the &man.ixgb.4; driver,
all references to <literal>em0.1</literal> will not have to
change to <literal>ixgb0.1</literal>.</para>
<para>To configure <acronym>VLAN</acronym>
<systemitem>5</systemitem>, on the
<acronym>NIC</acronym> <literal>em0</literal>, assign the
interface name <literal>cameras</literal>, and assign the
interface an IP address of <systemitem
class="ipaddress"><replaceable>192.168.20.20</replaceable></systemitem>
with a <systemitem class="netmask">24</systemitem>-bit prefix,
use this command:</para>
<screen>&prompt.root; <userinput>ifconfig <replaceable>em0.5</replaceable> create vlan <replaceable>5</replaceable> vlandev <replaceable>em0</replaceable> name <replaceable>cameras</replaceable> inet <replaceable>192.168.20.20/24</replaceable></userinput></screen>
<para>For an interface named <literal>video</literal>, use the
following:</para>
<screen>&prompt.root; <userinput>ifconfig <replaceable>video.5</replaceable> create vlan <replaceable>5</replaceable> vlandev <replaceable>video</replaceable> name <replaceable>cameras inet 192.168.20.20/24</replaceable></userinput></screen>
<para>To apply the changes at boot time, add the following lines to
<filename>/etc/rc.conf</filename>:</para>
<programlisting>vlans_<replaceable>video</replaceable>="<replaceable>camera</replaceable>"
create_args_<replaceable>camera</replaceable>="vlan <replaceable>5</replaceable>"
ifconfig_<replaceable>camera</replaceable>="inet <replaceable>192.168.20.20/24</replaceable>"</programlisting>
</sect1>
</chapter>