avalanche 配置dns解析域名
性能测试中,有时候需要在Action中配置访问形式为域名的URL,进行测试,这时需要用到dns配置。
Action中带DNS命令
DNS A 192.168.1.1 www.spirentcom.com
# A 解析IPv4域名
# 192.168.1.1为dns服务器
# www.spirentcom.com 被解析域名
但这个命令是用于测试DNS服务器,并不能用于 1 get http://www.test.com/index.html
这类请求解析
官网搜索了一下 链接 ,找到3种配置 DNS 的方式,经测试可以使用。
这里分别进行解析。
(1) DNS Hosts file. This is a build-in file with highest priority, under GUI->Client->Profiles->DNS->“Use DNS Hosts File”
(2) Domain name resolved through management port. GUI->Administration->Appliances->Network Configuration->Network Configuration->Primary/Secondary DNS
(3) Domain name resolved through test port. GUI->Client->Port->Test DNS enable, add Primary/Secondary DNS server in the blank.
其中第 (2) 种,通过管理端配置 dns 解析,我的 avalanche 版本为 5.30 ,未找到相关配置。因文章时间较早,推测新版本已经弃用此功能,且这种配置流量应该不会计入正常业务流量,不具有实用性,此功能配置不表。
(1) DNS Hosts file. This is a build-in file with highest priority, under GUI->Client->Profiles->DNS->“Use DNS Hosts File”
(1) 这种配置,类似 windows 或者 linux 的 host 文件功能,将域名写入客户端的本地配置中,不请求服务器即可获得域名的真实 IP 。
配置方法如下
在 GUI->Client->Profiles->DNS->“Use DNS Hosts File” 新增 hostfiles 文件 , 在 hostfiles 中新增 host 和 IP ,即可使用。
试运行抓包,也会有 dns 请求。
(3) Domain name resolved through test port. GUI->Client->Port->Test DNS enable, add Primary/Secondary DNS server in the blank.
这个就是给客户端配置真实的 dns 地址,到真实的 dns 服务器进行请求。可以分别配置 ipv4 和 ipv6 的 dns
它可以到真实的 dns 服务器请求解析,可以内网自己搭建一个 dns 服务器,也可以使用 avalanche 自带 dns 服务,配置非常简单。
在 server 新建一个 Profile ,type 选择 dns,新建一个 zone , 点击 New Record
,配置需要的域名IP。
添加一个Association,引用Profile,需要v4的配置v4,需要v6配置v6。