位於2個網段的LVS的DR模型實驗

來源:互聯網
上載者:User

標籤:webseven   lvs   dr   2個網段   

實驗規劃說明:

Director兩塊網卡,IP地址分配如下:

1.本地公網IP(eth0):192.168.112.101

2.vip(eth1:1):192.168.112.100

3.dip(eth1):192.168.201.7


Realsever1兩塊網卡,IP地址分配如下:

1.rip(eth0):192.168.201.8

2.vip(lo:0):192.168.112.100

3.本地IP(eth1):192.168.112.8  //通過該IP以便從Realsever1可以訪問Client.

Realsever2兩塊網卡,IP地址分配如下:

1.rip(eth0):192.168.201.9

2.vip(lo:0):192.168.112.100

3.本地IP(eth1):192.168.112.9  //通過該IP以便從Realsever1可以訪問Client.


具體步驟如下:

1.配置realserver1的網路參數:

sysctl -p net.ipv4.conf.all.arp_ingore=1

sysctl -p net.ipv4.conf.eth0.arp_ingore=1

sysctl -p net.ipv4.conf.all.arp_announce=2

sysctl -p net.ipv4.conf.eth0.arp_announce=2

sysctl -p net.ipv4.ip_forward=1

若要上述資訊永久生效需要寫入/etc/sysctl.conf的設定檔.

ifconfig lo:0 192.168.112.100 broadcast 192.168.112.100 netmask 255.255.255.255 up

若要上述資訊永久生效需要寫入/etc/sysconfig/network-scripts/ifcfg-lo0的設定檔.

route add -host 192.168.112.100 dev lo:0


2.配置realserver2的網路參數:

sysctl -p net.ipv4.conf.all.arp_ingore=1

sysctl -p net.ipv4.conf.eth0.arp_ingore=1

sysctl -p net.ipv4.conf.all.arp_announce=2

sysctl -p net.ipv4.conf.eth0.arp_announce=2

sysctl -p net.ipv4.ip_forward=1

若要上述資訊永久生效需要寫入/etc/sysctl.conf的設定檔.

ifconfig lo:0 192.168.112.100 broadcast 192.168.112.100 netmask 255.255.255.255 up

若要上述資訊永久生效需要寫入/etc/sysconfig/network-scripts/ifcfg-lo0的設定檔.

route add -host 192.168.112.100 dev lo:0

3.配置director伺服器:

sysctl -p net.ipv4.ip_forward=1

若要上述資訊永久生效需要寫入/etc/sysctl.conf的設定檔.

ifconfig eth1:1 192.168.112.100 broadcast 192.168.112.100 netmask 255.255.255.255 up

route add -host 192.168.112.100 dev eth1:1

4.配置lvs.

[[email protected] ~]# ipvsadm -A -t  192.168.112.100:80 -s rr

[[email protected] ~]# ipvsadm -a -t  192.168.112.100:80 -r 192.168.201.8 -g

[[email protected] ~]# ipvsadm -a -t  192.168.112.100:80 -r 192.168.201.9 -g

[[email protected] ~]# ipvsadm -Ln

IP Virtual Server version 1.2.1 (size=4096)

Prot LocalAddress:Port Scheduler Flags

 -> RemoteAddress:Port           Forward Weight ActiveConn InActConn

TCP  192.168.112.100:80 rr

 -> 192.168.201.8:80             Route   1      0          0         

 -> 192.168.201.9:80             Route   1      0          0    

5.使用瀏覽器進行測試:

6.查看狀態:

[[email protected] ~]# ipvsadm -Ln --stats

IP Virtual Server version 1.2.1 (size=4096)

Prot LocalAddress:Port               Conns   InPkts  OutPkts  InBytes OutBytes

 -> RemoteAddress:Port

TCP  192.168.112.100:80                 53      271        0    28193        0

 -> 192.168.201.8:80                   27      140        0    13983        0

 -> 192.168.201.9:80                   26      131        0    14210        0

7.至此,基於2個網段的LVS的DR模型測試完成.


本文出自 “webseven” 部落格,請務必保留此出處http://webseven.blog.51cto.com/4388012/1549807

位於2個網段的LVS的DR模型實驗

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.