How to determine the user IP address using node.js ? Last Updated : 05 Feb, 2021 Comments Improve Suggest changes Like Article Like Report Node.js is an open-source, back-end JavaScript runtime environment that runs on the web engine and executes JavaScript code. There are various platforms such as Windows, Linux, Mac OS  where Node.js can run. The Domain Name System is a hierarchical and decentralized naming system for computers etc that are connected to the Internet. To find the IP address of the user in Node.js we use dns.lookup() method of dns module. dns.lookup() function: dns.lookup(hostname[, options], callback) Parameters: Hostname: It consists website link which is valid or active.Option: Default value is 0. It can be 0, 4 or 6 which indicates IPv4 and IPv6 addresses.Callback: This function has user's IP address and family(i.e. IPv4 and IPv6) and error. Approach to determine IP address: Import dns module in the node.js file.Use dns.lookup() function to search for addresses and family of the client.Display address and family. Implementation: index.js // Import file const dns = require('dns'); // dns.lookup() function searches // for user IP address and family // if there is no error dns.lookup('www.geeksforgeeks.org', (err, addresses, family) => { // Print the address found of user console.log('addresses:', addresses); // Print the family found of user console.log('family:', family); }); Run  index.js file using the below command: node client_ip.js Output: Reference: https://nodejs.org/api/dns.html#dns_dns_lookup_hostname_options_callback Comment More infoAdvertise with us Next Article How to determine the user IP address using node.js ? C chetanjha888 Follow Improve Article Tags : Technical Scripter Web Technologies Node.js Technical Scripter 2020 Similar Reads How to get client IP address using JavaScript? Knowing a client's IP address can be useful for various purposes like personalizing content, tracking user activity, or offering location-based services. However, JavaScript running in the browser doesnât have direct access to this information due to security reasons. Using External APIs to Get the 3 min read How to check user authentication in GET method using Node.js ? There are so many authentication methods like web token authentication, cookies based authentication, and many more. In this article, we will discuss one of the simplest authentication methods using express.js during handling clients get a request in node.js with the help of the HTTP headers. Appro 3 min read Java Program to Determine Hostname from IP Address IP Address stands for internet protocol address. It is an identifying number that is associated with a specific computer or computer network. IP addresses are usually written and displayed in human-readable notation such as 192.168.1.35 in IPv4(32-bit IP address). When connected to the internet, the 3 min read How to Find Your IP Address? Finding your IP address is a simple but also an important task for anyone using the internet. Whether youâre troubleshooting network issues, setting up a new device, or securing your online activity, knowing your IP address is a key step.In this article, weâll show you how to find your IP address on 6 min read How Do I Get User IP Address in Django? In web development, knowing a user's IP address can be crucial for a variety of reasons, such as logging, analytics, security, and customization. Django, a powerful web framework for Python, provides several ways to access user IP addresses. In this article, we'll walk through creating a small Djang 2 min read Like