DNSPod / dnspod-sr

A faster recursive dns server from DNSPod
Other
1.36k stars 328 forks source link

多 IP 问题 #49

Open ghost opened 8 years ago

ghost commented 8 years ago

在同一个网卡配置 2 个 IP:

# ip addr show em1
2: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:a1:70:38 brd ff:ff:ff:ff:ff:ff
    inet 192.168.190.129/24 brd 192.168.190.255 scope global em1
       valid_lft forever preferred_lft forever
    inet 192.168.190.130/24 brd 192.168.190.255 scope global secondary em1:0
       valid_lft forever preferred_lft forever

当使用第二个 IP 来 dig @192.168.190.130 copybash.com,dig 失败,原因是请求从第一个 IP 返回来了,dig 认为这是欺骗行为:

;; reply from unexpected source: 192.168.190.129#53, expected 192.168.190.130#53
;; reply from unexpected source: 192.168.190.129#53, expected 192.168.190.130#53
;; reply from unexpected source: 192.168.190.129#53, expected 192.168.190.130#53

; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7 <<>> @192.168.190.130 copybash.com
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached

基于这样的原因,keepalive + LVS 的 VIP 无法正常提供域名解析服务。一个不够友好的解决方式就是在 /etc/resolv.conf 里面写多个 dnspod-sr 的 IP 作为 nameserver,来实现高可用。