Report this

What is the reason for this report?

How to know private ip range?

Posted on July 25, 2019

Hey,

Let me compare this with AWS so that I can be clearer.

In AWS I have a VPC with cidr block of 10.10.0.0/16. So I can be sure all my machines will end up with an IP within this range.

I have a service that I want to bind to an IP address which can be reached from within the private network, how can I know it’s range?

If I can’t know exactly, at least can I be sure it will start with 10. or is it possible to start with 172.?

Thanks a lot!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello @jserpa,

Actually, there is no direct way to get the range of Private IP addresses. In general, at present, we are using the 10.x range.

However, you can use the private IP address and netmask details from the metadata to get the range. You can follow any of the below methods to get the same:

  1. On the DigitalOcean Cloud Control panel go to the Droplets page, click the name of the Droplet, then select Networking from the side navigation and you can check the private IP address and netmask from there.

  2. Use the commands below in the Droplet::

Command to get the private IPv4 address of the specified network interface
  1. curl http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address
Command to get the netmask of the specified network interface
  1. curl http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/netmask

For more detail have a look into the link::

https://developers.digitalocean.com/documentation/metadata/#interface-ipv4-index https://www.ultratools.com/tools/netMask

Hope this helps! Let me know if you have any other questions.

Many OpenVPN subnets use 10.8.x.x range. It’s straight from DigitalOcean’s OpenVPN Setup tutorial, so please don’t introduce this IP range to private networking, as it would get conflicted with assigned VPN client IPs.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.