搭建keepalived遇到的問題

來源:互聯網
上載者:User

標籤:style   blog   http   color   os   使用   io   strong   ar   

搭建keepalived遇到的問題

主機192.168.100.10

備機192.168.100.20

VIP192.168.100.30

一.防火牆開啟後雙機都是master。

在搭建之後開啟防火牆發現雙機日誌都是MASTER

1 Aug 29 12:58:17 localhost Keepalived_vrrp[18365]: VRRP_Instance(VI_1) Transition to MASTER STATE2 Aug 29 12:58:18 localhost Keepalived_vrrp[18365]: VRRP_Instance(VI_1) Entering MASTER STATE3 Aug 29 12:58:18 localhost Keepalived_vrrp[18365]: VRRP_Instance(VI_1) setting protocol VIPs.4 Aug 29 12:58:18 localhost Keepalived_vrrp[18365]: VRRP_Instance(VI_1) Sending gratuitous ARPs on em1 for 192.168.100.305 Aug 29 12:58:18 localhost Keepalived_healthcheckers[18364]: Netlink reflector reports IP 192.168.100.30 added6 Aug 29 12:58:23 localhost Keepalived_vrrp[18365]: VRRP_Instance(VI_1) Sending gratuitous ARPs on em1 for     192.168.100.30

通過查看VRRP通訊原理髮現VRRP基於報文實現的。master設定一定時間發送一個報文給backup如果backup沒有收到就自己成為master。可推出導致問題的原因是因為backup沒有收到文

所以自己成為了master。

VRRP控制報文只有一種:VRRP通告(advertisement)。它使用IP多播資料包進行封裝,組地址為224.0.0.18,發布範圍只限於同一區域網路內。這保證了VRID在不同網路中可以重複使用。為了減少網路頻寬消耗只有主控路由器才可以周期性的發送VRRP通告報文。備份路由器在連續三個通告間隔內收不到VRRP或收到優先順序為0的通告後啟動新的一輪VRRP選舉。

 1 vrrp_instance VI_1 { 2     state BACKUP 3     interface em1 4     virtual_router_id 51 5     priority 50 6     advert_int 1 #VRRP報文的發送間隔 7     authentication { 8         auth_type PASS 9         auth_pass admin10     }11     virtual_ipaddress {12        192.168.100.30 dev em113     }

 在iptables上設定。

 1 vim /etc/sysconfig/iptables

2 添加-A INPUT -p vrrp -j ACCEPT 

搭建keepalived遇到的問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.