/ping [:resolve ipv6.google.com]
maybe add feature for specific attribute only ipv6/ipv4as Boen_robot explained:
:resolve command will return ipv4 address (A record) if that exists, if not, then ipv6 address will be returned (AAAA record)
in some places you have to explicitly use :resolve to be able to use domain name resolution:will ping ipv6 address.Code: Select all/ping [:resolve ipv6.google.com]
I just ran into a similar issue. :resolve does NOT support some kinda of type= option. I wanted use :resolve for TXT record, and CLI tells me it take an options. But if they add a DNS record type option, like type=AAAA, it would solve the IPv6 issue as well as well as my TXT lookups.as Boen_robot explained:
:resolve command will return ipv4 address (A record) if that exists, if not, then ipv6 address will be returned (AAAA record)
maybe add feature for specific attribute only ipv6/ipv4
So +1 from me.
/ipv6 firewall address-list {
add list=google-dns address=dns.google.com
:delay 1
:foreach ip in=[find list=google-dns && dynamic] do={:put [get $ip address]}
}
2001:4860:4860::8844/128
2001:4860:4860::8888/128
# define global function to resolve IPv6 DNS Names to IPs
:global resolveipv6 do={
:local result [:toarray ""]
:local maxwait 5
:local cnt 0
:local listname "tmp-resolve$cnt"
/ipv6 firewall address-list {
:do {
:while ([:len [find list=$listname]] >0) do={
:set cnt ($cnt + 1)
:set listname "tmp-resolve$cnt"
}
:set cnt 0
add list=$listname address=$1
:while ([find list=$listname && dynamic] = "" && $cnt < $maxwait) do={:delay 1;:set cnt ($cnt +1)}
:foreach i in=[find list=$listname && dynamic] do={
:local rawip [get $i address]
:set result ($result, [:pick $rawip 0 [:find $rawip "/"]])
}
remove [find list=$listname && !dynamic]
}
}
:return $result
}
# use new global function (output to console)
:put [$resolveipv6 "dns.google.com"]
# use new global function (save to variable, returns an array)
:local myvar [$resolveipv6 "dns.google.com"]
You can use a firewall address list as a workaround for this.
# define global function to resolve IPv6 DNS Names to IPs
:global resolveipv6 do={
:local maxwait 5
:local search [:toarray ""]
:local result [:toarray ""]
/ipv6 firewall address-list
remove [find where list=tmp-resolve and address=$1]
add list=tmp-resolve address=$1
:local cnt 0
:do {
:delay 1s
:set cnt ($cnt +1)
:set search [find where list=tmp-resolve and dynamic=yes]
} while=(([:len $search] = 0) and ($cnt < $maxwait))
:foreach i in=$search do={
:local tmpadd [get $i address]
:set result ($result, [:pick $tmpadd 0 [:find $tmpadd "/"]])
}
remove [find where list=tmp-resolve and dynamic=no]
:return $result
}
# use new global function (output to console)
:put [$resolveipv6 "dns.google.com"]
# use new global function (save to variable, returns an array)
{
:local myvar [$resolveipv6 "dns.cloudflare.com"]
:put $myvar
}