|
Lines 5589-5603
Link Here
|
| 5589 |
</sect1> |
5589 |
</sect1> |
| 5590 |
|
5590 |
|
| 5591 |
<sect1 xml:id="carp"> |
5591 |
<sect1 xml:id="carp"> |
| 5592 |
<info><title>Common Address Redundancy Protocol |
5592 |
<info> |
| 5593 |
(<acronym>CARP</acronym>)</title> |
5593 |
<title>Common Address Redundancy Protocol |
|
|
5594 |
(<acronym>CARP</acronym>)</title> |
| 5595 |
|
| 5594 |
<authorgroup> |
5596 |
<authorgroup> |
| 5595 |
<author><personname><firstname>Tom</firstname><surname>Rhodes</surname></personname><contrib>Contributed by </contrib></author> |
5597 |
<author><personname><firstname>Tom</firstname><surname>Rhodes</surname></personname><contrib>Contributed by </contrib></author> |
|
|
5598 |
<author><personname><firstname>Allan</firstname><surname>Jude</surname></personname><contrib>Updated by </contrib></author> |
| 5596 |
</authorgroup> |
5599 |
</authorgroup> |
| 5597 |
</info> |
5600 |
</info> |
| 5598 |
|
5601 |
|
| 5599 |
|
|
|
| 5600 |
|
| 5601 |
<indexterm> |
5602 |
<indexterm> |
| 5602 |
<primary><acronym>CARP</acronym></primary> |
5603 |
<primary><acronym>CARP</acronym></primary> |
| 5603 |
</indexterm> |
5604 |
</indexterm> |
|
Lines 5607-5785
Link Here
|
| 5607 |
|
5608 |
|
| 5608 |
<para>The Common Address Redundancy Protocol |
5609 |
<para>The Common Address Redundancy Protocol |
| 5609 |
(<acronym>CARP</acronym>) allows multiple hosts to share the |
5610 |
(<acronym>CARP</acronym>) allows multiple hosts to share the |
| 5610 |
same <acronym>IP</acronym> address. In some configurations, |
5611 |
same <acronym>IP</acronym> address(es) and can be used to |
| 5611 |
this may be used for availability or load balancing. Hosts |
5612 |
achieve high availability. Hosts will usually also have a |
| 5612 |
may use separate <acronym>IP</acronym> addresses, as in the |
5613 |
unique <acronym>IP</acronym> address for management and |
| 5613 |
example provided here.</para> |
5614 |
configuration, as in the example provided here.</para> |
| 5614 |
|
5615 |
|
| 5615 |
<para>To enable support for <acronym>CARP</acronym>, the &os; |
5616 |
<sect2 xml:id="carp-ha"> |
| 5616 |
kernel can be rebuilt as described in <xref linkend="kernelconfig"/> with the following option:</para> |
5617 |
<title>Using <acronym>CARP</acronym> for High |
|
|
5618 |
Availability</title> |
| 5617 |
|
5619 |
|
| 5618 |
<programlisting>device carp</programlisting> |
5620 |
<para>One use of <acronym>CARP</acronym> is to provide |
|
|
5621 |
high availability for one or more services. This example |
| 5622 |
configures failover support with three hosts, all with |
| 5623 |
unique <acronym>IP</acronym> addresses and providing the same |
| 5624 |
web content. These machines are load balanced with a Round |
| 5625 |
Robin <acronym>DNS</acronym> configuration. The master and |
| 5626 |
backup machines should preferrably be configured identically, |
| 5627 |
other than their hostnames and management |
| 5628 |
<acronym>IP</acronym> addresses. These servers need to run |
| 5629 |
the same services, such as the web server, with the same |
| 5630 |
configuration. When the failover occurs, requests to the |
| 5631 |
service on the shared <acronym>IP</acronym> address can only |
| 5632 |
be answered correctly if the backup server has access to the |
| 5633 |
same content. The backup machine has two additional |
| 5634 |
<acronym>CARP</acronym> interfaces, one for each of the |
| 5635 |
master content server's <acronym>IP</acronym> addresses. When |
| 5636 |
a failure occurs, the backup server will pick up the failed |
| 5637 |
master machine's <acronym>IP</acronym> address, and the |
| 5638 |
failure would go completely unnoticed by the users. This |
| 5639 |
example has two different masters named |
| 5640 |
<systemitem>hosta.example.org</systemitem> and |
| 5641 |
<systemitem>hostb.example.org</systemitem>, with |
| 5642 |
a shared backup named |
| 5643 |
<systemitem>hostc.example.org</systemitem>.</para> |
| 5619 |
|
5644 |
|
| 5620 |
<para>Alternatively, the <filename>if_carp.ko</filename> module |
5645 |
<para>Each virtual <acronym>IP</acronym> address has a unique |
| 5621 |
can be loaded at boot time. Add the following line to |
5646 |
identification number known as a Virtual Host Identification |
| 5622 |
<filename>/boot/loader.conf</filename>:</para> |
5647 |
(<acronym>VHID</acronym>). The <acronym>VHID</acronym> is |
|
|
5648 |
used to indicate which machines are to share a common address. |
| 5649 |
The <acronym>VHID</acronym> for each virtual |
| 5650 |
<acronym>IP</acronym> address must be unique across the |
| 5651 |
broadcast domain of the network interface.</para> |
| 5652 |
</sect2> |
| 5623 |
|
5653 |
|
| 5624 |
<programlisting>if_carp_load="YES"</programlisting> |
5654 |
<sect2 xml:id="carp-10x"> |
|
|
5655 |
<title>Using <acronym>CARP</acronym> on &os; 10 and |
| 5656 |
Later</title> |
| 5625 |
|
5657 |
|
| 5626 |
<para><acronym>CARP</acronym> functionality should now be |
5658 |
<para>Enable support for <acronym>CARP</acronym> by loading the |
| 5627 |
available and may be tuned via several &man.sysctl.8; |
5659 |
<filename>carp.ko</filename> kernel module in |
| 5628 |
variables:</para> |
5660 |
<filename>/boot/loader.conf</filename>:</para> |
| 5629 |
|
5661 |
|
| 5630 |
<informaltable frame="none" pgwide="1"> |
5662 |
<programlisting>carp_load="YES"</programlisting> |
| 5631 |
<tgroup cols="2"> |
|
|
| 5632 |
<thead> |
| 5633 |
<row> |
| 5634 |
<entry>OID</entry> |
| 5635 |
<entry>Description</entry> |
| 5636 |
</row> |
| 5637 |
</thead> |
| 5638 |
|
5663 |
|
| 5639 |
<tbody> |
5664 |
<para>The <acronym>CARP</acronym> can also be built into the |
| 5640 |
<row> |
5665 |
&os; kernel as described in <xref linkend="kernelconfig"/> |
| 5641 |
<entry><varname>net.inet.carp.allow</varname></entry> |
5666 |
by enabling the option:</para> |
| 5642 |
<entry>Accept incoming <acronym>CARP</acronym> packets. |
|
|
| 5643 |
Enabled by default.</entry> |
| 5644 |
</row> |
| 5645 |
|
5667 |
|
| 5646 |
<row> |
5668 |
<programlisting>device carp</programlisting> |
| 5647 |
<entry><varname>net.inet.carp.preempt</varname></entry> |
|
|
| 5648 |
<entry>This option downs all of the |
| 5649 |
<acronym>CARP</acronym> interfaces on the host when one |
| 5650 |
goes down. Disabled by default.</entry> |
| 5651 |
</row> |
| 5652 |
|
5669 |
|
| 5653 |
<row> |
5670 |
<para>Set the hostname, configure the management |
| 5654 |
<entry><varname>net.inet.carp.log</varname></entry> |
5671 |
<acronym>IP</acronym> address, then configure |
| 5655 |
<entry>A value of <literal>0</literal> disables any |
5672 |
<acronym>CARP</acronym> and the <acronym>IP</acronym> address |
| 5656 |
logging. A value of <literal>1</literal> enables |
5673 |
to be shared by adding the required lines to |
| 5657 |
logging of bad <acronym>CARP</acronym> packets. Values |
5674 |
<filename>/etc/rc.conf</filename>. Here are example lines for |
| 5658 |
greater than <literal>1</literal> enable logging of |
5675 |
<systemitem>hosta.example.org</systemitem>:</para> |
| 5659 |
state changes for the <acronym>CARP</acronym> |
|
|
| 5660 |
interfaces. The default value is |
| 5661 |
<literal>1</literal>.</entry> |
| 5662 |
</row> |
| 5663 |
|
5676 |
|
| 5664 |
<row> |
5677 |
<programlisting>hostname="hosta.example.org" |
| 5665 |
<entry><varname>net.inet.carp.arpbalance</varname></entry> |
5678 |
ifconfig_em0="inet <systemitem class="ipaddress">192.168.1.3</systemitem> netmask 255.255.255.0" |
| 5666 |
<entry>Balance local network traffic using |
5679 |
ifconfig_em0_alias0="vhid 1 pass testpass alias <systemitem class="ipaddress">192.168.1.50</systemitem>/32"</programlisting> |
| 5667 |
<acronym>ARP</acronym>. Disabled by default.</entry> |
|
|
| 5668 |
</row> |
| 5669 |
|
5680 |
|
| 5670 |
<row> |
5681 |
<para>On <systemitem>hostb.example.org</systemitem>:</para> |
| 5671 |
<entry><varname>net.inet.carp.suppress_preempt</varname></entry> |
|
|
| 5672 |
<entry>A read-only variable showing the status of |
| 5673 |
preemption suppression. Preemption can be suppressed |
| 5674 |
if the link on an interface is down. A value of |
| 5675 |
<literal>0</literal> means that preemption is not |
| 5676 |
suppressed. Every problem increments this |
| 5677 |
variable.</entry> |
| 5678 |
</row> |
| 5679 |
</tbody> |
| 5680 |
</tgroup> |
| 5681 |
</informaltable> |
| 5682 |
|
5682 |
|
| 5683 |
<para>The <acronym>CARP</acronym> devices themselves may be |
5683 |
<programlisting>hostname="hostb.example.org" |
| 5684 |
created using &man.ifconfig.8;:</para> |
5684 |
ifconfig_em0="inet <systemitem class="ipaddress">192.168.1.4</systemitem> netmask 255.255.255.0" |
|
|
5685 |
ifconfig_em0_alias0="vhid 2 pass testpass alias <systemitem class="ipaddress">192.168.1.51</systemitem>/32"</programlisting> |
| 5685 |
|
5686 |
|
| 5686 |
<screen>&prompt.root; <userinput>ifconfig carp0 create</userinput></screen> |
5687 |
<note> |
|
|
5688 |
<para>The passwords specified with &man.ifconfig.8; |
| 5689 |
<option>pass</option> must be identical. |
| 5690 |
<acronym>CARP</acronym> will only listen to and accept |
| 5691 |
advertisements from machines with the correct password. The |
| 5692 |
<acronym>VHID</acronym> must also be unique for each virtual |
| 5693 |
<acronym>IP</acronym> address.</para> |
| 5694 |
</note> |
| 5687 |
|
5695 |
|
| 5688 |
<para>In a real environment, each interface has a unique |
5696 |
<para>The third machine, |
| 5689 |
identification number known as a Virtual Host IDentification |
5697 |
<systemitem>hostc.example.org</systemitem>, |
| 5690 |
(<acronym>VHID</acronym>) which is used to distinguish the |
5698 |
needs to be prepared so that it can handle failover from |
| 5691 |
host on the network.</para> |
5699 |
either of the previous host. This machine is configured |
|
|
5700 |
with two <acronym>CARP</acronym> <acronym>VHID</acronym>s, one |
| 5701 |
to handle the virtual <acronym>IP</acronym> address of each |
| 5702 |
of the master hosts. Setting the <option>advskew</option> |
| 5703 |
controls the <acronym>CARP</acronym> advertising skew. The |
| 5704 |
skew ensuring that the backup hosts advertises later than the |
| 5705 |
master, and controls the order of precedence when there |
| 5706 |
are multiple backup servers. Set the configuration in |
| 5707 |
<filename>/etc/rc.conf</filename>:</para> |
| 5692 |
|
5708 |
|
| 5693 |
<sect2> |
5709 |
<programlisting>hostname="hostc.example.org" |
| 5694 |
<title>Using <acronym>CARP</acronym> for Server |
5710 |
ifconfig_em0="inet <systemitem class="ipaddress">192.168.1.5</systemitem> netmask 255.255.255.0" |
| 5695 |
Availability</title> |
5711 |
ifconfig_em0_alias0="vhid 1 advskew 100 pass testpass alias <systemitem class="ipaddress">192.168.1.50</systemitem>/32" |
|
|
5712 |
ifconfig_em0_alias1="vhid 2 advskew 100 pass testpass alias <systemitem class="ipaddress">192.168.1.51</systemitem>/32"</programlisting> |
| 5696 |
|
5713 |
|
| 5697 |
<para>One use of <acronym>CARP</acronym> is to provide server |
5714 |
<para>Having the two <acronym>CARP</acronym> |
| 5698 |
availability. This example configures failover support for |
5715 |
<acronym>VHID</acronym>s configured means that |
| 5699 |
three hosts, all with unique <acronym>IP</acronym> |
5716 |
<systemitem>hostc.example.org</systemitem> will notice if |
| 5700 |
addresses and providing the same web content. These machines |
5717 |
either of the master servers becomes unavailable. If a master |
| 5701 |
act in conjunction with a Round Robin |
5718 |
fails to advertise before the backup server, the backup server |
| 5702 |
<acronym>DNS</acronym> configuration. The failover machine |
5719 |
will pick up the shared <acronym>IP</acronym> address until |
| 5703 |
has two additional <acronym>CARP</acronym> interfaces, one |
5720 |
the master becomes available again.</para> |
| 5704 |
for each of the content server's |
|
|
| 5705 |
<acronym>IP</acronym> addresses. When a |
| 5706 |
failure occurs, the failover server will pick up the failed |
| 5707 |
machine's <acronym>IP</acronym> address. |
| 5708 |
This means that the failure should go completely unnoticed |
| 5709 |
by the user. The failover server requires identical content |
| 5710 |
and services as the other content servers it is expected to |
| 5711 |
pick up load for.</para> |
| 5712 |
|
5721 |
|
| 5713 |
<para>The two machines should be configured identically other |
5722 |
<note> |
| 5714 |
than their hostnames and <acronym>VHID</acronym>s. This |
5723 |
<para>Preemption is disabled by default. If preemption has |
| 5715 |
example calls these machines |
5724 |
been enabled, <systemitem>hostc.example.org</systemitem> |
| 5716 |
<systemitem>hosta.example.org</systemitem> and |
5725 |
might not release the virtual <acronym>IP</acronym> address |
| 5717 |
<systemitem>hostb.example.org</systemitem> respectively. First, the |
5726 |
back to the original master server. The administrator |
| 5718 |
required lines for a <acronym>CARP</acronym> configuration |
5727 |
can force the backup server to return the |
| 5719 |
have to be added to <filename>/etc/rc.conf</filename>. Here |
5728 |
<acronym>IP</acronym> address to the master with the |
| 5720 |
are the lines for |
5729 |
command:</para> |
|
|
5730 |
|
| 5731 |
<screen>&prompt.root; <command>ifconfig em0 vhid 1 state backup</command></screen> |
| 5732 |
</note> |
| 5733 |
|
| 5734 |
<para>At this point, either networking must be restarted or the |
| 5735 |
machine rebooted, then <acronym>CARP</acronym> is |
| 5736 |
enabled.</para> |
| 5737 |
|
| 5738 |
<para><acronym>CARP</acronym> functionality can be controlled |
| 5739 |
via several &man.sysctl.8; variables:</para> |
| 5740 |
|
| 5741 |
<informaltable frame="none" pgwide="1"> |
| 5742 |
<tgroup cols="2"> |
| 5743 |
<thead> |
| 5744 |
<row> |
| 5745 |
<entry>OID</entry> |
| 5746 |
<entry>Description</entry> |
| 5747 |
</row> |
| 5748 |
</thead> |
| 5749 |
|
| 5750 |
<tbody> |
| 5751 |
<row> |
| 5752 |
<entry><varname>net.inet.carp.allow</varname></entry> |
| 5753 |
<entry>Accept incoming <acronym>CARP</acronym> packets. |
| 5754 |
Enabled by default.</entry> |
| 5755 |
</row> |
| 5756 |
|
| 5757 |
<row> |
| 5758 |
<entry><varname>net.inet.carp.preempt</varname></entry> |
| 5759 |
<entry>Allow virtual hosts to preempt each other. For |
| 5760 |
firewalls and routers with multiple interfaces, it is |
| 5761 |
desirable to failover all of the addresses running |
| 5762 |
carp together when one of the physical interfaces |
| 5763 |
goes down. This is achieved with |
| 5764 |
<varname>preempt</varname>. When one of the physical |
| 5765 |
interfaces of the master fails, |
| 5766 |
<option>advskew</option> is demoted to a configured |
| 5767 |
value on all its <acronym>CARP</acronym> |
| 5768 |
<acronym>VHID</acronym>s. Due to the preempt option, |
| 5769 |
the backup host would start announcing itself, and |
| 5770 |
thus preempt the master host on both interfaces |
| 5771 |
instead of just the failed one. Disabled by |
| 5772 |
default.</entry> |
| 5773 |
</row> |
| 5774 |
|
| 5775 |
<row> |
| 5776 |
<entry><varname>net.inet.carp.log</varname></entry> |
| 5777 |
<entry>Determines what events relating to |
| 5778 |
<acronym>CARP</acronym> <acronym>VHID</acronym>s are |
| 5779 |
logged. A value of 0 disables any logging. A value |
| 5780 |
of 1 enables logging state changes of |
| 5781 |
<acronym>CARP</acronym> <acronym>VHID</acronym>s. |
| 5782 |
Values above 1 enable logging of bad |
| 5783 |
<acronym>CARP</acronym> packets. The default value is |
| 5784 |
1.</entry> |
| 5785 |
</row> |
| 5786 |
|
| 5787 |
<row> |
| 5788 |
<entry><varname>net.inet.carp.demotion</varname></entry> |
| 5789 |
<entry>This value shows the current level of |
| 5790 |
<acronym>CARP</acronym> demotion. The value is added |
| 5791 |
to the actual <option>advskew</option> sent in |
| 5792 |
announcements for all <acronym>VHID</acronym>s. |
| 5793 |
During normal system operation the demotion factor is |
| 5794 |
zero. Problematic conditions automatically raise this |
| 5795 |
level: when <acronym>CARP</acronym> experiences a |
| 5796 |
problem with sending announcements, when an interface |
| 5797 |
running a <acronym>VHID</acronym> goes down, or while |
| 5798 |
the &man.pfsync.4; interface is not synchronized. The |
| 5799 |
demotion factor can also be adjusted manually by |
| 5800 |
writing to this &man.sysctl.8; <acronym>OID</acronym>. |
| 5801 |
The signed value set via &man.sysctl.8; is added to |
| 5802 |
the current demotion factor. This allows the |
| 5803 |
behavior of <acronym>CARP</acronym> to be controlled |
| 5804 |
depending on external conditions, like the status of |
| 5805 |
some daemon utility.</entry> |
| 5806 |
</row> |
| 5807 |
|
| 5808 |
<row> |
| 5809 |
<entry><varname>net.inet.carp.ifdown_demotion_factor</varname></entry> |
| 5810 |
<entry>This value is added to |
| 5811 |
<varname>net.inet.carp.demotion</varname> when an |
| 5812 |
interface running a <acronym>VHID</acronym> goes down. |
| 5813 |
The default value is 240 (the maximum |
| 5814 |
<option>advskew</option> value).</entry> |
| 5815 |
</row> |
| 5816 |
|
| 5817 |
<row> |
| 5818 |
<entry><varname>net.inet.carp.senderr_demotion_factor</varname></entry> |
| 5819 |
<entry>This value is added to |
| 5820 |
<varname>net.inet.carp.demotion</varname> when |
| 5821 |
<acronym>CARP</acronym> experiences errors sending its |
| 5822 |
announcements. The default value is 240 (the maximum |
| 5823 |
<option>advskew</option> value).</entry> |
| 5824 |
</row> |
| 5825 |
</tbody> |
| 5826 |
</tgroup> |
| 5827 |
</informaltable> |
| 5828 |
|
| 5829 |
<para>Other actions can be triggered from |
| 5830 |
<acronym>CARP</acronym> events by using &man.devd.8;. More |
| 5831 |
information is available in &man.carp.4;.</para> |
| 5832 |
</sect2> |
| 5833 |
|
| 5834 |
<sect2 xml:id="carp-9x"> |
| 5835 |
<title>Using <acronym>CARP</acronym> on &os; 9 and |
| 5836 |
Earlier</title> |
| 5837 |
|
| 5838 |
<para>Enable support for <acronym>CARP</acronym> by loading the |
| 5839 |
<filename>if_carp.ko</filename> kernel module in |
| 5840 |
<filename>/boot/loader.conf</filename>:</para> |
| 5841 |
|
| 5842 |
<programlisting>if_carp_load="YES"</programlisting> |
| 5843 |
|
| 5844 |
<para>The <acronym>CARP</acronym> can also be built into the |
| 5845 |
&os; kernel as described in <xref linkend="kernelconfig"/> |
| 5846 |
by enabling the option:</para> |
| 5847 |
|
| 5848 |
<programlisting>device carp</programlisting> |
| 5849 |
|
| 5850 |
<para>The <acronym>CARP</acronym> devices themselves may be |
| 5851 |
created using &man.ifconfig.8;:</para> |
| 5852 |
|
| 5853 |
<screen>&prompt.root; <command>ifconfig carp0 create</command></screen> |
| 5854 |
|
| 5855 |
<para>Set the hostname, configure the management |
| 5856 |
<acronym>IP</acronym> address, then configure |
| 5857 |
<acronym>CARP</acronym> and the <acronym>IP</acronym> address |
| 5858 |
to be shared by adding the required lines to |
| 5859 |
<filename>/etc/rc.conf</filename>. Here are example lines for |
| 5721 |
<systemitem>hosta.example.org</systemitem>:</para> |
5860 |
<systemitem>hosta.example.org</systemitem>:</para> |
| 5722 |
|
5861 |
|
| 5723 |
<programlisting>hostname="hosta.example.org" |
5862 |
<programlisting>hostname="hosta.example.org" |
| 5724 |
ifconfig_fxp0="inet 192.168.1.3 netmask 255.255.255.0" |
5863 |
ifconfig_fxp0="inet <systemitem class="ipaddress">192.168.1.3</systemitem> netmask 255.255.255.0" |
| 5725 |
cloned_interfaces="carp0" |
5864 |
cloned_interfaces="carp0" |
| 5726 |
ifconfig_carp0="vhid 1 pass testpass 192.168.1.50/24"</programlisting> |
5865 |
ifconfig_carp0="vhid 1 pass testpass <systemitem class="ipaddress">192.168.1.50</systemitem>/24"</programlisting> |
| 5727 |
|
5866 |
|
| 5728 |
<para>On <systemitem>hostb.example.org</systemitem>, use the following |
5867 |
<para>On <systemitem>hostb.example.org</systemitem>:</para> |
| 5729 |
lines:</para> |
|
|
| 5730 |
|
5868 |
|
| 5731 |
<programlisting>hostname="hostb.example.org" |
5869 |
<programlisting>hostname="hostb.example.org" |
| 5732 |
ifconfig_fxp0="inet 192.168.1.4 netmask 255.255.255.0" |
5870 |
ifconfig_fxp0="inet <systemitem class="ipaddress">192.168.1.4</systemitem> netmask 255.255.255.0" |
| 5733 |
cloned_interfaces="carp0" |
5871 |
cloned_interfaces="carp0" |
| 5734 |
ifconfig_carp0="vhid 2 pass testpass 192.168.1.51/24"</programlisting> |
5872 |
ifconfig_carp0="vhid 2 pass testpass <systemitem class="ipaddress">192.168.1.51</systemitem>/24"</programlisting> |
| 5735 |
|
5873 |
|
| 5736 |
<note> |
5874 |
<note> |
| 5737 |
<para>It is very important that the passwords, specified by |
5875 |
<para>The passwords specified with &man.ifconfig.8; |
| 5738 |
the <option>pass</option> option to &man.ifconfig.8;, are |
5876 |
<option>pass</option> must be identical. |
| 5739 |
identical. The <filename>carp</filename> devices will |
5877 |
<acronym>CARP</acronym> will only listen to and accept |
| 5740 |
only listen to and accept advertisements from machines |
5878 |
advertisements from machines with the correct password. The |
| 5741 |
with the correct password. The <acronym>VHID</acronym> |
5879 |
<acronym>VHID</acronym> must also be unique for each virtual |
| 5742 |
must also be unique for each machine.</para> |
5880 |
<acronym>IP</acronym> address.</para> |
| 5743 |
</note> |
5881 |
</note> |
| 5744 |
|
5882 |
|
| 5745 |
<para>The third machine, <systemitem>provider.example.org</systemitem>, |
5883 |
<para>The third machine, |
| 5746 |
should be prepared so that it may handle failover from either |
5884 |
<systemitem>hostc.example.org</systemitem>, |
| 5747 |
host. This machine will require two |
5885 |
needs to be prepared so that it can handle failover from |
| 5748 |
<filename>carp</filename> devices, one to handle each |
5886 |
either of the previous host. This machine is configured |
| 5749 |
host. The appropriate <filename>/etc/rc.conf</filename> |
5887 |
with two <acronym>CARP</acronym> devicess, one |
| 5750 |
configuration lines will be similar to the following:</para> |
5888 |
to handle the virtual <acronym>IP</acronym> address of each |
|
|
5889 |
of the master hosts. Setting the <option>advskew</option> |
| 5890 |
controls the <acronym>CARP</acronym> advertising skew. The |
| 5891 |
skew ensuring that the backup hosts advertises later than the |
| 5892 |
master, and controls the order of precedence when there |
| 5893 |
are multiple backup servers. Set the configuration in |
| 5894 |
<filename>/etc/rc.conf</filename>:</para> |
| 5751 |
|
5895 |
|
| 5752 |
<programlisting>hostname="provider.example.org" |
5896 |
<programlisting>hostname="hostc.example.org" |
| 5753 |
ifconfig_fxp0="inet 192.168.1.5 netmask 255.255.255.0" |
5897 |
ifconfig_fxp0="inet <systemitem class="ipaddress">192.168.1.5</systemitem> netmask 255.255.255.0" |
| 5754 |
cloned_interfaces="carp0 carp1" |
5898 |
cloned_interfaces="carp0 carp1" |
| 5755 |
ifconfig_carp0="vhid 1 advskew 100 pass testpass 192.168.1.50/24" |
5899 |
ifconfig_carp0="vhid 1 advskew 100 pass testpass <systemitem class="ipaddress">192.168.1.50</systemitem>/24" |
| 5756 |
ifconfig_carp1="vhid 2 advskew 100 pass testpass 192.168.1.51/24"</programlisting> |
5900 |
ifconfig_carp1="vhid 2 advskew 100 pass testpass <systemitem class="ipaddress">192.168.1.51</systemitem>/24"</programlisting> |
| 5757 |
|
5901 |
|
| 5758 |
<para>Having the two <filename>carp</filename> devices will |
5902 |
<para>Having the two <acronym>CARP</acronym> devicess configured |
| 5759 |
allow <systemitem>provider.example.org</systemitem> to notice and pick |
5903 |
means that <systemitem>hostc.example.org</systemitem> will |
| 5760 |
up the <acronym>IP</acronym> address of either machine, should |
5904 |
notice if either of the master servers becomes unavailable. |
| 5761 |
it stop responding.</para> |
5905 |
If a master fails to advertise before the backup server, the |
|
|
5906 |
backup server will pick up the shared <acronym>IP</acronym> |
| 5907 |
address until the master becomes available again.</para> |
| 5762 |
|
5908 |
|
| 5763 |
<note> |
5909 |
<note> |
| 5764 |
<para>The default &os; kernel <emphasis>may</emphasis> have |
5910 |
<para>Preemption is disabled in the GENERIC &os; kernel. |
| 5765 |
preemption enabled. If so, |
5911 |
If Preemption has been enabled with a custom kernel, |
| 5766 |
<systemitem>provider.example.org</systemitem> may not relinquish the |
5912 |
<systemitem>hostc.example.org</systemitem> may not release |
| 5767 |
<acronym>IP</acronym> address back to the original content |
5913 |
the <acronym>IP</acronym> address back to the original |
| 5768 |
server. In this case, an administrator may have to manually |
5914 |
content server. The administrator can force the backup |
| 5769 |
force the <acronym>IP</acronym> back to the master. The |
5915 |
server to return the <acronym>IP</acronym> address to the |
| 5770 |
following command should be issued on |
5916 |
master with the command:</para> |
| 5771 |
<systemitem>provider.example.org</systemitem>:</para> |
|
|
| 5772 |
|
5917 |
|
| 5773 |
<screen>&prompt.root; <userinput>ifconfig carp0 down && ifconfig carp0 up</userinput></screen> |
5918 |
<screen>&prompt.root; <command>ifconfig carp0 down && ifconfig carp0 up</command></screen> |
| 5774 |
|
5919 |
|
| 5775 |
<para>This should be done on the <filename>carp</filename> |
5920 |
<para>This should be done on the <filename>carp</filename> |
| 5776 |
interface which corresponds to the correct host.</para> |
5921 |
interface which corresponds to the correct host.</para> |
| 5777 |
</note> |
5922 |
</note> |
| 5778 |
|
5923 |
|
| 5779 |
<para>At this point, <acronym>CARP</acronym> should be enabled |
5924 |
<para>At this point, either networking must be restarted or the |
| 5780 |
and available for testing. For testing, either networking |
5925 |
machine rebooted, then <acronym>CARP</acronym> is |
| 5781 |
has to be restarted or the machines rebooted.</para> |
5926 |
enabled.</para> |
| 5782 |
|
5927 |
|
|
|
5928 |
<para><acronym>CARP</acronym> functionality can be controlled |
| 5929 |
via several &man.sysctl.8; variables:</para> |
| 5930 |
|
| 5931 |
<informaltable frame="none" pgwide="1"> |
| 5932 |
<tgroup cols="2"> |
| 5933 |
<thead> |
| 5934 |
<row> |
| 5935 |
<entry>OID</entry> |
| 5936 |
<entry>Description</entry> |
| 5937 |
</row> |
| 5938 |
</thead> |
| 5939 |
|
| 5940 |
<tbody> |
| 5941 |
<row> |
| 5942 |
<entry><varname>net.inet.carp.allow</varname></entry> |
| 5943 |
<entry>Accept incoming <acronym>CARP</acronym> packets. |
| 5944 |
Enabled by default.</entry> |
| 5945 |
</row> |
| 5946 |
|
| 5947 |
<row> |
| 5948 |
<entry><varname>net.inet.carp.preempt</varname></entry> |
| 5949 |
<entry>This option downs all of the |
| 5950 |
<acronym>CARP</acronym> interfaces on the host when |
| 5951 |
one goes down. Disabled by default.</entry> |
| 5952 |
</row> |
| 5953 |
|
| 5954 |
<row> |
| 5955 |
<entry><varname>net.inet.carp.log</varname></entry> |
| 5956 |
<entry>A value of <literal>0</literal> disables any |
| 5957 |
logging. A value of <literal>1</literal> enables |
| 5958 |
logging of bad <acronym>CARP</acronym> packets. |
| 5959 |
Values greater than <literal>1</literal> enable |
| 5960 |
logging of state changes for the |
| 5961 |
<acronym>CARP</acronym> interfaces. The default value |
| 5962 |
is <literal>1</literal>.</entry> |
| 5963 |
</row> |
| 5964 |
|
| 5965 |
<row> |
| 5966 |
<entry><varname>net.inet.carp.arpbalance</varname></entry> |
| 5967 |
<entry>Balance local network traffic using |
| 5968 |
<acronym>ARP</acronym>. Disabled by default.</entry> |
| 5969 |
</row> |
| 5970 |
|
| 5971 |
<row> |
| 5972 |
<entry><varname>net.inet.carp.suppress_preempt</varname></entry> |
| 5973 |
<entry>A read-only variable showing the status of |
| 5974 |
preemption suppression. Preemption can be suppressed |
| 5975 |
if the link on an interface is down. A value of |
| 5976 |
<literal>0</literal> means that preemption is not |
| 5977 |
suppressed. Every problem increments this |
| 5978 |
variable.</entry> |
| 5979 |
</row> |
| 5980 |
</tbody> |
| 5981 |
</tgroup> |
| 5982 |
</informaltable> |
| 5983 |
|
| 5783 |
<para>More information is available in &man.carp.4;.</para> |
5984 |
<para>More information is available in &man.carp.4;.</para> |
| 5784 |
</sect2> |
5985 |
</sect2> |
| 5785 |
</sect1> |
5986 |
</sect1> |