The translation is temporarily closed for contributions due to maintenance, please come back later.

Source string Read only

(itstool) path: sect2/para
Context English State
<prompt>#</prompt> <userinput>kldload carp</userinput>
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"/>:
device carp
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>:
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="inet vhid <replaceable>1</replaceable> pass <replaceable>testpass</replaceable> alias <replaceable>192.168.1.50</replaceable>/32"
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.
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="inet vhid <replaceable>2</replaceable> pass <replaceable>testpass</replaceable> alias <replaceable>192.168.1.51</replaceable>/32"
The third machine, <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 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.
hostname="hostc.example.org"
ifconfig_<replaceable>em0</replaceable>="inet <replaceable>192.168.1.5</replaceable> netmask <replaceable>255.255.255.0</replaceable>"
ifconfig_<replaceable>em0</replaceable>_alias0="inet 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="inet vhid <replaceable>2</replaceable> advskew <replaceable>100</replaceable> pass <replaceable>testpass</replaceable> alias <replaceable>192.168.1.51</replaceable>/32"
Having two <acronym>CARP</acronym> <acronym>VHID</acronym>s 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.
If the original master server becomes available again, <systemitem>hostc.example.org</systemitem> will not release the virtual <acronym>IP</acronym> address back to it automatically. For this to happen, preemption has to be enabled. The feature is disabled by default, it is controlled via the <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> variable <varname>net.inet.carp.preempt</varname>. The administrator can force the backup server to return the <acronym>IP</acronym> address to the master:
<prompt>#</prompt> <userinput>ifconfig em0 vhid 1 state backup</userinput>
Once the configuration is complete, either restart networking or reboot each system. High availability is now enabled.
<acronym>CARP</acronym> functionality can be controlled via several <citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> variables documented in the <citerefentry><refentrytitle>carp</refentrytitle><manvolnum>4</manvolnum></citerefentry> manual pages. Other actions can be triggered from <acronym>CARP</acronym> events by using <citerefentry><refentrytitle>devd</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
Using <acronym>CARP</acronym> on FreeBSD 9 and Earlier
The configuration for these versions of FreeBSD 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.
Enable boot-time support for <acronym>CARP</acronym> by loading the <filename>if_carp.ko</filename> kernel module in <filename>/boot/loader.conf</filename>:
if_carp_load="YES"
Next, on each host, create a <acronym>CARP</acronym> device:
<prompt>#</prompt> <userinput>ifconfig carp0 create</userinput>
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>:
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 <replaceable>1</replaceable> pass <replaceable>testpass</replaceable> <replaceable>192.168.1.50/24</replaceable>"
On <systemitem>hostb.example.org</systemitem>:
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 <replaceable>2</replaceable> pass <replaceable>testpass</replaceable> <replaceable>192.168.1.51/24</replaceable>"
The third machine, <systemitem>hostc.example.org</systemitem>, is configured to handle failover from either of the master hosts:
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 <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>"
Preemption is disabled in the <filename>GENERIC</filename> FreeBSD kernel. If preemption has been enabled with a custom kernel, <systemitem>hostc.example.org</systemitem> may not release the <acronym>IP</acronym> address back to the original content server. The administrator can force the backup server to return the <acronym>IP</acronym> address to the master with the command:
<prompt>#</prompt> <userinput>ifconfig carp0 down &amp;&amp; ifconfig carp0 up</userinput>
This should be done on the <filename>carp</filename> interface which corresponds to the correct host.
VLANs
<primary><acronym>VLANs</acronym></primary>

Loading…

No matching activity found.

Browse all component changes

Source information

Source string comment
(itstool) path: sect2/para
Flags
read-only
Source string location
book.translate.xml:65535
String age
a year ago
Source string age
a year ago
Translation file
books/handbook.pot, string 11297