Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find your private IP address on DigitalOcean?

i was doing the tutorial on how to set up a node.js application in my virtual server, the problem is , i cannot get my private ip address.

Is it the configuration problem or my droplet in digital ocean is the problem?

So far, i am using ssh to connect, install fail2ban and configure the iptable.

curl -w "\n" http://myipAddress/metadata/v1/interfaces/private/0/ipv4/address
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.4.6 (Ubuntu)</center>
</body>
</html>

That's the configuration that i did while doing the tutorial: how to set up an ubuntu environment and using fail2ban, iptable for firewall purpose

-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-N fail2ban-ssh
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m multiport --dports 22 -j fail2ban-ssh
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -j DROP
-A fail2ban-ssh -s 29.248.168.45/32 -j REJECT --reject-with icmp-port-unreachable
-A fail2ban-ssh -j RETURN
like image 963
Andy Ho Avatar asked Feb 09 '23 01:02

Andy Ho


1 Answers

It looks like you are trying to use the DigitalOcean metadata API to find your private IP address. To reach it, you need to query the metadata service's IP, not your public IP. So the correct command is:

curl -w "\n" http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address

The private interface is designated as eth1, so you can also find its IP address with:

ifconfig eth1

It's also available in the DigitalOcean control panel on your Droplet's settings page:

IP-adder

like image 197
andrewsomething Avatar answered Feb 11 '23 16:02

andrewsomething