运行命令大家可以发现现在创建的虚拟机只有一个私网地址,如需直接访问的话需要绑定一个公网地址(不一定必须是外网地址,只要能上网就可以)
[root@openstack ~]# nova-manage network list
id IPv4 IPv6 start address DNS1 DNS2 VlanID project uuid
1 10.1.1.0/24 None 10.1.1.2 8.8.4.4 None None None 6830245d-e0fa-440b-bfb6-f2fb28bd876e
创建浮动地址块
[root@openstack ~]# nova-manage floating create --ip_range=192.168.0.1/24
[root@openstack ~]# nova-manage floating list
None 192.168.0.1 None nova eth0
None 192.168.0.2 None nova eth0
None 192.168.0.3 None nova eth0
None 192.168.0.4 None nova eth0
None 192.168.0.5 None nova eth0
.
.
.创建浮动地址
[root@openstack ~]# nova floating-ip-create
+------------+-----------+----------+------+
| Ip | Server Id | Fixed Ip | Pool |
+------------+-----------+----------+------+
|192.168.0.1 | | - | nova |
+------------+-----------+----------+------+
将浮动IP绑定到实例
[root@openstack ~]# nova add-floating-ip 4f4e34b8-7ed5-45db-8c55-25fbed6b9184 192.168.0.100