# Reverse DNS Look Up

**URL:** https://discourse.nodered.org/t/reverse-dns-look-up/22807
**Category:** General
**Created:** [8 March 2020 18:22 UTC](https://discourse.nodered.org/t/reverse-dns-look-up/22807 "2020-03-08T18:22:30Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![nodecentral](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodecentral/32/10432_2.png) [@nodecentral](https://discourse.nodered.org/u/nodecentral)
#### Post date: [8 March 2020 18:22 UTC](https://discourse.nodered.org/t/reverse-dns-look-up/22807/1 "2020-03-08T18:22:31Z")

</div>

Hi

I’m trying to get the IP address of a domain name, so I can add the IP to my firewall but I can’t seem to get the dns node to work - [node-red-contrib-dns (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-dns)

Is anyone using this successfully for reverse look ups ?

I’m simple trying to send the domain name (e.g [www.google.com](http://www.google.com)) via an inject node to the dns node (set to Reverse) to see if it can return the IP address via debug node ?

I’ve tried variations of the domain name, http:/www.google.com, [www.google.com](http://www.google.com), [google.com](http://google.com) - it all I seem to get in return is this error, and nothing reaches the debug node

> 08/03/2020, 18:21:12  
> msg : error  
> "Error: getHostByAddr EINVAL"

---

<div class="post-metadata">

### Author: ![techraf](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/techraf/32/17389_2.png) [@techraf](https://discourse.nodered.org/u/techraf)
#### Post date: [8 March 2020 19:20 UTC](https://discourse.nodered.org/t/reverse-dns-look-up/22807/2 "2020-03-08T19:20:55Z")

</div>

> [@nodecentral](#):
>
> I’m simple trying to send the domain name (e.g [www.google.com](http://www.google.com)) via an inject node to the dns node (set to Reverse)

That makes no sense, so you get the error.

`www.google.com` is not an [`.in-addr.arpa`](https://en.wikipedia.org/wiki/Reverse_DNS_lookup#IPv4_reverse_resolution) address.

Either you should do a simple lookup, or rethink what you want to achieve.

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [8 March 2020 20:00 UTC](https://discourse.nodered.org/t/reverse-dns-look-up/22807/3 "2020-03-08T20:00:25Z")

</div>

> [@techraf](#):
>
> Either you should do a simple lookup, or rethink what you want to achieve.

Exactly this.

domain -\> exec node: nslookup -\> output. Or use `dig +short google.com` instead.

```auto
[{"id":"aa5d9ffd.ef58b8","type":"inject","z":"a8be5bbf.2423a","name":"google.com","topic":"","payload":"google.com","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":286,"y":336,"wires":[["5c0eeb15.cedd2c"]]},{"id":"5c0eeb15.cedd2c","type":"exec","z":"a8be5bbf.2423a","command":"nslookup","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":442,"y":336,"wires":[["cb73c5b5.fca318"],[],[]]},{"id":"cb73c5b5.fca318","type":"debug","z":"a8be5bbf.2423a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":602,"y":336,"wires":[]}]

```

---

<div class="post-metadata">

### Author: ![techraf](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/techraf/32/17389_2.png) [@techraf](https://discourse.nodered.org/u/techraf)
#### Post date: [8 March 2020 20:19 UTC](https://discourse.nodered.org/t/reverse-dns-look-up/22807/4 "2020-03-08T20:19:36Z")

</div>

I'm not sure what you wanted to say in your reply.

@nodecentral needs to select "lookup" instead of "reverse" in the `dns` node.

---

<div class="post-metadata">

### Author: ![nodecentral](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodecentral/32/10432_2.png) [@nodecentral](https://discourse.nodered.org/u/nodecentral)
#### Post date: [9 March 2020 18:55 UTC](https://discourse.nodered.org/t/reverse-dns-look-up/22807/5 "2020-03-09T18:55:18Z")

</div>

Thanks all, the 'lookup' option worked a treat !

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [23 March 2020 18:55 UTC](https://discourse.nodered.org/t/reverse-dns-look-up/22807/6 "2020-03-23T18:55:19Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
