Automation

last person joined: yesterday 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  slax script to resolve IP addresses into host-name

     
    Posted 02-11-2011 00:16

    Hello,

     

    I wrote a slax script which print on screen the path used by a multicast flow. So the output is a list of ip-addresses (the traversed hops): 10.0.1.1 10.0.1.40. I would like the script to resolve this IP addresses into host-name, using the DNS server, in order to print on screen the host-name associated with the IP addresses...

     

    Does anyone have any suggestions on how to implement that in a slax script? I guess another solution is to use a static list containing the IP<-->host-name mapping, stored locally on the router (maybe defining an xml variable into the script itself); I don't like this option though, cause it would be painful to mantain...

     

    I'd really appreciate your help,

    thanks in advance,

     

    Mattia



  • 2.  RE: slax script to resolve IP addresses into host-name
    Best Answer

     
    Posted 02-11-2011 01:57

    Hi,

     

    You can use the jcs:hostname() extension to resolve the ip address.

     

    Example,

     

            var $host = jcs:hostname("10.209.196.163");
            expr jcs:output($host);

    Thanks,

    Sriram



  • 3.  RE: slax script to resolve IP addresses into host-name

     
    Posted 02-16-2011 15:20

    Thank you very much Sriram!



  • 4.  RE: slax script to resolve IP addresses into host-name

    Posted 05-23-2012 08:47

    @Sriram wrote:

    Hi,

     

    You can use the jcs:hostname() extension to resolve the ip address.

     

    Example,

     

            var $host = jcs:hostname("10.209.196.163");
            expr jcs:output($host);

    Thanks,

    Sriram


     

    Does this work also for the reverse?  If I want to resolve a dns to the IP address?