kvm 给虚机增加网卡
[root@666 ok]# virsh domiflist c03
Interface Type Source Model MAC
-------------------------------------------------------
vnet1 bridge br0 rtl8139 52:54:00:cf:e1:a3 [root@666 ok]# virsh list
Id Name State
----------------------------------------------------
1 c01 running
2 c03 running
3 c70 running
临时增加网卡:
[root@666 ok]# virsh attach-interface c03 --type bridge --source br0
Interface attached successfully
查看:
[root@666 ok]# virsh domiflist c03
Interface Type Source Model MAC
-------------------------------------------------------
vnet1 bridge br0 rtl8139 52:54:00:cf:e1:a3
vnet3 bridge br0 rtl8139 52:54:00:7e:c2:6a
[root@c03 conf]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:cf:e1:a3 brd ff:ff:ff:ff:ff:ff
inet 10.100.0.61/24 brd 10.100.0.255 scope global eth0
inet6 fe80::5054:ff:fecf:e1a3/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 52:54:00:2b:9e:6c brd ff:ff:ff:ff:ff:ff
永久增加网卡:
命令行增加网卡只保存在内存中,重启就失效,所以要保存在配置文件中
[root@666 ok]# virsh dumpxml c03 >/etc/libvirt/qemu/c03.xml
[root@666 ok]# virsh define /etc/libvirt/qemu/c03.xml
Domain c03 defined from /etc/libvirt/qemu/c03.xml
重启虚机后再次查看网卡:
[root@c03 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:cf:e1:a3 brd ff:ff:ff:ff:ff:ff
inet 10.100.0.61/24 brd 10.100.0.255 scope global eth0
inet6 fe80::5054:ff:fecf:e1a3/64 scope link
valid_lft forever preferred_lft forever
3: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 52:54:00:7e:c2:6a brd ff:ff:ff:ff:ff:ff
增加并配置配置文件:
[root@c03 network-scripts]# cp ifcfg-eth0 ifcfg-eth2^C
[root@c03 network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@c03 network-scripts]# cp ifcfg-eth0 ifcfg-eth2
配改MAC并查看:
DEVICE=eth0 | DEVICE=eth2
HWADDR=52:54:00:CF:E1:A3 | HWADDR=52:54:00:7e:c2:6a
TYPE=Ethernet | TYPE=Ethernet
UUID=4edbb7bf-e64f-402a-854c-ff259250c497 | #UUID=4edbb7bf-e64f-402a-854c-ff259250c497
ONBOOT=yes | ONBOOT=yes
NM_CONTROLLED=yes | NM_CONTROLLED=yes
BOOTPROTO=dhcp | BOOTPROTO=dhcp
查看IP
[root@c03 network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:cf:e1:a3 brd ff:ff:ff:ff:ff:ff
inet 10.100.0.61/24 brd 10.100.0.255 scope global eth0
inet6 fe80::5054:ff:fecf:e1a3/64 scope link
valid_lft forever preferred_lft forever
3: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:7e:c2:6a brd ff:ff:ff:ff:ff:ff
inet 10.100.0.58/24 brd 10.100.0.255 scope global eth2
inet6 fe80::5054:ff:fe7e:c26a/64 scope link
valid_lft forever preferred_lft forever
删除网卡命令:
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:cf:e1:a3 brd ff:ff:ff:ff:ff:ff
inet 10.100.0.61/24 brd 10.100.0.255 scope global eth0
inet6 fe80::5054:ff:fecf:e1a3/64 scope link
valid_lft forever preferred_lft forever
3: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:7e:c2:6a brd ff:ff:ff:ff:ff:ff
inet 10.100.0.58/24 brd 10.100.0.255 scope global eth2
inet6 fe80::5054:ff:fe7e:c26a/64 scope link
valid_lft forever preferred_lft forever
[root@666 ok]# virsh detach-interface c03 --type bridge --mac 52:54:00:7e:c2:6a
Interface detached successfully
查看IP
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:cf:e1:a3 brd ff:ff:ff:ff:ff:ff
inet 10.100.0.61/24 brd 10.100.0.255 scope global eth0
inet6 fe80::5054:ff:fecf:e1a3/64 scope link
valid_lft forever preferred_lft forever
再次保存配置文件:
[root@666 ok]# virsh dumpxml c03 >/etc/libvirt/qemu/c03.xml
[root@666 ok]# virsh define /etc/libvirt/qemu/c03.xml
Domain c03 defined from /etc/libvirt/qemu/c03.xml
kvm 给虚机增加网卡的更多相关文章
- KVM修改虚机网卡模式:由NAT模式改为Bridge模式
1)关闭虚机# virsh shutdown vm1 2)编辑虚机配置文件# virsh edit vm1 <interface type='default'> 改为<int ...
- vSphere克隆虚机重启网卡报错
使用VMware vSphere克隆虚机,修改IP重启网卡报错: 解决报错: 修改 /etc/udev/rules.d/70-persistent-net.rules 文件,克隆后会多出eth2和et ...
- 为EXSi5.5上的Centos虚机增加硬盘容量
宿主机调整 1. 关闭虚机, 2. 检查是否有存在的snapshot, 如果有, 需要删除, 否则不能调整磁盘容量 3. 虚机上编辑配置, 将磁盘容量调大后保存 虚机调整 参考这篇写得非常详细: 点击 ...
- 吃透KVM创建虚机和KVM命令
1.创建虚拟机 1.1创建虚拟机磁盘 #使用qemu命令来创建磁盘 qemu-img create -f qcow2 /var/lib/libvirt/images/centos7.2.qcow2 2 ...
- linux 虚机增加硬盘大小 转自
转自http://blog.csdn.net/tongyu2009/article/details/8525384 当我做到#unzip liunx_oracle时候,提示disk full? [ ...
- 查看运行的KVM的虚机
[root@ok Desktop]# cat demo.py #!/usr/bin/python import libvirt conn = libvirt.open("qemu:///sy ...
- virt-viewer 连kvm 虚机
# yum install virt-viewer [root@ cfplace]# virsh list --all Id Name State -------------------------- ...
- Centos7系统kvm虚机忘记密码进不去, 通过宿主机修改/etc/shadow文件改密码,重启后系统起不来故障排错
问题描述 某天, 因为其他项目组交接问题, kvm里面的堡垒机系统用户root密码登录不上,然后他通过宿主机修改/etc/shadow文件修改密码,但是修改完后重启系统后发现kvm宿主机连接不上虚机了 ...
- OpenStack 虚机网卡的创建过程
原文链接:https://www.cnblogs.com/potato-chip/p/9127083.html OpenStack虚机网卡的创建过程 OpenStack最基本和常用的操作就是启动虚机. ...
随机推荐
- [转]文件后缀与Mime类型对照表
//文档文件类型的 .ai application/postscript .eps application/postscript .exe application/octet-stream .doc ...
- django之创建第6个项目-过滤器
1.views.PY # Create your views here. #coding:utf-8 from django.http import HttpResponse import datet ...
- VS2015安装ASP.NET MVC4
http://www.microsoft.com/zh-cn/download/details.aspx?id=44533 下载安装 AspNetMVC4.msi
- los中预览文件
#import <UIKit/UIKit.h> #import <QuickLook/QuickLook.h> @interface ViewController : UIVi ...
- 接口测试-Http状态码-postman上传文件
转自:https://www.cnblogs.com/jiadan/articles/8546015.html 一. 接口 接口:什么是接口呢?接口一般来说有两种,一种是程序内部的接口,一种是系统 ...
- 【RS】Amazon.com recommendations: item-to-item collaborative filtering - 亚马逊推荐:基于物品的协同过滤
[论文标题]Amazon.com recommendations: item-to-item collaborative filtering (2003,Published by the IEEE C ...
- Debug 路漫漫-01
运行到子函数时提示报错: === 这个断点一步步debug下来是顺利的,但是咋就超出数组范围了呢,这会是什么问题. ——sess肯定超过索引了,那个sess(:,2)的值肯定超过V的行数了. ——由 ...
- Nginx+FastCGI运行原理(二)
1.4 PHP与PHP-FPM的安装及优化(2) 标签rlimit_files用于设置PHP-FPM对打开文件描述符的限制,默认值为1024.这个标签的值必须和Linux内核打开文件数关联起来,例如, ...
- 一步一步掌握java的线程机制(一)----创建线程
现在将1年前写的有关线程的文章再重新看了一遍,发现过去的自己还是照本宣科,毕竟是刚学java的人,就想将java的精髓之一---线程进制掌握到手,还是有点难度.等到自己已经是编程一年级生了,还是无法将 ...
- C/C++语言中闭包的探究及比较
这里主要讨论的是C语言的扩展特性block.该特性是Apple为C.C++.Objective-C增加的扩展,让这些语言可以用类Lambda表达式的语法来创建闭包.前段时间,在对CoreData存取进 ...