.TH KEEPALIVED.CONF 5 "Jan 2004" V1.0 .UC 4 .SH NAME /etc/keepalived/keepalived.conf - configuration file for keepalived .br .SH DESCRIPTION .B keepalived.conf is the configuration file which describes all the keepalived keywords. keywords are placed in hierachies of blocks (and subblocks), each layer being delimited by '{' and '}' pairs. .PP Comments start with '#' or '!' to the end of the line and can start anywhere in a line. .SH TOP HIERACHY .PP .B GLOBAL CONFIGURATION .PP .B VRRPD CONFIGURATION .PP .B LVS CONFIGURATION .PP .SH GLOBAL CONFIGURATION contains subblocks of .B Global definitions and .B Static routes .PP .SH Global definitions .PP global_defs # Block id { notification_email # To: { admin@example1.com ... } # From: from address that will be in header notification_email_from admin@example.com smtp_server 127.0.0.1 # IP smtp_connect_timeout 30 # integer, seconds router_id my_hostname # string identifying the machine, # (doesn't have to be hostname). vrrp_mcast_group4 224.0.0.18 # optional, default 224.0.0.18 vrrp_mcast_group6 ff02::12 # optional, default ff02::12 enable_traps # enable SNMP traps } .SH Static routes/addresses .PP keepalived can configure static addresses and routes. These addresses are .B NOT moved by vrrpd, they stay on the machine. If you already have IPs and routes on your machines and your machines can ping each other, you don't need this section. .PP The syntax is the same as for virtual addresses and virtual routes. .PP static_ipaddress { 192.168.1.1/24 dev eth0 scope global ... } .PP static_routes { 192.168.2.0/24 via 192.168.1.100 dev eth0 ... } .PP .SH VRRPD CONFIGURATION contains subblocks of .B VRRP synchronization group(s) and .B VRRP instance(s) .PP .SH VRRP synchronization group(s) .PP #string, name of group of IPs that failover together vrrp_sync_group VG_1 { group { inside_network # name of vrrp_instance (below) outside_network # One for each moveable IP. ... } # notify scripts and alerts are optional # # filenames of scripts to run on transitions # can be unquoted (if just filename) # or quoted (if has parameters) # to MASTER transition notify_master /path/to_master.sh # to BACKUP transition notify_backup /path/to_backup.sh # FAULT transition notify_fault "/path/fault.sh VG_1" # for ANY state transition. # "notify" script is called AFTER the # notify_* script(s) and is executed # with 3 arguments provided by keepalived # (ie don't include parameters in the notify line). # arguments # $1 = "GROUP"|"INSTANCE" # $2 = name of group or instance # $3 = target state of transition # ("MASTER"|"BACKUP"|"FAULT") notify /path/notify.sh # Send email notifcation during state transition, # using addresses in global_defs above. smtp_alert } .SH VRRP instance(s) .PP describes the moveable IP for each instance of a group in vrrp_sync_group. Here are described two IPs (on inside_network and on outside_network), on machine "my_hostname", which belong to the group VG_1 and which will transition together on any state change. .PP #You will need to write another block for outside_network. vrrp_instance inside_network { # Initial state, MASTER|BACKUP # As soon as the other machine(s) come up, # an election will be held and the machine # with the highest "priority" will become MASTER. # So the entry here doesn't matter a whole lot. state MASTER # interface for inside_network, bound by vrrp interface eth0 # Use VRRP Virtual MAC. use_vmac # Send/Recv VRRP messages from base interface instead of # VMAC interface vmac_xmit_base # Ignore VRRP interface faults (default unset) dont_track_primary # optional, monitor these as well. # go to FAULT state if any of these go down. track_interface { eth0 eth1 ... } # default IP for binding vrrpd is the primary IP # on interface. If you want to hide location of vrrpd, # use this IP as src_addr for multicast or unicast vrrp # packets. (since it's multicast, vrrpd will get the reply # packet no matter what src_addr is used). # optional mcast_src_ip unicast_src_ip # Do not send VRRP adverts over VRRP multicast group. # Instead it sends adverts to the following list of # ip addresses using unicast design fashion. It can # be cool to use VRRP FSM and features in a networking # environement where multicast is not supported ! # IP Addresses specified can IPv4 as well as IPv6 unicast_peer { ... } # Binding interface for lvs syncd lvs_sync_daemon_interface eth1 # delay for gratuitous ARP after transition to MASTER garp_master_delay 10 # secs, default 5 # arbitary unique number 0..255 # used to differentiate multiple instances of vrrpd # running on the same NIC (and hence same socket). virtual_router_id 51 # for electing MASTER, highest priority wins. # to be MASTER, make 50 more than other machines. priority 100 # VRRP Advert interval, secs (use default) advert_int 1 authentication { # Authentication block # PASS||AH # PASS - Simple Passwd (suggested) # AH - IPSEC (not recommended)) auth_type PASS # Password for accessing vrrpd. # should be the same for all machines. # Only the first eight (8) characters are used. auth_pass 1234 } #addresses add|del on change to MASTER, to BACKUP. #With the same entries on other machines, #the opposite transition will be occuring. virtual_ipaddress { / brd dev scope label