Community discussions

MikroTik App
 
drevil23
just joined
Topic Author
Posts: 16
Joined: Thu Jun 08, 2017 10:01 pm

Command "resolve" don't return the ip address

Fri Mar 19, 2021 10:09 pm

Hi,

I've upgraded from a rb3011, v.6.48.1, to a rb4011, also 6.48.1, but one of my script is not working anymore.

It used the command "resolve" to get an IP address, but resolve now return "blank" answer instead of an IP address, it only returns a result when the domain name is bogus.
[user@router] > :resolve yahoo.com
[user@router] > :resolve google.com
[user@router] > :resolve www.cnn.com
[user@router] > :resolve ketchup.com
[user@router] > :resolve anythingatall.ca
failure: dns name does not exist
[user@router] >
Any idea on how to fix that?

Thank you.
 
User avatar
eworm
Forum Guru
Forum Guru
Posts: 1092
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: Command "resolve" don't return the ip address  [SOLVED]

Fri Mar 19, 2021 10:12 pm

Has always been like that. You need to use the return value.
:put [ :resolve yahoo.com ]
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3349
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Command "resolve" don't return the ip address

Fri Mar 19, 2021 10:15 pm

This is due to that most of the commands does not give output directly to cli.

Try
:put [:resolve yahoo.com]
Or like this:
{
:local test [:resolve yahoo.com]
:put $test
}
 
drevil23
just joined
Topic Author
Posts: 16
Joined: Thu Jun 08, 2017 10:01 pm

Re: Command "resolve" don't return the ip address

Fri Mar 19, 2021 10:30 pm

Thanks, I thought I found out the reason of the script not working, but it wasn't that, you're totally right.

I found out why it didn't work thanks to you guys, a problem with a bad character inside a variable declaration of the web page.

Turns out that using a "$" inside a web page address is a bad thing if you don't put "\" in front.

Thanks guys, you've helped a lot :D