Community discussions

MikroTik App
 
CGirardy
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 78
Joined: Tue Sep 25, 2007 1:09 pm
Location: Grasse / Alpes-Maritimes / France

How can I quickly change device name ....

Tue Sep 15, 2009 12:06 am

... to make them match the DNS Names ?
I have a lot of devices that are not correctly named. I would like to make them match their DNS resolution name...
Is it possible ?
Thanks
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: How can I quickly change device name ....

Tue Sep 15, 2009 1:26 am

There's several ways you could automate this out.

The fastest way would probably be to use the API to log into each device, and set the host name.

If you're not comfortable around the API, but can create one config file per device named after, for example, the only IP address on an interface named 'outside', you could paste something like this:
:local server [:resolve "your.webserver.com"]; :local url ([:pick [/ip address get [/ip address find interface=outside] address] 0 [:find [/ip address get [/ip address find interface=outside] address] "/"]] . ".txt"); :local fileName "hostnamescript"; /tool fetch mode=http address=$server src-path=$url dst-path=$fileName; /import hostnamescript; /file remove hostnamescript
into each device. On a router with 1.1.1.1/24 on interface 'outside', that would attempt to download http://your.webserver.com/1.1.1.1.txt to "hostnamescript", execute that file and delete it.

1.1.1.1.txt would then be a script file along the lines of
/system identity set "whatever"
Again, the API would be faster and more resilient to errors.
 
keith
Frequent Visitor
Frequent Visitor
Posts: 52
Joined: Thu May 24, 2007 12:30 am

Re: How can I quickly change device name ....

Wed Sep 16, 2009 2:36 am

Are you talking about the displayed name in your maps or the computer's host name? If you are just talking about the display name on the map in the device discovery settings select device name preference to be DNS, SNMP, NETBIOS, IP. You may have to delete and rediscover your devices but they would show the dns names. That is the way i have mine setup
 
CGirardy
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 78
Joined: Tue Sep 25, 2007 1:09 pm
Location: Grasse / Alpes-Maritimes / France

Re: How can I quickly change device name ....

Wed Sep 16, 2009 8:52 am

Thanks fewi.
That's what I was looking for.

keith : no, not only the display (I'm already displaying DNS names).. I'm talking about all the objects names

Who is online

Users browsing this forum: No registered users and 9 guests