修改openstack云主机的IP地址

来源:互联网 发布:shellshock windows 编辑:程序博客网 时间:2024/06/05 11:12

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://zhanguo1110.blog.51cto.com/5750817/1543155

1)、查找虚拟机的网络端口

mysql> use neutron;

mysql> select * from ports where device_id=”3ab73261-82ce-4b9a-9a1c-519624e19dc2”;

+———————————-+————————————–+——+————————————–+——————-+—————-+——–+————————————–+————–+

| tenant_id | id | name | network_id | mac_address | admin_state_up | status | device_id | device_owner |

+———————————-+————————————–+——+————————————–+——————-+—————-+——–+————————————–+————–+

| 5855410282d54e0cac49f05b40282500 | eccd3444-bb81-4d3b-ae13-58040847da4a | | ed547aa7-af32-495a-8173-5a04be9c37c1 | fa:16:3e:a8:bd:e4 | 1 | DOWN | 3ab73261-82ce-4b9a-9a1c-519624e19dc2 | compute:nova |

+———————————-+————————————–+——+————————————–+——————-+—————-+——–+————————————–+————–+

1 row in set (0.01 sec)

mysql>

2)、查找虚拟机网络端口的IP地址

mysql> select * from ipallocations where port_id=”eccd3444-bb81-4d3b-ae13-58040847da4a”;

+————————————–+————–+————————————–+————————————–+

| port_id | ip_address | subnet_id | network_id |

+————————————–+————–+————————————–+————————————–+

| eccd3444-bb81-4d3b-ae13-58040847da4a | 10.40.211.28 | e6e73775-ddbc-461a-92ff-b13202c23540 | ed547aa7-af32-495a-8173-5a04be9c37c1 |

+————————————–+————–+————————————–+————————————–+

1 row in set (0.00 sec)

3)、修改虚拟机的端口的IP地址

mysql> update ipallocations set ip_address=”10.40.211.29” where port_id=”eccd3444-bb81-4d3b-ae13-58040847da4a”;

Query OK, 1 row affected (0.00 sec)

Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from ipallocations where port_id=”eccd3444-bb81-4d3b-ae13-58040847da4a”;

+————————————–+————–+————————————–+————————————–+

| port_id | ip_address | subnet_id | network_id |

+————————————–+————–+————————————–+————————————–+

| eccd3444-bb81-4d3b-ae13-58040847da4a | 10.40.211.29 | e6e73775-ddbc-461a-92ff-b13202c23540 | ed547aa7-af32-495a-8173-5a04be9c37c1 |

+————————————–+————–+————————————–+————————————–+

1 row in set (0.01 sec)

本文出自 “zhanguo1110” 博客,请务必保留此出处http://zhanguo1110.blog.51cto.com/5750817/1543155