I have two identical Centos7 latest relase machines.One is named rotuer1 and other one is router2.
I will use VRRP protocol for router redundancy.In my test bench im not gonna use any layer 2/3 switches.
Specification :
MB: A2SDi-8C-HLN4F
1x Intel(R) Atom(TM) CPU C3758
1x *8gig memory
2х HUS722T1TALA604
4x internal network interfaces.
1.Network connectivity.
Routers are connected with crossover ethernet cable.In my case in eno3 interface.
router1 eno3 network interface config file
TYPE=”Ethernet”
BOOTPROTO=”static”
NAME=”eno3″
DEVICE=”eno3″
ONBOOT=”yes”
IPADDR=”10.10.10.10″
PREFIX=”24″
router2 eno3 network interface config file
TYPE=”Ethernet”
BOOTPROTO=”static”
NAME=”eno3″
DEVICE=”eno3″
ONBOOT=”yes”
IPADDR=”10.10.10.20″
PREFIX=”24″
Make sure to have ping form router1 <-> rotuer2 and telnet in 22 port for ssh.
Network card configuration in Centos
At the usual directory in centos7 we fill find configuration files for network interfaces.
/etc/sysconfig/network-scripts/
ifcfg-* files should not have any configuration for network addresses.
Example:
For vlan interface:
DEVICE=eno2.22
ONBOOT=yes
VLAN=yes
TYPE=”Ethernet”
And for non vlan interface:
NAME=eno2
DEVICE=eno2
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
Be sure all network interfaces are set with option ONBOOT=yes or keepalived will not start.
2.Pkgs
yum install keepalived conntrackd openvpn quagga
Keepalived high-availability is achieved by VRRP protocol. VRRP is a fundamental brick for router failover. In addition, Keepalived implements a set of hooks to the VRRP finite state machine providing low-level and high-speed protocol interactions.
Using following configuration in /etc/keepalive/keepalived.conf for master router1
global_defs {
notification_email {
dimo@d1m0.com #who get notifications .
pich@d1m0.com
}
notification_email_from dimo@dm10.com
smtp_server 192.168.3.7 # mail server to send mails
smtp_connect_timeout 30 # wait before retry .
router_id firewall #name of our machine
}vrrp_sync_group router {
group {
router_eno1
router_eno2
router_eno4}
# this script is in /usr/share/doc/conntrack-tools-1.4.4/doc/sync/. You may want to place it it keepalive config directory. It is used to notify Master and Backup for theirs states.
notify_master “/etc/keepalived/primary-backup.sh primary”
notify_backup “/etc/keepalived/primary-backup.sh backup”
notify_fault “/etc/keepalived/primary-backup.sh fault”
}vrrp_instance router_eno1 {
state MASTER # OR BACKUP
interface eno3 ### This is important interface.Over this interface router1 and router2 will talk to each others.
dont_track_primary
virtual_router_id 50
priority 100
advert_int 3
authentication {
auth_type PASS
auth_pass 11router #password is limited to 8 characters.
}
virtual_ipaddress {
#/ brd dev scope label
IMPORTANT: vrrp_instance limitations is UP TO 20 IP addresses.If your router have more than 20 ip addresses, set second vrrp_instance.
vrrp_instance router_eno4 {
state MASTER # or BACKUP
interface eno3
dont_track_primary
virtual_router_id 51
priority 100 # backup’s priority shoud be less than master’s
advert_int 3
authentication {
auth_type PASS
auth_pass 11router
}
virtual_ipaddress {
#/ brd dev scope label