centos keeplive ipv6配置
一、啟用keeplive
systemctl enable keepalived
二、檢查keeplive
systemctl status keepalived
三、修改配置文件/etc/keepalived/keepalived.conf
- node2(backup node)
! Configuration File for keepalived global_defs { #router_id LVS_DEVEL_IPv6 # 路由標識,建議唯一:cite[6] # 可配置全局的IPv6組播地址(一般使用默認值即可):cite[3] # vrrp_mcast_group6 ff02::12 } vrrp_instance VI_1 {
interface ens192
priority 100
virtual_router_id 51
advert_int 1
accept
garp_master_refresh 5
garp_master_refresh_repeat 1
unicast_src_ip 192.168.172.112
unicast_peer {
192.168.172.111
}
virtual_ipaddress {
192.168.172.113
}
track_script {
chk_nginx_service
chk_manual_failover
}
notify "/usr/libexec/keepalived/nginx-ha-notify"
}
vrrp_instance VI_6 { # VRRP實例名 #state BACKUP # 初始狀態,可均設為BACKUP配合nopreempt:cite[1] interface ens192 # 實際網絡接口名,請根據實際情況修改(如ens33:cite[1]) virtual_router_id 66 # 虛擬路由ID,同一實例主備需一致:cite[4] priority 100 # 優先級,備份節點應較低:cite[1] advert_int 1 # 通告時間間隔:cite[2] #nopreempt # 非搶占模式,可選:cite[1]
accept unicast_src_ip 2409:8095:800f:4::c0a8:ac70 # 本機IPv6地址:cite[1] unicast_peer { 2409:8095:800f:4::c0a8:ac6F # 對端Keepalived節點的IPv6地址:cite[1] } virtual_ipaddress { 2409:8095:800f:4::c0a8:ac71/120 # 虛擬IPv6地址 }
track_script {
chk_nginx_service
chk_manual_failover
}
notify "/usr/libexec/keepalived/nginx-ha-notify" }
2.node1(master node)
! Configuration File for keepalived global_defs { #router_id LVS_DEVEL_IPv6 # 路由標識,建議唯一:cite[6] # 可配置全局的IPv6組播地址(一般使用默認值即可):cite[3] # vrrp_mcast_group6 ff02::12 } vrrp_instance VI_1 { interface ens192 priority 101 virtual_router_id 51 advert_int 1 accept garp_master_refresh 5 garp_master_refresh_repeat 1 unicast_src_ip 192.168.172.111 unicast_peer { 192.168.172.111 } virtual_ipaddress { 192.168.172.113 } track_script { chk_nginx_service chk_manual_failover } notify "/usr/libexec/keepalived/nginx-ha-notify" } vrrp_instance VI_6 { # VRRP實例名 #state BACKUP # 初始狀態,可均設為BACKUP配合nopreempt:cite[1] interface ens192 # 實際網絡接口名,請根據實際情況修改(如ens33:cite[1]) virtual_router_id 66 # 虛擬路由ID,同一實例主備需一致:cite[4] priority 101 # 優先級,備份節點應較低:cite[1] advert_int 1 # 通告時間間隔:cite[2] #nopreempt # 非搶占模式,可選:cite[1] accept unicast_src_ip 2409:8095:800f:4::c0a8:ac6F # 本機IPv6地址:cite[1] unicast_peer { 2409:8095:800f:4::c0a8:ac70 # 對端Keepalived節點的IPv6地址:cite[1] } virtual_ipaddress { 2409:8095:800f:4::c0a8:ac71/120 # 虛擬IPv6地址 } track_script { chk_nginx_service chk_manual_failover } notify "/usr/libexec/keepalived/nginx-ha-notify" }
浙公網安備 33010602011771號