Node.js 如何在DigitalOcean上查找您的私人IP地址?
我在做关于如何在虚拟服务器中设置node.js应用程序的教程,问题是,我无法获得我的私有ip地址 是配置问题还是我在数字海洋中的液滴问题 到目前为止,我正在使用ssh连接、安装fail2ban和配置iptableNode.js 如何在DigitalOcean上查找您的私人IP地址?,node.js,ubuntu,ubuntu-14.04,digital-ocean,Node.js,Ubuntu,Ubuntu 14.04,Digital Ocean,我在做关于如何在虚拟服务器中设置node.js应用程序的教程,问题是,我无法获得我的私有ip地址 是配置问题还是我在数字海洋中的液滴问题 到目前为止,我正在使用ssh连接、安装fail2ban和配置iptable curl -w "\n" http://myipAddress/metadata/v1/interfaces/private/0/ipv4/address <html> <head><title>404 Not Found</title>
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>
看起来您正试图使用查找您的专用IP地址。要访问它,您需要查询元数据服务的IP,而不是您的公共IP。因此,正确的命令是:
curl -w "\n" http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address
专用接口被指定为eth1
,因此您还可以通过以下方式找到其IP地址:
ifconfig eth1
也可在水滴设置页面的DigitalOcean控制面板中找到:
ifconfig eth1