LVS 無法從外部存取

LVS 無法從外部存取

我目前正忙著建立一個LVS - Linux 虛擬伺服器:

root@debian1:~# ipvsadm -L
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP  debian1.lan:http wlc
  -> debian2.lan:http             Masq    1      0          1         
  -> debian3.lan:http             Masq    1      0          1         

debian1.lan 是我的 VIP。 debian2 和 3 正在運行 apache。

我可以用來curl取得內容:

root@debian1:~# curl debian1.lan
<html><body><h1>debian2</h1>
<p>This is the default web page for this server.</p>
<p>The web server software is running but no content has been added, yet.</p>
</body></html>

但是當我從 Windows 電腦存取 debian1.lan (10.0.0.171) 時,firefox我收到一條「連線已逾時」訊息。

Virtualbox 是否有可能搞亂 LVS? (debian 1 到 3 是 Virtualbox 中使用橋接轉接器的虛擬機器)。

我開始tcpdump使用 debian2 並看到資料包(當我使用 時firefox),儘管我不確定其含義:

root@debian2:~# tcpdump -s 0 -A tcp port http
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
13:07:05.725727 IP My-PC.lan.54663 > debian2.lan.http: Flags [S], seq 1738645408, win 8192, options [mss 1460,nop,wscale 2,nop,nop,sackOK], length 0
[email protected]
...
......Pg......... .\...............
13:07:05.725755 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0
E..4..@.@.%{
...
....P..
...g.....9..p..............
13:07:06.722025 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0
E..4..@.@.%{
...
....P..
...g.....9..p..............
13:07:08.722729 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0
E..4..@.@.%{
...
....P..
...g.....9..p..............
13:07:08.723841 IP My-PC.lan.54663 > debian2.lan.http: Flags [S], seq 1738645408, win 8192, options [mss 1460,nop,wscale 2,nop,nop,sackOK], length 0
E..4.a@.....
...
......Pg......... .\...............
13:07:08.723849 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0
E..4..@.@.%{
...
....P..
...g.....9..p..............
13:07:12.722808 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0
E..4..@.@.%{
...
....P..
...g.....9..p..............
13:07:14.724158 IP My-PC.lan.54663 > debian2.lan.http: Flags [S], seq 1738645408, win 8192, options [mss 1460,nop,nop,sackOK], length 0
E..0.g@.....
...
......Pg.......p. .p...........
13:07:14.724179 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0
E..4..@.@.%{
...
....P..
...g.....9..p..............
13:07:20.722805 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0
E..4..@.@.%{
...
....P..
...g.....9..p..............

有人可以向我提供有關我下一步可以做什麼或檢查的幫助提示嗎?

答案1

我終於成功了。解決方案是為LVS中的真實伺服器創建一個全新的專用網絡,我使用192.168.1.x(當然director也需要訪問這個網絡)。對於 VIP,我使用了我的公用 IP 位址 10.0.0.x 。此外,我必須從 LVS 中的真實伺服器中刪除舊網路 (10.0.0.x) 中的任何追蹤。

root@debian1:~# ipvsadm -L --stats
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port               Conns   InPkts  OutPkts  InBytes OutBytes
  -> RemoteAddress:Port
TCP  debian1.lan:http                   45      269      167    27483    27061
  -> 192.168.1.2:http                   21      118       74    11370    11912
  -> 192.168.1.3:http                   24      151       93    16113    15149

希望這可以幫助遇到相同問題的人。

相關內容