开启ip组播
centos7
centos6
keepalived安装配置
2台主机
server | hostname | ip |
---|---|---|
keepalived | ka1 | 192.168.99.103 |
keepalived | ka2 | 192.168.99.104 |
1、2台分别安装keepalived
1 | yum -y install keepalived |
2、修改ka1的配置
1 | vim /etc/keepalived/keepalived.conf |
3、修改ka2的配置
1 | ! Configuration File for keepalived |
4、在ka1或ka2新开个终端准备抓包
1 | tcpdump -i eth0 -nn net 224.100.100.100 |
5、启动ka2的keepalived(先启动backup)
1 | systemctl restart keepalived |
抓到包了。
VIP绑定上了
6、再启动ka1的keepalived(注意看抓包)
1 | systemctl start keepalived |
可以看到,宣告的IP变成了ka1的了
VIP漂移到ka1了,因为ka1的优先级比ka2高