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