我已经设置 keepalived 来管理两个主机之间的虚拟 IP。
Server #1: Hostname folmer, ip 192.168.0.1/22 dev p2p1
Server #2: Hostname flemming, ip 192.168.0.2/22 dev p2p1
VIP: 192.168.0.3/22
Run Code Online (Sandbox Code Playgroud)
Keepalived 正在工作,当一台服务器出现故障时,VIP 会在服务器之间切换。
问题:在本地网络上,我可以 ping 通 192.168.0.3,但是当我将默认路由设置为 192.168.0.3 而不是 192.168.0.1 时,我无法再通过服务器 #1 访问互联网。
global_defs {
notification_email {
[SNIP]
[SNIP]
}
notification_email_from [SNIP]
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id folmer
}
vrrp_instance VI_1 {
state MASTER
interface p2p1
virtual_router_id 52
priority 150
advert_int 1
garp_master_delay 2
smtp_alert
authentication {
auth_type PASS
auth_pass [SNIP] …
Run Code Online (Sandbox Code Playgroud)