Add a section on how to configure VLANs.

This commit is contained in:
Brad Davis 2016-08-14 16:06:03 +00:00
parent f4d344b63f
commit 020029ea5b
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=49279

View file

@ -50,6 +50,11 @@
Address Redundancy Protocol (<acronym>CARP</acronym>) in
&os;.</para>
</listitem>
<listitem>
<para>How to configure multiple <acronym>VLANs</acronym> on
&os;.</para>
</listitem>
</itemizedlist>
<para>Before reading this chapter, you should:</para>
@ -5201,4 +5206,56 @@ ifconfig_carp1="vhid <replaceable>2</replaceable> advskew <replaceable>100</repl
enabled.</para>
</sect2>
</sect1>
<sect1 xml:id="network-vlan">
<info>
<title>VLANs</title>
</info>
<indexterm>
<primary><acronym>VLANs</acronym></primary>
</indexterm>
<indexterm>
<primary>Virtual LANs</primary>
</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
<acronym>VLANs</acronym>.</para>
<para>On &os;, <acronym>VLANs</acronym> must be supported by the network
card driver. To see which drivers support vlans, refer to the
&man.vlan.4; manual page.</para>
<para>When configuring a <acronym>VLAN</acronym>, a couple pieces of
information must be known. First, which network interface? Second,
what is the <acronym>VLAN</acronym> tag?</para>
<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 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>
<note>
<para>See how the interface name includes the <acronym>NIC</acronym>
driver name and the <acronym>VLAN</acronym> tag, separated by a
period? This is a best practice to make maintaining the
<acronym>VLAN</acronym> configuration easy when many
<acronym>VLANs</acronym> are present on a machine.</para>
</note>
<para>To configure <acronym>VLANs</acronym> at boot time,
<filename>/etc/rc.conf</filename> must be updated. To duplicate the
configuration above, the following will need to be added:</para>
<programlisting>vlans_<replaceable>em0</replaceable>="<replaceable>5</replaceable>"
vlans_<replaceable>em0</replaceable>_<replaceable>5</replaceable>="inet 192.168.20.20/24"</programlisting>
<para>Additional <acronym>VLANs</acronym> may be added, by simply adding
the tag to the <literal>vlans_<replaceable>em0</replaceable></literal>
field and adding an additional line configuring the network on that
<acronym>VLAN</acronym> tag's interface.</para>
</sect1>
</chapter>