環境:
centos 7.5
keepalived 1.4.5
防火墻,SELinux均已關閉,主節點上可以看到vip生成,但是備節點以及其它服務器都無法ping通vip,keepalived 的vip可進行主備切換
主節點配置:
! Configuration File for keepalived
global_defs {
notification_email {
[email protected]
[email protected]
[email protected]
}
notification_email_from [email protected]
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 91
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
unicast_src_ip 192.168.126.11
unicast_peer {
192.168.126.12
}
virtual_ipaddress {
192.168.126.100/24
}
}
備節點配置:
! Configuration File for keepalived
global_defs {
notification_email {
[email protected]
[email protected]
[email protected]
}
notification_email_from [email protected]
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 91
priority 90
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
unicast_src_ip 192.168.126.12
unicast_peer {
192.168.126.11
}
virtual_ipaddress {
192.168.126.100/24
}
}
[root@host1 keepalived]# systemctl status keepalived.service
keepalived.service - LVS and VRRP High Availability Monitor
Loaded: loaded (/usr/lib/systemd/system/keepalived.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2018-07-26 21:32:01 EDT; 32min ago
Process: 32453 ExecStart=/usr/local/keepalived/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 32454 (keepalived)
Tasks: 3
CGroup: /system.slice/keepalived.service
32454 /usr/local/keepalived/sbin/keepalived -D
32455 /usr/local/keepalived/sbin/keepalived -D
32456 /usr/local/keepalived/sbin/keepalived -D
Jul 26 21:32:03 host1 Keepalived_vrrp[32456]: Sending gratuitous ARP on eth0 for 192.168.126.100
Jul 26 21:32:03 host1 Keepalived_vrrp[32456]: Sending gratuitous ARP on eth0 for 192.168.126.100
Jul 26 21:32:03 host1 Keepalived_vrrp[32456]: Sending gratuitous ARP on eth0 for 192.168.126.100
Jul 26 21:32:03 host1 Keepalived_vrrp[32456]: Sending gratuitous ARP on eth0 for 192.168.126.100
Jul 26 21:32:08 host1 Keepalived_vrrp[32456]: Sending gratuitous ARP on eth0 for 192.168.126.100
Jul 26 21:32:08 host1 Keepalived_vrrp[32456]: VRRP_Instance(VI_1) Sending/queueing gratuitous ARPs...100
Jul 26 21:32:08 host1 Keepalived_vrrp[32456]: Sending gratuitous ARP on eth0 for 192.168.126.100
Jul 26 21:32:08 host1 Keepalived_vrrp[32456]: Sending gratuitous ARP on eth0 for 192.168.126.100
Jul 26 21:32:08 host1 Keepalived_vrrp[32456]: Sending gratuitous ARP on eth0 for 192.168.126.100
[root@host2 keepalived]# systemctl status keepalived.service
keepalived.service - LVS and VRRP High Availability Monitor
Loaded: loaded (/usr/lib/systemd/system/keepalived.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2018-07-26 21:32:12 EDT; 32min ago
Process: 4527 ExecStart=/usr/local/keepalived/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 4528 (keepalived)
Tasks: 3
CGroup: /system.slice/keepalived.service
4528 /usr/local/keepalived/sbin/keepalived -D
4529 /usr/local/keepalived/sbin/keepalived -D
4530 /usr/local/keepalived/sbin/keepalived -D
Jul 26 21:32:12 host2 Keepalived_vrrp[4530]: Opening file '/etc/keepalived/keepalived.conf'.
Jul 26 21:32:12 host2 Keepalived_healthcheckers[4529]: Initializing ipvs
Jul 26 21:32:12 host2 Keepalived_healthcheckers[4529]: Gained quorum 1+0=1 <= 2 for VS [192.168.126...80
Jul 26 21:32:12 host2 Keepalived_healthcheckers[4529]: Activating healthchecker for service [192.16...80
Jul 26 21:32:12 host2 Keepalived_healthcheckers[4529]: Activating healthchecker for service [192.16...80
Jul 26 21:32:12 host2 Keepalived_vrrp[4530]: VRRP_Instance(VI_1) removing protocol VIPs.
Jul 26 21:32:12 host2 Keepalived_vrrp[4530]: Using LinkWatch kernel netlink reflector...
Jul 26 21:32:12 host2 Keepalived_vrrp[4530]: VRRP_Instance(VI_1) Entering BACKUP STATE
Jul 26 21:32:12 host2 Keepalived_vrrp[4530]: VRRP sockpool: [ifindex(2), proto(112), unicast(1), f...1)]
uj5u.com熱心網友回復:
在主上可以ping通vip? 12 11可以互通了?uj5u.com熱心網友回復:
你好,第一,主備是否可以ping通,vip是否能ping通,第二虛擬機是否有禁pinguj5u.com熱心網友回復:
大哥 你這是寫的啥 關鍵的資訊沒有啊uj5u.com熱心網友回復:
我也是你這種情況。主備可以ping通,但是 備無法ping vip
其他機器無法ping vip
uj5u.com熱心網友回復:
是防火墻問題 iptables -Fuj5u.com熱心網友回復:
樓主后來找到解決辦法了么,我遇到了一樣的問題,只有主節點能ping通vipuj5u.com熱心網友回復:
樓主的問題最后是怎么解決的?我們也遇到這種情況。uj5u.com熱心網友回復:
是啊,到底啥問題啊,我的也是,只有master可以ping VIP,back ping不通轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/9743.html
標籤:系統維護與使用區
