第一步:配置两台A10设备的IP地址,先将网络调通


下面是以旁路部署的方式进行展现,直连和旁路部署在配置上的唯一区别就是在把VLAN绑定到物理口的时候,旁路要打tag vlan标记而直连是untag.

1.       在两台设备上均配置同样的VLAN


 


  
vlan 3                   //创建VLAN 3用于内部互联
 tagged ethernet 1        //把VLAN3绑定到ethernet 1并在报文出去时带上VLAN标记,这个相当于普通交换机上的trunk口
 router-interface ve 3      //绑定到虚接口
 name "inside"           //这个仅仅是描述
!
vlan 9
 untagged ethernet 5      //专门的口用来做HA,不打VLAN标记
 router-interface ve 9
 name "ha-interface"
!
vlan 10
 tagged ethernet 1
 router-interface ve 10
 name "outside"

2.       配置IP地址,两台LB的地址要在同一网段,结合上联交换机的配置,配完下面的配置后网络已经调通




Loadbalance-1:



interface ve 3
 ip address 192.168.3.1 255.255.255.0
 ip nat inside     //这个可以先不配,在后面NAT的相关配置中需要指定这个接口为内部口
!
interface ve 9
 ip address 192.168.9.1 255.255.255.252
!
interface ve 10
 ip address 10.10.10.244 255.255.255.248
 ip nat outside    //这个可以先不配,在后面NAT的相关配置中需要指定这个接口为外部口


 

Loadbalance-2:


interface ve 3
 ip address 192.168.3.2 255.255.255.0
 ip nat inside
!
interface ve 9
 ip address 192.168.9.2 255.255.255.252
!
interface ve 10
 ip address 10.10.10.245 255.255.255.248
 ip nat outside

 

第二步:开始配置HA,配置完HA之后两台LB就可以做配置同步了




Loadbalance-1:



 


ha id 1 set-id 1     // ha id用来区别两台做HA设备的标识,值为1-2,set-id用来区别这一对负载均衡设备与其他组的区别,这个值是1-8也就是在同一个广播域中只能挂8对A10的设备,这个非常重要,如果在同一广播域中这组设备的ID与其他组一样的话,就会..后果自负。
ha group 1 priority 110   //指定group 1的优先级,可指定多个组,不过没必要
ha interface ethernet 1 router-interface vlan 10  //指定发送HA报文的端口
ha interface ethernet 5               //指定发送HA报文的端口,这里指定了两个做冗余
ha conn-mirror ip 192.168.9.2         //session同步的地址,这个地址为邻居的接口地址
ha preemption-enable              //抢占模式,只要设备的优先级高就马上成为主设备
floating-ip 10.10.10.246 ha-group 1   //外部接口的浮动IP地址
floating-ip 192.168.3.3 ha-group 1    //内部接口的浮动IP地址

Loadbalance-2:


 

 
  
ha id 2 set-id 1
ha group 1 priority 100
ha interface ethernet 1 router-interface vlan 10
ha interface ethernet 5 
ha conn-mirror ip 192.168.9.1
ha preemption-enable
floating-ip 10.10.10.246 ha-group 1
floating-ip 192.168.3.3 ha-group 1

三.配置静态路由



 

ip route 0.0.0.0 /0 10.10.10.243 cpu-process     //到公网的路由
ip route 192.168.0.0 /16 192.168.3.247 cpu-process    //到内部地址的路由

四.NAT配置,用于内部服务器主动访问外面时源地址转化成公网地址




access-list 120 permit ip 192.168.0.0 0.0.0.255 any        //指定要做NAT的源地址
ip nat pool nat-pool 10.10.9.100 10.10.9.101 netmask /24  ha-group-id 1 //指定公网地址池
ip nat inside source list 120 pool nat-pool

 

五.配置VIP,负载均衡设备主要就是用来干这个的




1配置7层健康检查方式



health monitor status.taobao interval 3
 method http url GET /status.html expect response-code 200

2配置realserver



slb server test1 192.168.11.1
   port 80  tcp
slb server test2 192.168.11.2
   port 80  tcp

health-check status.html    //做7层健康检查,模拟客户端去取URL,现在网站的前端架构基本上是apache+jboss,如果没有7层健康检查的话,在JBOSS服务异常或僵死的情况下,服务已经不可用了,但是负载均衡由于只检查apache的80端口,所以apache认为这个服务器是正常的,将请求报文仍旧发往这台realserver,造成访问出错。Status.html这个文件在JBOSS的默认目录下面

3配置service,把多台realserver绑定到service上面去



slb service-group test tcp
    member test1:80
    member test2:80

   

4配置VIP,把service绑定到外部地址上去




slb virtual-server www.test.vip 10.10.9.1
   ha-group 1
   port 80  tcp        //对外的端口是80,也可以写其他,不过WWW服务还是写80吧
      service-group test    //绑定service组
      syn-cookie          //对这个VIP起syn-cookie,说简单点就是起代理,代理服务器来做TCP的三次握手,用来防御SYN FLOOD等***,非常有用的参数
      ha-conn-mirror       //session做同步


六.其他配置




1配置SNMP



snmp-server community read public remote 192.168.11.244

2指定登陆方式



 
  
enable-management service ssh ethernet 1 ve 3 ve 10
enable-management service telnet ethernet 1 ethernet 5 ve 3 ve 9 to 10

3.Tacacs的认证方式



 

 
  
authorization commands 15 method tacplus 
accounting exec start-stop tacplus
accounting commands 15 stop-only tacplus
tacacs-server host 192.168.11.241secret ttt port 49 timeout 12
tacacs-server host 192.168.11.242 secret ttt port 49 timeout 12
authentication type local tacplus

七.A10其他非常见的配置




1分配相关内存资源,A10是预分配的,下面命令要生效的话需要重启设备



 
system resource-usage l4-session-count 4000000
system resource-usage real-server-count 2048 
system resource-usage real-port-count 4096


 

show system resource-usage可用于查看分配的内存资源使用情况





2.指定可用于对外提供服务的端口范围,A10默认提供1024以内的端口作为对外VIP的端口,有些服务可能要用到特殊的端口,必须要通过以下命令来修改,下面命令允许8000-8888的端口可用于对外提供服务,下面命令要生效的话需要重启设备



 

slb auto-translate-port range 2 range-start 8000 range-end 8888

八.A10常用查看命令



 
1. show ip nat translations    //查看rnat的session
2.  show session           //查看整个session表
3. show cpu             //查看CPU的利用率,CPU0为主控CPU
4. A10内置抓包命令
#config terminal
(config)#axdebug
(config-axdebug)#filter 1   //设置抓包规则
show axdebug filter 1      //查看设置的规则
(config-axdebug)#capture save file1 1000  //开始抓包,将抓到的报文放到本地的file1文件上
(config)#copy file1 ?     //将本地文件COPY到其他地方    
  WORD<length:1-31>  Local Configuration Profile Name 
  use-mgmt-port      Use management port as source port
  tftp:              Remote file path of tftp: file system(Format: tftp://host/file)
  ftp:               Remote file path of ftp: file system(Format: ftp://[user@]host[:port]/file)
  scp:               Remote file path of scp: file system(Format: scp://[user@]host/file)
  rcp:               Remote file path of rcp: file system(Format: rcp://[user@]host/file)


转载于:https://blog.51cto.com/xiaochong/418604