Forum Discussion
How to perform a dig command using iControl?
Im trying to figure out any information on using dig commands or its closest equivalent using iControl?
- Satoshi_Toyosa1Ret. Employee
Do you want to execute dig on the target BIG-IP remotely to (perhaps) test the DNS resolver on the box? If so, executing ping via POST /mgmt/tm/util/ping would do. Pinging to a remote device with its domain name would resolve its IP address. For example, ping'ing to www.google.com from my test BiG-IP;
curl -sku admin:admin https://<BIGIP>/mgmt/tm/util/ping \ -X POST -H "Content-Type: application/json" \ -d '{"command":"run", "utilCmdArgs": "-c 3 www.google.com"} ' | \ jq -r .commandResult PING www.google.com (172.217.14.228) 56(84) bytes of data. 64 bytes from 172.217.14.228 (172.217.14.228): icmp_seq=1 ttl=128 time=198 ms 64 bytes from 172.217.14.228 (172.217.14.228): icmp_seq=2 ttl=128 time=198 ms 64 bytes from 172.217.14.228 (172.217.14.228): icmp_seq=3 ttl=128 time=199 ms --- www.google.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 1999ms rtt min/avg/max/mdev = 198.649/198.974/199.350/0.288 ms
- Satoshi_Toyosa1Ret. Employee
P.S. Do not forget the "-c 3" ping command option. Otherwise, the ping runs forever, which results in REST call timeout. See man ping.
- Satoshi_Toyosa1Ret. Employee
Ah, we do have /mgmt/tm/util/dig endpoint.
curl -sku admin:admin https://$HOST/mgmt/tm/util/dig \ -X POST -H "Content-type: application/json" \ -d '{"command":"run", "utilCmdArgs":"www.google.com"}' | \ jq -r .commandResult ; <<>> DiG 9.11.8 <<>> www.google.com ;; global options: +cmd ;; Got answer: ... ;; ANSWER SECTION: www.google.com. 93 IN A 216.58.193.68 ...
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com