隨着開源技術的發展,以及商業設備價格的不斷攀升。大公司總是希望能使用開源的方案來替換過去使用的商業設備。比如之前大家用的很多的F5和A10,現在已經在逐步被LVS替換。傳統的單個lvs的性能是比不上商業設備的,而且穩定性等也相對會差些。告訴大家很多大公司都在用這些技術的。
基本思路就是把多個LVS組成一個OSPF集群,這樣可以使得LVS集群的性能可以遠遠超過單個傳統的商業設備(當然,對於F5等等其實也可以做這樣的集群做水平化的擴展)

原來就是把服務器也模擬成ospf中的一份子,是他可以在實現ospf的負載均衡,以及高可用性。
在這里網絡層的東西就不寫了,往簡單配置,沒意思。往難里配置我也不懂,上線服務器的時候,這些東西都是網絡組的負責,我只是負責服務器上的ospf的介入和業務方面的。
我這里只是簡單的說下ospf的框架

OSPF(Open Shortest Path First開放式最短路徑優先)是一個內部網關協議(Interior Gateway Protocol,簡稱IGP),用於在單一自治系統(autonomous system,AS)內決策路由。
ECMP(Equal-CostMultipathRouting)等價多路徑,存在多條不同鏈路到達同一目的地址的網絡環境中,如果使用傳統的路由技術,發往該目的地址的數據包只能利用其中的一條鏈路,其它鏈路處於備份狀態或無效狀態,並且在動態路由環境下相互的切換需要一定時間,而等值多路徑路由協議可以在該網絡環境下同時使用多條鏈路,不僅增加了傳輸帶寬,並且可以無時延無丟包地備份失效鏈路的數據傳輸。
特點:
4層負載均衡,效率高
配置簡單,只需安裝基於linux的路由軟件quagga
無法進行監控檢查,服務異常無法處理
無session保持等,功能過於簡單
貼上一個操作的例子:
OSPF(Open Shortest Path First開放式最短路徑優先)是一個內部網關協議(InteriorGateway Protocol,簡稱IGP),用於在單一自治系統(autonomous system,AS)內決策路由。
ECMP(Equal-CostMultipathRouting)等價多路徑,存在多條不同鏈路到達同一目的地址的網絡環境中,如果使用傳統的路由技術,發往該目的地址的數據包只能利用其中的一條鏈路,其它鏈路處於備份狀態或無效狀態,並且在動態路由環境下相互的切換需要一定時間,而等值多路徑路由協議可以在該網絡環境下同時使用多條鏈路,不僅增加了傳輸帶寬,並且可以無時延無丟包地備份失效鏈路的數據傳輸。
特點:
1.4層負載均衡,效率高
2.配置簡單,只需安裝基於linux的路由軟件quagga
3.無法進行監控檢查,服務異常無法處理
4. 無session保持等,功能過於簡單
路由器上的ospf的操作 ,這只是簡單的配置,大家可以按照自己的想法和網絡組的同學們扯淡提需求就行了。
配置命令:
R0配置:
Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname r0
r0(config)#
r0(config)#int e1/0
r0(config-if)#ip address 192.168.2.222 255.255.255.0
r0(config-if)#no shutdown
r0(config)#int e1/1
r0(config-if)#ip address 192.168.0.111 255.255.255.0
r0(config-if)#no shutdown
r0(config-if)#exit
r0(config)#router ospf 100
r0(config-router)#net
r0(config-router)#network 192.168.0.0 0.0.0.255 area 0
r0(config-router)#network 192.168.2.0 0.0.0.255 area 0
r0(config-router)#exit
r0(config)#int e1/1
r0(config-if)#ip ospf cost 2
r0(config-if)#int e1/0
r0(config-if)#ip ospf cost 2
r0(config-if)#end
r0#ping 192.168.0.14
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.14, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/93/1
==========================================================================
cisco默認的是hello時間是10s,死亡時間是hello時間的4倍,默認為40s,當然這個時間是可以修改的。在接口模式下面,通過命令:ip ospf hello-interval <time>來修改hello時間。ip ospf dead-interval <time>來修改死亡時間。
服務器端的配置
其實就是安裝一個軟路由,讓他進到ospf的圈子里面。
先說下qugga的基本安裝配置
1. 下載源碼
quagga-0.99.10.tar.gz
2. 解壓縮
tar xzvf quagga-0.99.10.tar.gz
3. 配置
cd quagga-0.99.10
./configure --prefix =/usr
--sysconfdir=/etc/quagga
--localstatedir=/var/run/quagga
--enable-vtysh
--enable-user='test'
--enable-group='test'
--enable-vty-group='test'
配置輸出:
Quagga configuration
--------------------
quagga version : 0.99.10
host operationg system : linux-gnu
source code location : .
compiler : gcc
compiler flags : -Os -fno-omit-frame-pointer -g -std=gnu99 -Wall -Wsign-compare -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wchar-subscripts -Wcast-qual
make : make
includes :
linker flags : -lcrypt -lcap -ltermcap -lreadline -lm
state file directory : /var/run/quagga
config file directory : /etc/quagga
example directory : /etc/quagga
user to run as : test
group to run as : test
group for vty sockets : test
config file mask : 0600
log file mask : 0600
The above user and group must have read/write access
to the state file directory and
to the config files in the config file directory.
quagga :
1. sudo apt-get install quagga安裝quagga
2. sudovim.tiny /etc/quagga/daemons將ospfd=no改成ospfd=yes
3. sudo touch/etc/quagga/ospfd.conf創建ospf配置文件
4. echo “password PASSWORD”>ospfd.conf,添加虛擬路由器登錄密碼,一定要設
5. chownquagga.quaggavty /etc/quagga/*.conf
chmod 640 /etc/quagga/*.conf
修改所有者與權限,否則配置無法保存
6. sudo/etc/init.d/quagga restart
7. telnet localhost 2604輸入剛才設置的密碼
enable進入特權模式,再configter進入配置模式開始對路由器進行配置,具體如下:
password cloud2.0
!
interface eth0
ipospf priority 0\\優先級為0,不參與DR選舉
!
interface eth1
!
interface lo
!
interfaceovs-system
!
routerospf
ospf router-id 192.168.123.3\\指定router-id
auto-cost reference-bandwidth 100000
network 183.2.198.128/32 area 0.0.0.30 \\宣告網段
network 192.168.123.0/24 area 0.0.0.30\\宣告網段
!
linevty
!
end
注意:
(1)所有運行OSPF協議的路由器router-id一定要唯一,如果不手動指定則會從路由器所有IP中自動選舉router-id。之前出現兩個自動選舉的router-id相同的現象,導致OSPF鄰居關系不正常
(2)reference-bandwidth 100000,所有運行OSPF協議的路由器的參考帶寬要一致
8. 配置完成后end退出到特權模式,用show ipospfnei與show ipospf route檢查鄰近關系和路由條目
9. write保存配置
