Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

How to perform a dig command using iControl?

fubarSUSHI
Altocumulus
Altocumulus

Im trying to figure out any information on using dig commands or its closest equivalent using iControl?

3 REPLIES 3

Satoshi_Toyosa1
F5 Employee
F5 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_Toyosa1
F5 Employee
F5 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_Toyosa1
F5 Employee
F5 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
...