zoukankan      html  css  js  c++  java
  • 虚拟机在线添加网卡

    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
    成功分离接口

    再重新保存配置

  • 相关阅读:
    bash特性
    FHS 层级文件系统
    环境变量的问题
    linux认识
    搜索引擎的使用
    nginx
    部署操作手册
    git
    添加tag
    pycharm中使用git
  • 原文地址:https://www.cnblogs.com/gushiren/p/9511739.html
Copyright © 2011-2022 走看看