gushiren

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1、查看原有网卡信息

#virsh domiflist snale
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vnet0      bridge     br0        virtio      52:54:00:8c:b8:60

2、临时添加新网卡

#virsh attach-interface snale --type bridge --source br0
成功附加接口
 
永久添加网卡命令
#virsh attach-interface snale --type bridge --source br0  --config

3、查看

 
#virsh domiflist snale
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vnet0      bridge     br0        virtio      52:54:00:8c:b8:60
vnet1      bridge     br0        -           52:54:00:14:86:cf
 
#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:8c:b8:60 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.23/24 brd 192.168.0.255 scope global eth0
    inet6 fe80::5054:ff:fe8c:b860/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:14:86:cf brd ff:ff:ff:ff:ff:ff

4、命令行增加的网卡只保存在内存中,重启就失效,所以需要保存到配置文件中

#virsh dumpxml snale >/etc/libvirt/qemu/snale.xml
#virsh define /etc/libvirt/qemu/snale.xml

删除网卡命令

#virsh detach-interface snale  --type bridge --mac  52:54:00:14:86:cf
成功分离接口

再重新保存配置

posted on 2018-08-21 15:42  gushiren  阅读(1234)  评论(0编辑  收藏  举报