
Security News
Socket Security Analysis Is Now One Click Away on npm
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.
internal-ip
Advanced tools
Get your internal IP address
npm install internal-ip
import {internalIpV6, internalIpV4} from 'internal-ip';
console.log(await internalIpV6());
//=> 'fe80::1'
console.log(await internalIpV4());
//=> '10.0.0.79'
The async functions use a UDP connection to determine the address of the internet-facing interface (no packets are sent). When that fails (for example, when offline), it falls back to scanning os.networkInterfaces(). The sync functions always use os.networkInterfaces(). If multiple non-internal interfaces are present and the internet-facing interface cannot be determined, undefined will be returned to avoid selecting the wrong interface.
internalIpV6Sync() and internalIpV4Sync() are not supported in browsers and just return undefined.
Returns the internal IPv6 address asynchronously.
Returns the internal IPv4 address asynchronously.
Returns the internal IPv6 address synchronously.
Returns the internal IPv4 address synchronously.
The 'ip' package provides utilities for handling IP addresses, including methods to retrieve the local IP address. It offers broader functionality for IP address manipulation but does not focus exclusively on internal IP addresses like internal-ip does.
While 'internal-ip' focuses on retrieving internal IP addresses, 'public-ip' is designed to fetch the public IP address of the system. It's useful for applications that need to know how they are perceived externally on the internet. The difference in focus (internal vs. public IP) is the main distinction between these two packages.
FAQs
Get your internal IP address
The npm package internal-ip receives a total of 2,362,658 weekly downloads. As such, internal-ip popularity was classified as popular.
We found that internal-ip demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.

Security News
A compromised npm publish token was used to push a malicious postinstall script in cline@2.3.0, affecting the popular AI coding agent CLI with 90k weekly downloads.

Product
Socket is now scanning AI agent skills across multiple languages and ecosystems, detecting malicious behavior before developers install, starting with skills.sh's 60,000+ skills.