Использую схему IPVS Direct Routing, как обозначено здесь.
Для того, чтобы реальные сервера под Linux отдавали ответы нужно провести на них следующие манипуляции:
1. Добавить в ядро следующие параметры:
Код: Выделить всё
# nano /etc/sysctl.conf
net.ipv4.ip_nonlocal_bind = 1
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.eth0.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.eth0.arp_announce = 2
Код: Выделить всё
# nano /etc/network/interfaces
auto lo:0
iface lo:0 inet static
address 172.16.2.33 (адрес VIP)
netmask 255.255.255.255
Итак вернмся к фре...
Реальный сервер под FreeBSD 7.2, на которой я прописал alias для loopback интерфейса, но как сделать так, чтобы фря игнорировала ARP?
Вывод ipvs (пока с одним хостом, но все же...):
Код: Выделить всё
# ipvsadm -Ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 172.16.2.33:30583 rr persistent 120
-> 172.16.2.37:30583 Route 10 1 2
VIP (виртуальный адрес балансера) 172.16.2.33
RIP (адрес реального сервера) 172.16.2.37
Вот нашел как бы решение, но не помогло... тыц сюда
Вот дампы при разных настройках loopback.
Напрямую c клиента 172.16.2.35 без участия балансера 172.16.2.33:
Код: Выделить всё
# tcpdump -vv port 30583
tcpdump: listening on em0, link-type EN10MB (Ethernet), capture size 96 bytes
11:24:24.972474 IP (tos 0x10, ttl 64, id 25430, offset 0, flags [DF], proto TCP (6), length 60) 172.16.2.35.44844 > 172.16.2.37.30583: S, cksum 0x0549 (correct), 678177972:678177972(0) win 5840 <mss 1460,sackOK,timestamp 64638946 0,nop,wscale 5>
11:24:24.972565 IP (tos 0x0, ttl 64, id 1716, offset 0, flags [DF], proto TCP (6), length 60) 172.16.2.37.30583 > 172.16.2.35.44844: S, cksum 0x5c97 (incorrect (-> 0x9372), 3076133869:3076133869(0) ack 678177973 win 65535 <mss 1460,nop,wscale 3,sackOK,timestamp 233221993 64638946>
11:24:24.975073 IP (tos 0x10, ttl 64, id 25431, offset 0, flags [DF], proto TCP (6), length 52) 172.16.2.35.44844 > 172.16.2.37.30583: ., cksum 0xc182 (correct), 1:1(0) ack 1 win 183 <nop,nop,timestamp 64638947 233221993>
Код: Выделить всё
# tcpdump -vv port 30583
tcpdump: listening on em0, link-type EN10MB (Ethernet), capture size 96 bytes
11:26:45.120591 IP (tos 0x10, ttl 64, id 23042, offset 0, flags [DF], proto TCP (6), length 60) 172.16.2.35.57140 > 172.16.2.33.30583: S, cksum 0xc887 (correct), 1447330492:1447330492(0) win 5840 <mss 1460,sackOK,timestamp 64673982 0,nop,wscale 5>
11:26:48.115872 IP (tos 0x10, ttl 64, id 23043, offset 0, flags [DF], proto TCP (6), length 60) 172.16.2.35.57140 > 172.16.2.33.30583: S, cksum 0xc599 (correct), 1447330492:1447330492(0) win 5840 <mss 1460,sackOK,timestamp 64674732 0,nop,wscale 5>
11:26:54.116060 IP (tos 0x10, ttl 64, id 23044, offset 0, flags [DF], proto TCP (6), length 60) 172.16.2.35.57140 > 172.16.2.33.30583: S, cksum 0xbfbd (correct), 1447330492:1447330492(0) win 5840 <mss 1460,sackOK,timestamp 64676232 0,nop,wscale 5>
Код: Выделить всё
# tcpdump -vv port 30583
tcpdump: listening on em0, link-type EN10MB (Ethernet), capture size 96 bytes
11:29:30.994232 IP (tos 0x10, ttl 64, id 9030, offset 0, flags [DF], proto TCP (6), length 60) 172.16.2.35.57141 > 172.16.2.33.30583: S, cksum 0xff9c (correct), 2784057852:2784057852(0) win 5840 <mss 1460,sackOK,timestamp 64715450 0,nop,wscale 5>
11:29:30.994272 IP (tos 0x10, ttl 64, id 1861, offset 0, flags [DF], proto TCP (6), length 40) 172.16.2.33.30583 > 172.16.2.35.57141: R, cksum 0x5c7f (incorrect (-> 0xfccf), 0:0(0) ack 2784057853 win 0
Код: Выделить всё
# tcpdump -vv port 30583
tcpdump: listening on em0, link-type EN10MB (Ethernet), capture size 96 bytes
11:34:49.507921 IP (tos 0x10, ttl 64, id 27572, offset 0, flags [DF], proto TCP (6), length 60) 172.16.2.35.57142 > 172.16.2.33.30583: S, cksum 0x759d (correct), 2020661872:2020661872(0) win 5840 <mss 1460,sackOK,timestamp 64795076 0,nop,wscale 5>
11:34:49.508619 IP (tos 0x10, ttl 64, id 188, offset 0, flags [DF], proto TCP (6), length 40) 172.16.2.33.30583 > 172.16.2.35.57142: R, cksum 0x5c7f (incorrect (-> 0xa9db), 0:0(0) ack 2020661873 win 0
Спасибо!