欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

在 Openstack 上修改虚拟机 IP 地址

最编程 2024-07-02 20:31:46
...

1、背景

虚拟机崩溃无法恢复时,部分业务系统需要使用原有IP才能恢复,故整理如下修改IP的方法。(操作期间服务器关机)

2、查找你要修改ip地址(172.16.0.2)的网卡id,本文修改ip地址为172.16.0.1的网卡

. admin-openrc
neutron port-list | grep 172.16.0.2

3、允许IP地址为172.16.0.1通过

neutron port-update d256fda2-5dee-4e05-8c0e-ef1a89390686 --allowed-address-pairs type=dict list=true ip_address=172.16.0.1

4、进入mysql数据库,修改数据

use neutron;
select * from ipallocations where port_id=' d256fda2-5dee-4e05-8c0e-ef1a89390686 '; 该port_id是之前查找的网卡id
update ipallocations set ip_address='172.16.0.1' where port_id='d256fda2-5dee-4e05-8c0e-ef1a89390686';

5、注意操作期间虚拟机关机/操作后启动虚拟机;也可以尝试分离网络端口

推荐阅读