前不久本人負責了一個全國製造業有名集團的負載均衡項目感觸頗深通過項目瞭解到GSLB在特定環境當中的應用並且學到了許多相關的負載均衡知識。今天靜下心來想想通過項目確確實實可以學到很多東西項目實施過程當中也碰到相當多的問題現將項目的總體情況以及實施步驟方法寫在下面有碰到相關項目的情況大家能夠以此作爲參考。
A10放在內網中,設備旁路部署並且連接至內網中的核心交換機,核心交換機與防火牆相連,防火牆與多個運營商鏈路相連,所有出入公網的數據都通過防火牆。
內網有多個應用服務,外網有三條鏈路分別對應三個不同的運營商,要求外網用戶能夠根據運營商來智能選擇鏈路訪問,電信用戶選擇電信鏈路訪問,聯通用戶選擇聯通鏈路訪問。
①客戶DNS請求; 例如nc.sbtjt.com到本地運營商DNS
②本地運營商DNS遞歸查詢到A10 GSLB設備
③A10 GSLB會根據用戶所在鏈路和站點情況選擇最適合用戶站點 作爲DNS解析結果
④ DNS解析結果通過本地DNS返回給用戶
⑤用戶訪問最佳的鏈路站點
A10 GSLB配置步驟
1. DNS VIP
2. Geo-Location可選
4. Service-IP
5. Site
6. Zone
7. 啓用GSLB服務
GSLB基本配置 –> 1.DNS VIP
slb virtual-server dns_yidong 192.168.10.13
extended-stats
port 53 udp
gslb-enable
use-rcv-hop-for-resp
!
slb virtual-server dns-dianxin 192.168.10.16
extended-stats
port 53 udp
gslb-enable
use-rcv-hop-for-resp
!
slb virtual-server dns_liantong 192.168.10.18
extended-stats
port 53 udp
gslb-enable
use-rcv-hop-for-resp
在多鏈路環境下在Port53 UDP下啓用源進源出功能。
use-rcv-hop-for-resplServer Mode vs. ProxyMode
在Port 53 UDP下加載Service-Group即爲Proxy Mode在Port 53 UDP下不加載Service-Group即爲Server Mode。
GSLB基本配置 –> 2. Geo-Location
import geo-location chinagslb tftp://120.195.105.34/china-gslb.csv
gslb template csvchina
field 1 ip-from
field 2 ip-to-mask
field 3 country
!
!
no gslbgeo-location load iana
gslb geo-location load china-gslb.csv china
!
!
1.定義Geo-Location文件
2.導入預先定義的Geo-Location文件
GSLB基本配置 –> 3. GSLB Policy
gslb policy default
dns active-only
dns selected-only 1
dns server authoritative
metric-order health-check geographic admin-ip active-rdt weighted-ip weighted-site capacity active-servers connection-load num-session admin-preference bw-cost least-response
least-response
admin-ip
GSLB基本配置 –> 4. Service-IP
gslb service-ip yidong-nei192.168.10.13
external-ip 120.203.220.205
health-check gslb-yidong
port 8080 tcp
no health-check
!
1、Service-IP的命名最好與該IP所歸屬的站點/鏈路有關聯
2、如果Service IP需要通過防火牆NAT成公網地址需要在Service IP配置中將其公網IP配置在external IP一欄中
3、默認情況下AX/Thunder會對Service IP以及其下配置的端口做健康檢查
GSLB基本配置 –> 5. Site
gslb site dianxin
geo-location CTC
geo-location OTHER
geo-location CERNET
geo-location CRTC
slb-dev linkdianxin 192.168.10.211
vip-server dianxin-nei
!
gslb site liantong
geo-location UNICOM
geo-location CNC
geo-location CUC
slb-dev linkliantong 192.168.10.211
vip-server liantong-nei
!
gslb site yidong
geo-location CMCC
slb-dev linkyidong 192.168.10.211
vip-server yidong-nei
每個數據中心需要建立一個Site對於有多個鏈路出口的數據中心需要對應每個出口建立一個Site
在進行Service IP的關聯時有兩種方法
1、配置SLB-Device在其下關聯Service IP
2、直接在IP Server下配置
GSLB基本配置 –> 6. Zone
gslb zone gslbweb.sbtjt.com
service http web
dns-a-record dianxin-nei static
dns-a-record liantong-nei static
dns-a-record yidong-nei static
admin-ip dianxin-nei liantong-nei yidong-nei
service http oa
dns-a-record dianxin-nei static
dns-a-record liantong-nei static
dns-a-record yidong-nei static
admin-ip dianxin-nei liantong-nei yidong-nei
1、配置授權的域信息名稱必須與授權域保持一致
2、爲授權域下的每個主機配置DNS解析記錄
GSLB基本配置 –> 7. GSLB Enable
!
!
gslb protocol enable device
gslb protocol enable controller
全局下啓用GSLB功能
關於host-switching
slb template http host
host-switching contains nc.sbtjt.com service-group nct
host-switching contains oa.sbtjt.com service-group oa
host-switching contains web.sbtjt.com service-group web
slb virtual-server yidong_vip1 192.168.10.13
extended-stats
port 8080 http
source-nat pool gslb-snat
use-rcv-hop-for-resp
template http host
1、host-switching用於一個IP地址和端口同時提供多個域名應用當客戶訪問此地址與端口時通過HTTP協議包頭中的host信息來區分不同的服務。
2、在提供服務的VIP下應用該模板。
關於A10設備對內網做DNS Server
slb server 114.114.114.114 114.114.114.114
port 53 udp
!
slb service-group dns udp
member 114.114.114.114:53
slb virtual-server gslb 192.168.10.100
extended-stats
port 53 udp
gslb-enable
source-natpool snat
service-group dns
use-rcv-hop-for-resp
以上命令爲將A10設備當做內部DNS服務器內部主機首先查詢A10設備DNS解析結果如A10上無相關解析記錄則將請求轉發到公網DNS服務器上。
驗證操作
WEB卡卡頁面測試解析是否正確
dig工具
nslookup定向DNS Server測試域名解析
httpwatch查看整個頁面的解析時間和返回狀態