Chinaunix首页 | 论坛 | 博客
  • 博客访问: 346792
  • 博文数量: 135
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1106
  • 用 户 组: 普通用户
  • 注册时间: 2013-03-20 09:56
文章分类

全部博文(135)

文章存档

2017年(3)

2016年(18)

2015年(69)

2014年(39)

2013年(6)

我的朋友

分类: 虚拟化

2014-10-15 10:01:53

对于KVM虚拟机,可以在宿主机上模拟网卡的通断,具体步骤如下(以下步骤均在宿主机上执行):
1.查询客户机网络情况:
#virsh  qemu-monitor-command --hmp hatest01 "info network"
Devices not on any VLAN:
hostnet0: fd=25 peer=net0
hostnet1: fd=29 peer=net1
net0: model=virtio-net-pci,macaddr=52:54:00:61:18:8d peer=hostnet0
net1: model=virtio-net-pci,macaddr=52:54:00:9b:b2:c0 peer=hostnet1
(info)hmp后跟的是客户机的名称,可以通过virsh list查到

(info)通过macaddr来确定具体的网卡
2.模拟断开网络:
#virsh qemu-monitor-command --hmp hatest01 "set_link net0 off"
3.模拟网络恢复
#virsh qemu-monitor-command --hmp hatest01 "set_link net0 on"


阅读(853) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~