svn commit: r44414 - head/en_US.ISO8859-1/books/handbook/advanced-networking

Dru Lavigne dru at FreeBSD.org
Tue Apr 1 23:03:09 UTC 2014


Author: dru
Date: Tue Apr  1 23:03:08 2014
New Revision: 44414
URL: http://svnweb.freebsd.org/changeset/doc/44414

Log:
  Editorial review of CARP chapter.
  Add a few clarifications.
  
  Sponsored by:	iXsystems

Modified:
  head/en_US.ISO8859-1/books/handbook/advanced-networking/chapter.xml

Modified: head/en_US.ISO8859-1/books/handbook/advanced-networking/chapter.xml
==============================================================================
--- head/en_US.ISO8859-1/books/handbook/advanced-networking/chapter.xml	Tue Apr  1 22:55:59 2014	(r44413)
+++ head/en_US.ISO8859-1/books/handbook/advanced-networking/chapter.xml	Tue Apr  1 23:03:08 2014	(r44414)
@@ -4903,22 +4903,38 @@ route_hostD="192.168.173.4 hatm0 0 102 l
 
     <para>The Common Address Redundancy Protocol
       (<acronym>CARP</acronym>) allows multiple hosts to share the
-      same <acronym>IP</acronym> address and provide <emphasis>high
-      availability</emphasis>.  One or more hosts can fail, and the
-      others will take over for the failed system transparently.  In
-      addition to the shared <acronym>IP</acronym> address, hosts also
-      have a unique <acronym>IP</acronym> address for management and
-      configuration, as in the example provided here.</para>
-
-    <sect2 xml:id="carp-ha">
-      <title>Using <acronym>CARP</acronym> for High
-	Availability</title>
+      same <acronym>IP</acronym> address and Virtual Host ID
+      (<acronym>VHID</acronym>) in order to provide <firstterm>high
+      availability</firstterm> for one or more services.  This means that one or more
+      hosts can fail, and the
+      other hosts will transparently take over so that users do not see a service
+      failure.</para>
+	
+    <para>In 
+      addition to the shared <acronym>IP</acronym> address, each host
+      has its own <acronym>IP</acronym> address for management and
+      configuration.  All of the machines that share an
+	<acronym>IP</acronym> address have the same
+	<acronym>VHID</acronym>.  The <acronym>VHID</acronym> for each
+	virtual <acronym>IP</acronym> address must be unique across
+	the broadcast domain of the network interface.</para>
+
+    <para>High availability using <acronym>CARP</acronym> is built
+      into &os;, though the steps to configure it vary slightly
+      depending upon the &os; version.  This section provides the same
+      example configuration for versions before and equal to or after
+      &os; 10.</para>  
 
-      <para><acronym>CARP</acronym> is often used to provide
-	high availability for one or more services.  This example
+    <para>This example
 	configures failover support with three hosts, all with unique
 	<acronym>IP</acronym> addresses, but providing the same web
-	content.  These machines are load balanced with a Round Robin
+	content.  It has two different masters named
+	<systemitem>hosta.example.org</systemitem> and
+	<systemitem>hostb.example.org</systemitem>, with
+	a shared backup named
+	<systemitem>hostc.example.org</systemitem>.</para>
+
+    <para>These machines are load balanced with a Round Robin
 	<acronym>DNS</acronym> configuration.  The master and backup
 	machines are configured identically except for their hostnames
 	and management <acronym>IP</acronym> addresses.  These servers
@@ -4930,82 +4946,69 @@ route_hostD="192.168.173.4 hatm0 0 102 l
 	interfaces, one for each of the master content server's
 	<acronym>IP</acronym> addresses.  When a failure occurs, the
 	backup server will pick up the failed master machine's
-	<acronym>IP</acronym> address.  Users will not see a service
-	failure at all.</para>
-
-      <para>This example has two different masters named
-	<systemitem>hosta.example.org</systemitem> and
-	<systemitem>hostb.example.org</systemitem>, with
-	a shared backup named
-	<systemitem>hostc.example.org</systemitem>.</para>
-
-      <para>Each virtual <acronym>IP</acronym> address has a unique
-	identification number known as a Virtual Host Identification
-	(<acronym>VHID</acronym>).  All of the machines that share an
-	<acronym>IP</acronym> address have the same
-	<acronym>VHID</acronym>.  The <acronym>VHID</acronym> for each
-	virtual <acronym>IP</acronym> address must be unique across
-	the broadcast domain of the network interface.</para>
-    </sect2>
+	<acronym>IP</acronym> address.</para>
 
     <sect2 xml:id="carp-10x">
       <title>Using <acronym>CARP</acronym> on &os; 10 and
 	Later</title>
 
-      <para>Enable support for <acronym>CARP</acronym> by loading the
+      <para>Enable boot-time support for <acronym>CARP</acronym> by adding an entry for the
 	<filename>carp.ko</filename> kernel module in
 	<filename>/boot/loader.conf</filename>:</para>
 
       <programlisting>carp_load="YES"</programlisting>
-
-      <para>The <acronym>CARP</acronym> module can also be built into
-	the &os; kernel as described in
+      
+      <para>To load the module now without rebooting:</para>
+      
+      <screen>&prompt.root; <userinput>kldload carp</userinput></screen>
+
+      <para>For users who prefer to use a custom kernel, include the
+	following line in the custom kernel configuration file and
+	compile the kernel as described in
 	<xref linkend="kernelconfig"/>:</para>
 
       <programlisting>device	carp</programlisting>
 
-      <para>The hostname, management <acronym>IP</acronym> address,
-	<acronym>CARP</acronym> configuration, and the
-	<acronym>IP</acronym> address to be shared are all set by
+      <para>The hostname, management <acronym>IP</acronym> address and subnet mask,
+	shared <acronym>IP</acronym> address, and <acronym>VHID</acronym> are all set by
 	adding entries to <filename>/etc/rc.conf</filename>.  This
 	example is for
 	<systemitem>hosta.example.org</systemitem>:</para>
 
-      <programlisting>hostname="hosta.example.org"
-ifconfig_em0="inet <systemitem class="ipaddress">192.168.1.3</systemitem> netmask 255.255.255.0"
-ifconfig_em0_alias0="vhid 1 pass testpass alias <systemitem class="ipaddress">192.168.1.50</systemitem>/32"</programlisting>
-
-      <para>On <systemitem>hostb.example.org</systemitem>:</para>
-
-      <programlisting>hostname="hostb.example.org"
-ifconfig_em0="inet <systemitem class="ipaddress">192.168.1.4</systemitem> netmask 255.255.255.0"
-ifconfig_em0_alias0="vhid 2 pass testpass alias <systemitem class="ipaddress">192.168.1.51</systemitem>/32"</programlisting>
-
-      <note>
-	<para>The passwords specified with &man.ifconfig.8;
-	  <option>pass</option> must be identical.
+      <programlisting>hostname="<replaceable>hosta.example.org</replaceable>"
+ifconfig_<replaceable>em0</replaceable>="inet <replaceable>192.168.1.3</replaceable> netmask <replaceable>255.255.255.0</replaceable>"
+ifconfig_<replaceable>em0</replaceable>_alias0="vhid <replaceable>1</replaceable> pass <replaceable>testpass</replaceable> alias <replaceable>192.168.1.50</replaceable>/32"</programlisting>
+
+      <para>The next set of entries are for
+	<systemitem>hostb.example.org</systemitem>.  Since it
+	represents a second master, it uses a different shared
+	<acronym>IP</acronym> address and
+	<acronym>VHID</acronym>.  However, the passwords specified with
+	  <option>pass</option> must be identical as
 	  <acronym>CARP</acronym> will only listen to and accept
 	  advertisements from machines with the correct
 	  password.</para>
-      </note>
+
+      <programlisting>hostname="<replaceable>hostb.example.org</replaceable>"
+ifconfig_<replaceable>em0</replaceable>="inet <replaceable>192.168.1.4</replaceable> netmask <replaceable>255.255.255.0</replaceable>"
+ifconfig_<replaceable>em0</replaceable>_alias0="vhid <replaceable>2</replaceable> pass <replaceable>testpass</replaceable> alias <replaceable>192.168.1.51</replaceable>/32"</programlisting>
 
       <para>The third machine,
-	<systemitem>hostc.example.org</systemitem>, is prepared to
-	handle failover from either of the previous hosts.  This
+	<systemitem>hostc.example.org</systemitem>, is configured to
+	handle failover from either master.  This
 	machine is configured with two <acronym>CARP</acronym>
 	<acronym>VHID</acronym>s, one to handle the virtual
-	<acronym>IP</acronym> address of each of the master hosts.
-	<option>advskew</option>, the <acronym>CARP</acronym>
-	advertising skew, is set to ensure that the backup host
-	advertises later than the master.  <option>advskew</option>
+	<acronym>IP</acronym> address for each of the master hosts.
+	The <acronym>CARP</acronym>
+	advertising skew, <option>advskew</option>, is set to ensure that the backup host
+	advertises later than the master, since <option>advskew</option>
 	controls the order of precedence when there are multiple
-	backup servers.  Set the configuration in
-	<filename>/etc/rc.conf</filename>:</para>
+	backup servers.</para>
 
       <programlisting>hostname="hostc.example.org"
-ifconfig_em0="inet <systemitem class="ipaddress">192.168.1.5</systemitem> netmask 255.255.255.0"
-ifconfig_em0_alias0="vhid 1 advskew 100 pass testpass alias <systemitem class="ipaddress">192.168.1.50</systemitem>/32"
-ifconfig_em0_alias1="vhid 2 advskew 100 pass testpass alias <systemitem class="ipaddress">192.168.1.51</systemitem>/32"</programlisting>
+ifconfig_<replaceable>em0</replaceable>="inet <replaceable>192.168.1.5</replaceable> netmask <replaceable>255.255.255.0</replaceable>"
+ifconfig_<replaceable>em0</replaceable>_alias0="vhid <replaceable>1</replaceable> advskew <replaceable>100</replaceable> pass <replaceable>testpass</replaceable> alias <replaceable>192.168.1.50</replaceable>/32"
+ifconfig_<replaceable>em0</replaceable>_alias1="vhid <replaceable>2</replaceable> advskew <replaceable>100</replaceable> pass <replaceable>testpass</replaceable> alias <replaceable>192.168.1.51</replaceable>/32"</programlisting>
 
       <para>Having two <acronym>CARP</acronym>
 	<acronym>VHID</acronym>s configured means that
@@ -5027,8 +5030,8 @@ ifconfig_em0_alias1="vhid 2 advskew 100 
 	<screen>&prompt.root; <userinput>ifconfig em0 vhid 1 state backup</userinput></screen>
       </note>
 
-      <para>At this point, either networking must be restarted or the
-	machine rebooted, then <acronym>CARP</acronym> is
+      <para>Once the configuration is complete, either restart networking or reboot
+	each system.  High availability is now
 	enabled.</para>
 
       <para><acronym>CARP</acronym> functionality can be controlled
@@ -5042,76 +5045,63 @@ ifconfig_em0_alias1="vhid 2 advskew 100 
       <title>Using <acronym>CARP</acronym> on &os; 9 and
 	Earlier</title>
 
-      <para>Enable support for <acronym>CARP</acronym> by loading the
+      <para>The configuration for these versions of &os; is similar to
+	the one described in the previous section, except that a
+	<acronym>CARP</acronym> device must first be created and
+	referred to in the configuration.</para>
+
+      <para>Enable boot-time support for <acronym>CARP</acronym> by loading the
 	<filename>if_carp.ko</filename> kernel module in
 	<filename>/boot/loader.conf</filename>:</para>
 
       <programlisting>if_carp_load="YES"</programlisting>
 
-      <para><acronym>CARP</acronym> can also be built into the
-	&os; kernel as described in
+     <para>To load the module now without rebooting:</para>
+      
+      <screen>&prompt.root; <userinput>kldload carp</userinput></screen>
+
+      <para>For users who prefer to use a custom kernel, include the
+	following line in the custom kernel configuration file and
+	compile the kernel as described in
 	<xref linkend="kernelconfig"/>:</para>
 
       <programlisting>device	carp</programlisting>
 
-      <para>The <acronym>CARP</acronym> devices themselves may be
-	created using &man.ifconfig.8;:</para>
+      <para>Next, on each host, create a <acronym>CARP</acronym> device:</para>
 
       <screen>&prompt.root; <userinput>ifconfig carp0 create</userinput></screen>
 
-      <para>Set the hostname, configure the management
-	<acronym>IP</acronym> address, then configure
-	<acronym>CARP</acronym> and the <acronym>IP</acronym> address
-	to be shared by adding the required lines to
-	<filename>/etc/rc.conf</filename>.  Here are example lines for
+      <para>Set the hostname, management
+	<acronym>IP</acronym> address, the shared
+	<acronym>IP</acronym> address, and <acronym>VHID</acronym>
+	by adding the required lines to
+	<filename>/etc/rc.conf</filename>.  Since a virtual
+	<acronym>CARP</acronym> device is used instead of an alias,
+	the actual subnet mask of <literal>/24</literal> is used
+	instead of <literal>/32</literal>.  Here are the entries for
 	<systemitem>hosta.example.org</systemitem>:</para>
 
-      <programlisting>hostname="hosta.example.org"
-ifconfig_fxp0="inet <systemitem class="ipaddress">192.168.1.3</systemitem> netmask 255.255.255.0"
+      <programlisting>hostname="<replaceable>hosta.example.org</replaceable>"
+ifconfig_<replaceable>fxp0</replaceable>="inet <replaceable>192.168.1.3</replaceable> netmask <replaceable>255.255.255.0</replaceable>"
 cloned_interfaces="carp0"
-ifconfig_carp0="vhid 1 pass testpass <systemitem class="ipaddress">192.168.1.50</systemitem>/24"</programlisting>
+ifconfig_carp0="vhid <replaceable>1</replaceable> pass <replaceable>testpass</replaceable> <replaceable>192.168.1.50/24</replaceable>"</programlisting>
 
       <para>On <systemitem>hostb.example.org</systemitem>:</para>
 
-      <programlisting>hostname="hostb.example.org"
-ifconfig_fxp0="inet <systemitem class="ipaddress">192.168.1.4</systemitem> netmask 255.255.255.0"
+      <programlisting>hostname="<replaceable>hostb.example.org</replaceable>"
+ifconfig_<replaceable>fxp0</replaceable>="inet <replaceable>192.168.1.4</replaceable> netmask <replaceable>255.255.255.0</replaceable>"
 cloned_interfaces="carp0"
-ifconfig_carp0="vhid 2 pass testpass <systemitem class="ipaddress">192.168.1.51</systemitem>/24"</programlisting>
-
-      <note>
-	<para>The passwords specified with &man.ifconfig.8;
-	  <option>pass</option> must be identical.
-	  <acronym>CARP</acronym> will only listen to and accept
-	  advertisements from machines with the correct password.  The
-	  <acronym>VHID</acronym> must also be unique for each virtual
-	  <acronym>IP</acronym> address.</para>
-      </note>
+ifconfig_carp0="vhid <replaceable>2</replaceable> pass <replaceable>testpass</replaceable> <replaceable>192.168.1.51/24</replaceable>"</programlisting>
 
       <para>The third machine,
-	<systemitem>hostc.example.org</systemitem>, is prepared to
-	handle failover from either of the previous hosts.  This
-	machine is configured with two <acronym>CARP</acronym>
-	devices, one to handle each of the virtual
-	<acronym>IP</acronym> address of each of the master hosts.
-	Setting the <option>advskew</option> controls the
-	<acronym>CARP</acronym> advertising skew.  The skew ensuring
-	that the backup hosts advertises later than the master, and
-	controls the order of precedence when there are multiple
-	backup servers.  Set the configuration in
-	<filename>/etc/rc.conf</filename>:</para>
+	<systemitem>hostc.example.org</systemitem>, is configured to
+	handle failover from either of the master hosts:</para>
 
-      <programlisting>hostname="hostc.example.org"
-ifconfig_fxp0="inet <systemitem class="ipaddress">192.168.1.5</systemitem> netmask 255.255.255.0"
+      <programlisting>hostname="<replaceable>hostc.example.org</replaceable>"
+ifconfig_<replaceable>fxp0</replaceable>="inet <replaceable>192.168.1.5</replaceable> netmask <replaceable>255.255.255.0</replaceable>"
 cloned_interfaces="carp0 carp1"
-ifconfig_carp0="vhid 1 advskew 100 pass testpass <systemitem class="ipaddress">192.168.1.50</systemitem>/24"
-ifconfig_carp1="vhid 2 advskew 100 pass testpass <systemitem class="ipaddress">192.168.1.51</systemitem>/24"</programlisting>
-
-      <para>Having two <acronym>CARP</acronym> devices configured
-	means that <systemitem>hostc.example.org</systemitem> will
-	notice if either of the master servers becomes unavailable.
-	If a master fails to advertise before the backup server, the
-	backup server will pick up the shared <acronym>IP</acronym>
-	address until the master becomes available again.</para>
+ifconfig_carp0="vhid <replaceable>1</replaceable> advskew <replaceable>100</replaceable> pass <replaceable>testpass</replaceable> <replaceable>192.168.1.50/24</replaceable>"
+ifconfig_carp1="vhid <replaceable>2</replaceable> advskew <replaceable>100</replaceable> pass <replaceable>testpass</replaceable> <replaceable>192.168.1.51/24</replaceable>"</programlisting>
 
       <note>
 	<para>Preemption is disabled in the GENERIC &os; kernel.
@@ -5128,15 +5118,10 @@ ifconfig_carp1="vhid 2 advskew 100 pass 
 	  interface which corresponds to the correct host.</para>
       </note>
 
-      <para>At this point, either networking must be restarted or the
-	machine rebooted, then <acronym>CARP</acronym> is
+      <para>Once the configuration is complete, either restart networking or reboot
+	each system.  High availability is now
 	enabled.</para>
 
-      <para><acronym>CARP</acronym> functionality can be controlled
-	via several &man.sysctl.8; variables documented in the
-	&man.carp.4; manual pages.  Other actions can be triggered
-	from <acronym>CARP</acronym> events by using
-	&man.devd.8;.</para>
     </sect2>
   </sect1>
 </chapter>


More information about the svn-doc-all mailing list