Soutient l'activité dans la grille Tinc VPN, Ne peut pas vérifier la connexion avec l'adresse VIP après l'élection
Description
Configuration
j'ai 3 nœud connecté avec Tinc VPN, où j'aimerais installer HAproxy et avoir VIP, de sorte que HAproxy C'était en mode haute disponibilité.
Voici les détails des nœuds:
Nouer 1 a une adresse IP
10.0.0.222/32
sur l'interface
vpn
Nouer 2 a une adresse IP
10.0.0.13/32
sur l'interface
vpn
Nouer 3 a une adresse IP
10.0.0.103/32
sur l'interface
vpn
Pour cela, j'ai installé
Sur chaque machine.
J'ai aussi inclus ce qui suit sysctl:
Nouer 1 Il a ce qui suit
/etc/keepalived/keepalived.conf
déposer:
Nœuds 2 et 3 avoir ce qui suit
/etc/keepalived/keepalived.conf
déposer :
Quand tous les nœuds fonctionnent
, Nouer 1 est la chose principale VIP
bien configuré 2 D'autres nœuds ping.
Magazines de nœud 1
Journaux lors du démarrage
:
Nouer 1
:
Nœuds de journaux 2 et 3
Nœuds 2 et 3
:
Nouer 2
Nouer 3
Ce problème
Mais alors, quand je m'arrête
Sur le nœud 1 nouer 3 Sélectionné comme un plomb et des registres VIP, Et seul noeud 3 Vérification 10.0.0.1.
Magazines de nœud 1
Quand arrêtez:
Nouer 1
:
Magazines de nœud 2
Nouer 2
:
Magazines de nœud 3
Nouer 3
:
Un peu plus de détails
Tracé
j'ai utilisé
Essayer d'obtenir plus d'informations sur le problème.
Quand tous les nœuds fonctionnent
et ping VIP fonctionne partout
Montre que pour tous les nœuds:
lorsque
Arrêté sur le noeud 1, et noeud 3 a été élu noeud 1 ne peut pas déterminer où VIP:
Nouer 2 attend un nœud 1 aura VIP:
Et au nœud 3 il y a VIP, Donc ça marche.
Tinc DeviceType
J'ai lu une sorte d'archive de courrier, où il a été proposé d'utiliser
en configuration Tinc, Obtenir des paquets ARP (aussi loin que je comprends), Mais cela n'a pas aidé.
En fait, je ne suis pas sûr que Tinc est la principale raison, car les élections se produisent.
Essayer sans Tinc
j'ai changé
config, Utiliser une interface Internet publique utilisant Unicast.
J'ai ajouté le bloc suivant dans chaque configuration keepalived Sur chaque noeud (ici pour
):
Mais le comportement est exactement le même que décrit ci-dessus, donc Tinc ne devrait pas être connecté.
Demande
Quelqu'un peut-il m'aider à comprendre ce qui ne se passe-t-il pas et résolvez ce problème pour que les nœuds de nouveaux élections trouvent VIP Dans sa nouvelle place?
</pointopoint,multicast,noarp,up,lower_up></pointopoint,multicast,noarp,up,lower_up></pointopoint,multicast,noarp,up,lower_up></pointopoint,multicast,noarp,up,lower_up></pointopoint,multicast,noarp,up,lower_up></pointopoint,multicast,noarp,up,lower_up>
Configuration
j'ai 3 nœud connecté avec Tinc VPN, où j'aimerais installer HAproxy et avoir VIP, de sorte que HAproxy C'était en mode haute disponibilité.
Voici les détails des nœuds:
Nouer 1 a une adresse IP
10.0.0.222/32
sur l'interface
vpn
Nouer 2 a une adresse IP
10.0.0.13/32
sur l'interface
vpn
Nouer 3 a une adresse IP
10.0.0.103/32
sur l'interface
vpn
Pour cela, j'ai installé
keepalived
Sur chaque machine.
J'ai aussi inclus ce qui suit sysctl:
net.ipv4.ip_forward = 1
net.ipv4.ip_nonlocal_bind = 1
Nouer 1 Il a ce qui suit
/etc/keepalived/keepalived.conf
déposer:
global_defs {
enable_script_security
router_id node-1
}
vrrp_script haproxy-check {
script "/usr/bin/killall -0 haproxy"
interval 2
weight 2
}
vrrp_instance haproxy-vip {
state MASTER
priority 150
interface vpn
virtual_router_id 1
advert_int 1
virtual_ipaddress {
10.0.0.1/32
}
track_script {
haproxy-check
}
}
Nœuds 2 et 3 avoir ce qui suit
/etc/keepalived/keepalived.conf
déposer :
global_defs {
enable_script_security
router_id node-2 # Node 3 has "node-3" here.
}
vrrp_script haproxy-check {
script "/usr/bin/killall -0 haproxy"
interval 2
weight 2
}
vrrp_instance haproxy-vip {
state BACKUP
priority 100
interface vpn
virtual_router_id 1
advert_int 1
virtual_ipaddress {
10.0.0.1/32
}
track_script {
haproxy-check
}
}
Quand tous les nœuds fonctionnent
keepalived
, Nouer 1 est la chose principale VIP
10.0.0.1
bien configuré 2 D'autres nœuds ping.
Magazines de nœud 1
Journaux lors du démarrage
keepalived
:
Dec 5 14:07:53 node-1 systemd[1]: Starting Keepalive Daemon (LVS and VRRP)...
Dec 5 14:07:53 node-1 Keepalived[5870]: Starting Keepalived v1.3.2 (12/03,2016)
Dec 5 14:07:53 node-1 systemd[1]: Started Keepalive Daemon (LVS and VRRP).
Dec 5 14:07:53 node-1 Keepalived[5870]: WARNING - default user 'keepalived_script' for script execution does not exist - please create.
Dec 5 14:07:53 node-1 Keepalived[5870]: Opening file '/etc/keepalived/keepalived.conf'.
Dec 5 14:07:53 node-1 Keepalived[5871]: Starting Healthcheck child process, pid=5872
Dec 5 14:07:53 node-1 Keepalived_healthcheckers[5872]: Initializing ipvs
Dec 5 14:07:53 node-1 Keepalived_healthcheckers[5872]: Registering Kernel netlink reflector
Dec 5 14:07:53 node-1 Keepalived_healthcheckers[5872]: Registering Kernel netlink command channel
Dec 5 14:07:53 node-1 Keepalived_healthcheckers[5872]: Opening file '/etc/keepalived/keepalived.conf'.
Dec 5 14:07:53 node-1 Keepalived[5871]: Starting VRRP child process, pid=5873
Dec 5 14:07:53 node-1 Keepalived_vrrp[5873]: Registering Kernel netlink reflector
Dec 5 14:07:53 node-1 Keepalived_vrrp[5873]: Registering Kernel netlink command channel
Dec 5 14:07:53 node-1 Keepalived_vrrp[5873]: Registering gratuitous ARP shared channel
Dec 5 14:07:53 node-1 Keepalived_vrrp[5873]: Opening file '/etc/keepalived/keepalived.conf'.
Dec 5 14:07:53 node-1 Keepalived_healthcheckers[5872]: Using LinkWatch kernel netlink reflector...
Dec 5 14:07:53 node-1 Keepalived_vrrp[5873]: Using LinkWatch kernel netlink reflector...
Dec 5 14:07:53 node-1 Keepalived_vrrp[5873]: VRRP_Script(haproxy-check) succeeded
Dec 5 14:07:54 node-1 Keepalived_vrrp[5873]: VRRP_Instance(haproxy-vip) Transition to MASTER STATE
Dec 5 14:07:54 node-1 Keepalived_vrrp[5873]: VRRP_Instance(haproxy-vip) Changing effective priority from 150 to 152
Dec 5 14:07:55 node-1 Keepalived_vrrp[5873]: VRRP_Instance(haproxy-vip) Entering MASTER STATE
Dec 5 14:07:57 node-1 ntpd[946]: Listen normally on 45 vpn 10.0.0.1:123
Nouer 1
ip addr
:
vpn: <pointopoint,multicast,noarp,up,lower_up> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 500
link/none
inet 10.0.0.222/24 scope global vpn
valid_lft forever preferred_lft forever
inet 10.0.0.1/24 scope global secondary vpn
valid_lft forever preferred_lft forever
Nœuds de journaux 2 et 3
Dec 5 14:14:32 node-2 systemd[1]: Starting Keepalive Daemon (LVS and VRRP)...
Dec 5 14:14:32 node-2 Keepalived[13745]: Starting Keepalived v1.3.2 (12/03,2016)
Dec 5 14:14:32 node-2 Keepalived[13745]: WARNING - default user 'keepalived_script' for script execution does not exist - please create.
Dec 5 14:14:32 node-2 Keepalived[13745]: Opening file '/etc/keepalived/keepalived.conf'.
Dec 5 14:14:32 node-2 Keepalived[13746]: Starting Healthcheck child process, pid=13747
Dec 5 14:14:32 node-2 Keepalived_healthcheckers[13747]: Initializing ipvs
Dec 5 14:14:32 node-2 systemd[1]: Started Keepalive Daemon (LVS and VRRP).
Dec 5 14:14:32 node-2 Keepalived_healthcheckers[13747]: Registering Kernel netlink reflector
Dec 5 14:14:32 node-2 Keepalived_healthcheckers[13747]: Registering Kernel netlink command channel
Dec 5 14:14:32 node-2 Keepalived[13746]: Starting VRRP child process, pid=13748
Dec 5 14:14:32 node-2 Keepalived_healthcheckers[13747]: Opening file '/etc/keepalived/keepalived.conf'.
Dec 5 14:14:32 node-2 Keepalived_vrrp[13748]: Registering Kernel netlink reflector
Dec 5 14:14:32 node-2 Keepalived_vrrp[13748]: Registering Kernel netlink command channel
Dec 5 14:14:32 node-2 Keepalived_vrrp[13748]: Registering gratuitous ARP shared channel
Dec 5 14:14:32 node-2 Keepalived_vrrp[13748]: Opening file '/etc/keepalived/keepalived.conf'.
Dec 5 14:14:32 node-2 Keepalived_healthcheckers[13747]: Using LinkWatch kernel netlink reflector...
Dec 5 14:14:32 node-2 Keepalived_vrrp[13748]: Using LinkWatch kernel netlink reflector...
Dec 5 14:14:32 node-2 Keepalived_vrrp[13748]: VRRP_Instance(haproxy-vip) Entering BACKUP STATE
Dec 5 14:14:32 node-2 Keepalived_vrrp[13748]: VRRP_Script(haproxy-check) succeeded
Dec 5 14:14:33 node-2 Keepalived_vrrp[13748]: VRRP_Instance(haproxy-vip) Changing effective priority from 100 to 102
Nœuds 2 et 3
ip addr
:
Nouer 2
vpn: <pointopoint,multicast,noarp,up,lower_up> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 500
link/none
inet 10.0.0.13/24 scope global vpn
valid_lft forever preferred_lft forever
Nouer 3
vpn: <pointopoint,multicast,noarp,up,lower_up> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 500
link/none
inet 10.0.0.103/24 scope global vpn
valid_lft forever preferred_lft forever
Ce problème
Mais alors, quand je m'arrête
keepalived
Sur le nœud 1 nouer 3 Sélectionné comme un plomb et des registres VIP, Et seul noeud 3 Vérification 10.0.0.1.
Magazines de nœud 1
Quand arrêtez:
Dec 5 14:15:26 node-1 systemd[1]: Stopping Keepalive Daemon (LVS and VRRP)...
Dec 5 14:15:26 node-1 Keepalived[5871]: Stopping
Dec 5 14:15:26 node-1 Keepalived_healthcheckers[5872]: Stopped
Dec 5 14:15:26 node-1 Keepalived_vrrp[5873]: VRRP_Instance(haproxy-vip) sent 0 priority
Dec 5 14:15:27 node-1 Keepalived_vrrp[5873]: Stopped
Dec 5 14:15:27 node-1 Keepalived[5871]: Stopped Keepalived v1.3.2 (12/03,2016)
Dec 5 14:15:27 node-1 systemd[1]: Stopped Keepalive Daemon (LVS and VRRP).
Dec 5 14:15:28 node-1 ntpd[946]: Deleting interface #45 vpn, 10.0.0.1#123, interface stats: received=0, sent=0, dropped=0, active_time=451 secs
Nouer 1
ip addr
:
vpn: <pointopoint,multicast,noarp,up,lower_up> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 500
link/none
inet 10.0.0.222/24 scope global vpn
valid_lft forever preferred_lft forever
Magazines de nœud 2
Dec 5 14:15:27 node-2 Keepalived_vrrp[13748]: VRRP_Instance(haproxy-vip) Transition to MASTER STATE
Dec 5 14:15:27 node-2 Keepalived_vrrp[13748]: VRRP_Instance(haproxy-vip) Received advert with higher priority 102, ours 102
Dec 5 14:15:27 node-2 Keepalived_vrrp[13748]: VRRP_Instance(haproxy-vip) Entering BACKUP STATE
Nouer 2
ip addr
:
vpn: <pointopoint,multicast,noarp,up,lower_up> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 500
link/none
inet 10.0.0.13/24 scope global vpn
valid_lft forever preferred_lft forever
Magazines de nœud 3
Dec 5 14:15:27 node-3 Keepalived_vrrp[31252]: VRRP_Instance(haproxy-vip) Transition to MASTER STATE
Dec 5 14:15:27 node-3 Keepalived_vrrp[31252]: VRRP_Instance(haproxy-vip) Received advert with lower priority 102, ours 102, forcing new election
Dec 5 14:15:28 node-3 Keepalived_vrrp[31252]: VRRP_Instance(haproxy-vip) Entering MASTER STATE
Dec 5 14:15:29 node-3 ntpd[27734]: Listen normally on 36 vpn 10.0.0.1:123
Nouer 3
ip addr
:
vpn: <pointopoint,multicast,noarp,up,lower_up> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 500
link/none
inet 10.0.0.103/24 scope global vpn
valid_lft forever preferred_lft forever
inet 10.0.0.1/24 scope global secondary vpn
valid_lft forever preferred_lft forever
Un peu plus de détails
Tracé
j'ai utilisé
traceroute
Essayer d'obtenir plus d'informations sur le problème.
Quand tous les nœuds fonctionnent
keepalived
et ping VIP fonctionne partout
traceroute
Montre que pour tous les nœuds:
$ traceroute 10.0.0.1
traceroute to 10.0.0.1 (10.0.0.1), 30 hops max, 60 byte packets
1 10.0.0.1 (10.0.0.1) 0.094 ms 0.030 ms 0.019 ms
lorsque
keepalived
Arrêté sur le noeud 1, et noeud 3 a été élu noeud 1 ne peut pas déterminer où VIP:
$ traceroute 10.0.0.1
traceroute to 10.0.0.1 (10.0.0.1), 30 hops max, 60 byte packets
1 * * *
2 * * *
...
29 * * *
30 * * *
Nouer 2 attend un nœud 1 aura VIP:
$ traceroute 10.0.0.1
traceroute to 10.0.0.1 (10.0.0.1), 30 hops max, 60 byte packets
1 10.0.0.222 (10.0.0.222) 0.791 ms 0.962 ms 1.080 ms
2 * * *
3 * * *
...
Et au nœud 3 il y a VIP, Donc ça marche.
Tinc DeviceType
J'ai lu une sorte d'archive de courrier, où il a été proposé d'utiliser
DeviceType = tap
en configuration Tinc, Obtenir des paquets ARP (aussi loin que je comprends), Mais cela n'a pas aidé.
En fait, je ne suis pas sûr que Tinc est la principale raison, car les élections se produisent.
Essayer sans Tinc
j'ai changé
keepalived
config, Utiliser une interface Internet publique utilisant Unicast.
J'ai ajouté le bloc suivant dans chaque configuration keepalived Sur chaque noeud (ici pour
node-1
):
unicast_src_ip XXX.XXX.XXX.XXX # node's public IP address
unicast_peer {
XXX.XXX.XXX.XXX # other node's public IP address
XXX.XXX.XXX.XXX # other node's public IP address
}
Mais le comportement est exactement le même que décrit ci-dessus, donc Tinc ne devrait pas être connecté.
Demande
Quelqu'un peut-il m'aider à comprendre ce qui ne se passe-t-il pas et résolvez ce problème pour que les nœuds de nouveaux élections trouvent VIP Dans sa nouvelle place?
</pointopoint,multicast,noarp,up,lower_up></pointopoint,multicast,noarp,up,lower_up></pointopoint,multicast,noarp,up,lower_up></pointopoint,multicast,noarp,up,lower_up></pointopoint,multicast,noarp,up,lower_up></pointopoint,multicast,noarp,up,lower_up>
Aucun résultat connexe trouvé
Invité:
Pour répondre aux questions, connectez-vous ou registre
1 réponses
Catherine
Confirmation de:
Dans mon. tinc.conf.
Le problème avec lequel j'ai rencontré était similaire à ce que vous décrivez; keepalived va déplacer l'adresse IP virtuelle que j'ai configurée (Pointant vers un serveur simple nginx) Entre mon 3 nœuds, comme prévu. Cependant, le seul nœud capable de contacter le service était le maître élu. Cela s'est produit en raison du fait que la table de routage a été construite statique des fichiers de configuration hôte et non des données ARP.
Je paraisse vraiment étrange que votre tentative sans tinc manqué. Lorsque j'ai changé mes configurations pour travailler dans mon réseau local, dans lequel il y a un routeur, keepalived et haproxy travaillé correctement, et vip était visible dans la table ARP routeur. Vous êtes sûr que cette configuration modifiée haproxy et keepalived Pour le test local?
Bonne chance!
Liens:
https://www.tinc-vpn.org/docum ... .html
https://www.tinc-vpn.org/piper ... .html