简体   繁体   English

如何从子域外部访问OpenStack VM实例的实例?

[英]How to access the instance of OpenStack VM instance from outside the subnent?

I have setup a cloud test bed using OpenStack. 我已经使用OpenStack设置了云测试平台。 I used the 3 node architecture. 我使用了3节点架构。 The IP assigned to each node is as given below 分配给每个节点的IP如下所示

Compute Node : 192.168.9.19/24 Network Node : 192.168.9.10/24 Controller Node : 192.168.9.2/24 计算节点: 192.168.9.19/24网络节点: 192.168.9.10/24控制器节点: 192.168.9.2/24

The link of instance created is like this : 创建的实例的链接是这样的:

http://controller:6080/vnc_auto.html?token=2af0b9d8-0f83-42b9-ba64-e784227c119b&title=hadoop14%28f53c0d89-9f08-4900-8f95-abfbcfae8165%29 http:// controller:6080 / vnc_auto.html?token = 2af0b9d8-0f83-42b9-ba64-e784227c119b&title = hadoop14%28f53c0d89-9f08-4900-8f95-abfbcfae8165%29

At first this instance was accessible only when I substitutes controller:8090 with 192.168.9.2:8090 . 最初,只有当我将controller:8090替换为192.168.9.2:8090时,此实例才可访问。 I solved this by setting a local DNS server and resolving 192.168.9.2 to controller.local . 我通过设置本地DNS服务器并将192.168.9.2解析为controller.local来解决此问题。 Now instead of substituting the IP it works when I substitute controller.local . 现在,当我替换controller.local时,它可以代替IP起作用。

Is there any other way to do it?? 还有其他方法吗? Also how can I access this instance from another subnet other than 192.168.9.0/24, without specifying the IP. 另外,如何在不指定IP的情况下从192.168.9.0/24以外的另一个子网访问此实例。

If I understood your question correctly, yes there is another way, you don't need to set up a DNS server! 如果我正确理解了您的问题,是的,还有另一种方法,您无需设置DNS服务器!

On the machine that you would like to access the link, perform the operations below: 在您要访问链接的机器上,执行以下操作:

  1. Open /etc/hosts file with a text editor. 使用文本编辑器打开/ etc / hosts文件。
  2. Add this entry: 192.168.9.2 controller 添加此条目: 192.168.9.2 controller
  3. Save the file, and that's it. 保存文件,仅此而已。

I suggest you to do these on all your nodes so that you can use these hostnames on your OpenStack configuration files instead of their IPs. 我建议您在所有节点上执行这些操作,以便可以在OpenStack配置文件中使用这些主机名而不是其IP。 This would also save you from tons of modifications if you have to make a change on the subnet IPs. 如果必须在子网IP上进行更改,这也可以避免大量的修改。

So for example your /etc/hosts files on your nodes should look like these: 因此,例如,节点上的/ etc / hosts文件应如下所示:

#controller
192.168.9.2     controller

#network
192.168.9.10    network

#compute
192.168.9.19    compute

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM