*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->OpenBSD man pages -> carp (4)              



NAME    [Toc]    [Back]

     carp - Common Address Redundancy Protocol

SYNOPSIS    [Toc]    [Back]

     pseudo-device carp [count]

DESCRIPTION    [Toc]    [Back]

     The carp interface is a pseudo-device which  implements  and
controls the
     CARP protocol.  carp allows multiple hosts on the same local
network to
     share a set of IP addresses.  Its primary purpose is to  ensure that these
     addresses  are  always available, but in some configurations
carp can also
     provide load balancing functionality.

     A carp  interface  can  be  created  at  runtime  using  the
ifconfig carpN
     create  command or by setting up a hostname.if(5) configuration file for

     To use carp, the administrator needs to configure at minimum
a common
     virtual  host ID and virtual host IP address on each machine
which is to
     take part in the virtual group.  Additional  parameters  can
also be set on
     a  per-interface  basis: advbase and advskew, which are used
to control how
     frequently the host sends advertisements when it is the master for a virtual
  host,  and pass which is used to authenticate carp advertisements.
     These configurations  can  be  done  using  ifconfig(8),  or
through the
     SIOCSVH ioctl.

     Additionally,  there are a number of global parameters which
can be set
     using sysctl(8).

EXAMPLES    [Toc]    [Back]

     In order to set up an ARP balanced virtual host, it is  necessary to configure
  one  virtual host for each physical host which would
respond to ARP
     requests and thus handle the traffic.  In the following  example, 2 hosts
     are  configured to provide balancing and failover for the IP

     First the carp interfaces on Host  A  are  configured.   The
advskew of 100
     on  the  second  virtual  host means that its advertisements
will be sent out
     slightly less frequently.

           # ifconfig carp0 create
           #  ifconfig   carp0   vhid   1   pass   mekmitasdigoat          
           # ifconfig carp1 create
           #  ifconfig  carp1  vhid  2 advskew 100 pass mekmitasdigoat          

     The configuration for host B is identical, except  the  skew
is on virtual
     host 1 rather than virtual host 2.

           # ifconfig carp0 create
           #  ifconfig  carp0  vhid  1 advskew 100 pass mekmitasdigoat          
           # ifconfig carp1 create
           #  ifconfig   carp1   vhid   2   pass   mekmitasdigoat          

     Finally,  the  ARP balancing feature must be enabled on both

           # sysctl net.inet.carp.arpbalance=1

     When the hosts receive an ARP request for, they
both select
     one  of  the virtual hosts based on the source IP address in
the request.
     The host which is master of that virtual host will reply  to
the request,
     the other will ignore it.

     Because the host which advertises most often will tend to be
the master,
     the result of this is that Host A will tend to be the master
for the virtual
 host with ID 1, while Host B will tend to be the master
for the virtual
 host with ID 2, and therefore arp requests  and  subsequent IP traffic
     are  balanced  across  the  two  hosts.  If one of the hosts
fails, the other
     will take over the virtual MAC address, and begin  answering
ARP requests
     on its behalf.

     Note: ARP balancing only works on the local network segment.
     which cross a router to arrive on the local network  segment
will all appear
  to  come  from that router and be balanced to the same

SEE ALSO    [Toc]    [Back]

     sysctl(3),  inet(4),   hostname.if(5),   ifconfig(8),   netstart(8), sysctl(8)

HISTORY    [Toc]    [Back]

     The carp device first appeared in OpenBSD 3.5.

OpenBSD      3.6                         October     16,     2003
[ Back ]
 Similar pages
Name OS Title
t_getprotaddr HP-UX get the protocol address
t_getprotaddr Tru64 Get the protocol address
arp OpenBSD Address Resolution Protocol
arp Tru64 Address Resolution Protocol
arp IRIX Address Resolution Protocol
arp FreeBSD Address Resolution Protocol
rarpc HP-UX Reverse Address Resolution Protocol client
rarpd HP-UX Reverse Address Resolution Protocol daemon
bind FreeBSD assign a local protocol address to a socket
getnameinfo Linux address-to-name translation in protocol-independent manner
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service