lvs dr模式安裝

來源:互聯網
上載者:User

lvs dr模式安裝

環境:centos5.5 註:測試環境均為centos5.5,在虛擬機器上虛擬三個centos系統)

vip 192.168.3.169

lb真是ip192.168.3.168

server1 ip:192.168.10.2

server1 ip:192.168.10.3

rpm包安裝ipvsadmin

I lb上邊配置

1 複製網卡ifcfg-eth0:1

DEVICE=eth0:1

BOOTPROTO=none

IPADDR=192.168.3.169

NETMASK=255.255.0.0

ONBOOT=yes

2 開啟路由轉寄功能 vim /etc/sysctl.conf

net.ipv4.ip_forward = 1

3添加指令碼

#!/bin/sh

ipvsadm -C

ipvsadm -A -t 192.168.3.169:80 -s wlc

ipvsadm -a -t 192.168.3.169:80 -r 192.168.10.2 -g

ipvsadm -a -t 192.168.3.169:80 -r 192.168.10.3 -g


II server上邊配置

1 cp換回介面 ifcfg-lo:1

DEVICE=lo:1

IPADDR=192.168.3.169

NETMASK=255.255.255.255

NETWORK=192.168.3.169

ONBOOT=yes

ARP=no


2開啟路由轉寄 vim /etc/sysctl.conf

net.ipv4.ip_forward = 1

添加


net.ipv4.conf.lo.arp_ignore = 1

net.ipv4.conf.all.arp_announce = 2

net.ipv4.conf.all.arp_ignore = 1

net.ipv4.conf.all.arp_announce = 2


使用sysctl -p 儲存

兩台伺服器同樣的配置

III 在lb上啟動ipvsadm


service ipvsadm start

Clearing the current IPVS table: [確定]

Applying IPVS configuration: /etc/init.d/ipvsadm: line 62: /etc/sysconfig/ipvsadm: 沒有那個檔案或目錄

[失敗]


出現這樣的錯誤service ipvsadm save 然後再重啟

運行剛才的指令碼

查看狀態

ipvsadm -L -n

IP Virtual Server version 1.2.1 (size=4096)

Prot LocalAddress:Port Scheduler Flags

-> RemoteAddress:Port Forward Weight ActiveConn InActConn

TCP 192.168.3.169:80 wlc

-> 192.168.10.3:80 Route 1 0 28

-> 192.168.10.2:80 Route 1 0 27


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.