openstack修改增加网卡及更改ip
mysql> select * from ipallocations where port_id='ae22c84b-22a9-4618-b046-1eb61379bcea';
+--------------------------------------+---------------+--------------------------------------+--------------------------------------+
| port_id | ip_address | subnet_id | network_id |
+--------------------------------------+---------------+--------------------------------------+--------------------------------------+
| ae22c84b-22a9-4618-b046-1eb61379bcea | 172.20.59.132 | 3b040206-4adc-487e-9b9b-177b93374fdb | af6ef793-5430-4fa9-a2ea-6751d721e00b |
+--------------------------------------+---------------+--------------------------------------+--------------------------------------+
1 row in set (0.00 sec)
mysql> update ipallocations set ip_address='172.20.59.132' where port_id='ae22c84b-22a9-4618-b046-1eb61379bcea';
+--------------------------------------+--------+-------------------+--------------------------------------------------------------------------------------+
| id | name | mac_address | fixed_ips |
+--------------------------------------+--------+-------------------+--------------------------------------------------------------------------------------+
| 1cecaa46-8122-46e7-bd16-698e2fa43efe | | fa:16:3e:c3:fd:69 | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.131"} |
| 29b851cd-cdee-407d-a75a-d0bc7e3346d1 | | fa:16:3e:dc:e8:af | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.134"} |
| 61e30821-972a-4a83-a3ab-e53802d457ef | | fa:16:3e:53:ba:fc | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.133"} |
| 87462fba-ffce-4544-9bec-413c382baeda | | fa:16:3e:5b:0b:9a | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.135"} |
| a7aaaac1-0473-4c72-822f-2370d7d164b4 | port-1 | fa:16:3e:14:c4:49 | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.130"} |
| ae22c84b-22a9-4618-b046-1eb61379bcea | | fa:16:3e:17:91:f1 | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.132"} |
| f5ee728e-8017-454a-b347-0b299ad9494e | | fa:16:3e:a3:6d:8e | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.136"} |
+--------------------------------------+--------+-------------------+--------------------------------------------------------------------------------------+
bomc_cloud1:/root# nova list
+--------------------------------------+-------------+---------+------------+-------------+------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+-------------+---------+------------+-------------+------------------------+
| e13f0be6-aaa6-439d-be1d-08c964f2a4ee | bomc_vm08 | ACTIVE | - | Running | provider=172.20.59.134 |
| f902a752-6246-4722-94c6-4275f0f9f7ed | bomc_vm_003 | ACTIVE | - | Running | provider=172.20.59.130 |
| 28374779-a46d-4705-b47c-d80daaa1a5a4 | bomc_vm_004 | SHUTOFF | - | Shutdown | provider=172.20.59.136 |
| 9b42be9d-7572-4a2b-8d6d-80d30fbca0d6 | bomc_vm_005 | ACTIVE | - | Running | provider=172.20.59.135 |
| eb784193-1dfa-4b44-9dda-f8352fc7a573 | bomc_vm_006 | ACTIVE | - | Running | provider=172.20.59.131 |
| 4fee78ae-1d96-4168-9795-6630d46dcbf6 | bomc_vm_007 | ACTIVE | - | Running | provider=172.20.59.132 |
| 32dd588e-215a-4a9e-9f70-635f023bcfdb | bomc_vm_07 | ACTIVE | - | Running | provider=172.20.59.133 |
+--------------------------------------+-------------+---------+------------+-------------+------------------------+
2.2删除网卡
bomc_cloud1:/root# nova interface-detach 28374779-a46d-4705-b47c-d80daaa1a5a4 f5ee728e-8017-454a-b347-0b299ad9494e
bomc_cloud1:/root# nova list
+--------------------------------------+-------------+---------+------------+-------------+------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+-------------+---------+------------+-------------+------------------------+
| e13f0be6-aaa6-439d-be1d-08c964f2a4ee | bomc_vm08 | ACTIVE | - | Running | provider=172.20.59.134 |
| f902a752-6246-4722-94c6-4275f0f9f7ed | bomc_vm_003 | ACTIVE | - | Running | provider=172.20.59.130 |
| 28374779-a46d-4705-b47c-d80daaa1a5a4 | bomc_vm_004 | SHUTOFF | - | Shutdown | |
| 9b42be9d-7572-4a2b-8d6d-80d30fbca0d6 | bomc_vm_005 | ACTIVE | - | Running | provider=172.20.59.135 |
| eb784193-1dfa-4b44-9dda-f8352fc7a573 | bomc_vm_006 | ACTIVE | - | Running | provider=172.20.59.131 |
| 4fee78ae-1d96-4168-9795-6630d46dcbf6 | bomc_vm_007 | ACTIVE | - | Running | provider=172.20.59.132 |
| 32dd588e-215a-4a9e-9f70-635f023bcfdb | bomc_vm_07 | ACTIVE | - | Running | provider=172.20.59.133 |
+--------------------------------------+-------------+---------+------------+-------------+------------------------+
bomc_cloud1:/root# neutron port-list
+--------------------------------------+--------+-------------------+--------------------------------------------------------------------------------------+
| id | name | mac_address | fixed_ips |
+--------------------------------------+--------+-------------------+--------------------------------------------------------------------------------------+
| 1cecaa46-8122-46e7-bd16-698e2fa43efe | | fa:16:3e:c3:fd:69 | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.131"} |
| 29b851cd-cdee-407d-a75a-d0bc7e3346d1 | | fa:16:3e:dc:e8:af | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.134"} |
| 61e30821-972a-4a83-a3ab-e53802d457ef | | fa:16:3e:53:ba:fc | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.133"} |
| 87462fba-ffce-4544-9bec-413c382baeda | | fa:16:3e:5b:0b:9a | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.135"} |
| a7aaaac1-0473-4c72-822f-2370d7d164b4 | port-1 | fa:16:3e:14:c4:49 | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.130"} |
| ae22c84b-22a9-4618-b046-1eb61379bcea | | fa:16:3e:17:91:f1 | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.132"} |
+--------------------------------------+--------+-------------------+--------------------------------------------------------------------------------------+
2.3创建添加网卡
bomc_cloud1:/root# neutron port-create --name port-1 --fixed-ip subnet_id=3b040206-4adc-487e-9b9b-177b93374fdb,ip_address=172.20.59.136 --security-group c719f256-f3b8-4cfd-a8f2-1d9844de1161 af6ef793-5430-4fa9-a2ea-6751d721e00b
Created a new port:
+-----------------------+--------------------------------------------------------------------------------------+
| Field | Value |
+-----------------------+--------------------------------------------------------------------------------------+
| admin_state_up | True |
| allowed_address_pairs | |
| binding:host_id | |
| binding:profile | {} |
| binding:vif_details | {} |
| binding:vif_type | unbound |
| binding:vnic_type | normal |
| created_at | 2018-06-05T06:50:16 |
| description | |
| device_id | |
| device_owner | |
| extra_dhcp_opts | |
| fixed_ips | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.136"} |
| id | 6bd80a8e-bb26-4121-8d97-4d6c365a4a8d |
| mac_address | fa:16:3e:67:e4:b4 |
| name | port-1 |
| network_id | af6ef793-5430-4fa9-a2ea-6751d721e00b |
| port_security_enabled | True |
| security_groups | c719f256-f3b8-4cfd-a8f2-1d9844de1161 |
| status | DOWN |
| tenant_id | 3d89dd945e764bf19a3560bced6a4fbc |
| updated_at | 2018-06-05T06:50:16 |
+-----------------------+--------------------------------------------------------------------------------------+
bomc_cloud1:/root# nova interface-attach --port-id ^Cf902a752-6246-4722-94c6-4275f0f9f7ed
bomc_cloud1:/root# neutron port-list
+--------------------------------------+--------+-------------------+--------------------------------------------------------------------------------------+
| id | name | mac_address | fixed_ips |
+--------------------------------------+--------+-------------------+--------------------------------------------------------------------------------------+
| 1cecaa46-8122-46e7-bd16-698e2fa43efe | | fa:16:3e:c3:fd:69 | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.131"} |
| 29b851cd-cdee-407d-a75a-d0bc7e3346d1 | | fa:16:3e:dc:e8:af | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.134"} |
| 61e30821-972a-4a83-a3ab-e53802d457ef | | fa:16:3e:53:ba:fc | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.133"} |
| 6bd80a8e-bb26-4121-8d97-4d6c365a4a8d | port-1 | fa:16:3e:67:e4:b4 | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.136"} |
| 757a743a-265f-43a4-82fd-23a84e30a637 | | fa:16:3e:a4:7f:02 | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.148"} |
| 87462fba-ffce-4544-9bec-413c382baeda | | fa:16:3e:5b:0b:9a | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.135"} |
| a7aaaac1-0473-4c72-822f-2370d7d164b4 | port-1 | fa:16:3e:14:c4:49 | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.130"} |
| ae22c84b-22a9-4618-b046-1eb61379bcea | | fa:16:3e:17:91:f1 | {"subnet_id": "3b040206-4adc-487e-9b9b-177b93374fdb", "ip_address": "172.20.59.132"} |
+--------------------------------------+--------+-------------------+--------------------------------------------------------------------------------------+
2.4网卡与虚拟主机绑定
bomc_cloud1:/root# nova interface-attach --port-id 6bd80a8e-bb26-4121-8d97-4d6c365a4a8d 28374779-a46d-4705-b47c-d80daaa1a5a4
bomc_cloud1:/root# nova list
+--------------------------------------+-------------+---------+------------+-------------+------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+-------------+---------+------------+-------------+------------------------+
| e13f0be6-aaa6-439d-be1d-08c964f2a4ee | bomc_vm08 | ACTIVE | - | Running | provider=172.20.59.134 |
| f902a752-6246-4722-94c6-4275f0f9f7ed | bomc_vm_003 | ACTIVE | - | Running | provider=172.20.59.130 |
| 28374779-a46d-4705-b47c-d80daaa1a5a4 | bomc_vm_004 | SHUTOFF | - | Shutdown | provider=172.20.59.136 |
| 9b42be9d-7572-4a2b-8d6d-80d30fbca0d6 | bomc_vm_005 | ACTIVE | - | Running | provider=172.20.59.135 |
| eb784193-1dfa-4b44-9dda-f8352fc7a573 | bomc_vm_006 | ACTIVE | - | Running | provider=172.20.59.131 |
| 4fee78ae-1d96-4168-9795-6630d46dcbf6 | bomc_vm_007 | ACTIVE | - | Running | provider=172.20.59.132 |
| 32dd588e-215a-4a9e-9f70-635f023bcfdb | bomc_vm_07 | ACTIVE | - | Running | provider=172.20.59.133 |
+--------------------------------------+-------------+---------+------------+-------------+------------------------+
备注:nova interface-attach 和nova interface-delach 添加删除网卡操作可用于为虚拟机添加多网卡!
openstack修改增加网卡及更改ip的更多相关文章
- 068_不登陆虚拟机,修改虚拟机网卡 IP 地址
#!/bin/bash #该脚本使用 guestmount 工具,Centos7.2 中安装 libguestfs-tools-c 可以获得 guestmount 工具#脚本在不登陆虚拟机的情况下,修 ...
- Linux不进入网卡配置文件更改静态ip
1.找到网卡配置文件名ls /etc/sysconfig/network-scripts/ 2.备份并查看原始配置文件(若原先有配置IP的,则按照第五点方式修改) 3.修改随机自启和IP地址echo ...
- 批处理快速更改ip地址
在各种网络中切换,windows更换ip地址步骤: 进入控制面板--网络和internet--网络和共享中心--理性适配器设置--然后找到网卡--进入属性--然后internet 协议--更改ip信 ...
- centos 修改DNS,网关,IP地址
1.CentOS 修改DNS 修改对应网卡的DNS的配置文件 # vi /etc/resolv.conf 修改以下内容 nameserver 8.8.8.8 #google域名服务器 nameser ...
- 怎么修改路由器地址的默认IP
参考文章:http://jingyan.baidu.com/article/4b52d7026e14effc5c774b30.html 一.怎么修改路由器地址的默认IP 目前绝大多数品牌有线或无线路 ...
- Ambari集群移动现有复制到另外地方或更改ip地址,导致各项服务组件上为黄色问号代表心跳丢失的解决方案(图文详解)(博主推荐)
前言 最近,是在做集群搬移工作,大家肯定会遇到如下的场景. (1) 比如,你新购买的电脑,初步者学习使用Ambari集群.从旧电脑复制到新电脑这边来. (2) 比如,你公司Ambari集群的ip,因业 ...
- kvm 给虚机增加网卡
[root@666 ok]# virsh domiflist c03 Interface Type Source Model MAC --------------------------------- ...
- OpenStack 虚机网卡的创建过程
原文链接:https://www.cnblogs.com/potato-chip/p/9127083.html OpenStack虚机网卡的创建过程 OpenStack最基本和常用的操作就是启动虚机. ...
- OpenStack虚机网卡的创建过程
OpenStack虚机网卡的创建过程 OpenStack最基本和常用的操作就是启动虚机.虚机启动的过程中涉及很多内容,其中非常重要的一个环节就是创建并绑定虚机的虚拟网卡.虚机的创建和管理是Nova的任 ...
随机推荐
- WEB攻击之 CSRF 攻击及防御策略
介绍 是一种挟制用户在当前已登录的Web应用程序上执行非本意的操作的攻击方法. 释义: 跨站请求攻击,简单地说,是攻击者通过一些技术手段欺骗用户的浏览器去访问一个自己曾经认证过的网站并运行一些操作(如 ...
- 使用Tornado作为Django App的服务器
闲来无事,折腾折腾. 老是听说tonado是个异步web框架和服务器,作为框架倒是了解到了,但是服务器一直不太懂.所以决定了解一下,既然可以做服务器,那就把自己的django app部署到这上边去. ...
- C#中使用GetCursorPos获取屏幕坐标
[StructLayout(LayoutKind.Sequential)] public struct POINT { public int X; public int Y; public POINT ...
- c# winform DataGridView 单元格的屏幕位置
首先取得DataGridView的坐标位置:int dgvX = dataGridView1.Location.X;int dgvY = dataGridView1.Location.Y;然后取得选中 ...
- c++控制台 设置字体颜色
一种方法是直接在程序上方栏杆点右键,然后属性处设置 优点是设置后一劳永逸,不需要像后面方法那样要自己把设置写入程序代码内 缺点是,一旦设置了就不能再改变了,程序从头到尾都是那种设置. 第二种方法是使用 ...
- iwork 文件格式分析
根据维基百科,到2015年苹果推出的iwork版本 第一章:iwork2008介绍 1.文档结构: 是一个资源合集:压缩格式的(内含文件夹和文件) 在windows下修改iwork的文件后缀为.rar ...
- 20.Consent Controller Get请求逻辑实现
在这里之前讲的这一块的信息就要登场了 需要通过构造函数把这几个注入进来 县引入这三个命名空间 把这三个注入进来,这就是显示依赖 先通过returnUrl拿到这个Request request拿到后,就 ...
- 转: Charles 从入门到精通
目录与版权 转载请保留顶部的 Charles 中国特惠内容,本文的内容主要包括: Charles 的简介 如何安装 Charles 将 Charles 设置成系统代理 Charles 主界面介绍 过滤 ...
- 无监督学习:Linear Dimension Reduction(线性降维)
一 Unsupervised Learning 把Unsupervised Learning分为两大类: 化繁为简:有很多种input,进行抽象化处理,只有input没有output 无中生有:随机给 ...
- cogs 1901. [国家集训队2011]数颜色
Cogs 1901. [国家集训队2011]数颜色 ★★★ 输入文件:nt2011_color.in 输出文件:nt2011_color.out 简单对比时间限制:0.6 s 内存限制 ...