本文共 2377 字,大约阅读时间需要 7 分钟。
1、查看原有网卡信息root@localhost~]# virsh domiflist centos73Interface Type Source Model MAC-------------------------------------------------------vnet1 bridge br0 virtio 52:54:00:9d:7a:94 2、临时添加新网卡#[root@localhost~]# virsh attach-interface centos73 --type bridge --source br0Interfaceattached successfully成功附加接口 永久添加网卡命令#virsh attach-interface centos73 --type bridge --source br0 --config3、查看[root@localhost~]# virsh domiflist centos73Interface Type Source Model MAC-------------------------------------------------------vnet0 bridge br0 virtio 52:54:00:9d:7a:94vnet1 bridge br0 rtl8139 52:54:00:c4:8d:84 Last login: Mon Aug 21 21:27:27 from 192.168.0.190[root@localhost ~]# ifconfigeth0: flags=4163 mtu 1500 inet192.168.0.112 netmask 255.255.255.0 broadcast 192.168.0.255 inet6fe80::1e89:5915:c6b6:2eb1 prefixlen64 scopeid 0x20 ether52:54:00:c4:8d:84 txqueuelen 1000 (Ethernet) RX packets 29 bytes 4669 (4.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 35 bytes 3334 (3.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eth1: flags=4163 mtu 1500 inet192.168.0.172 netmask 255.255.255.0 broadcast 192.168.0.255 inet6fe80::5054:ff:fe9d:7a94 prefixlen64 scopeid 0x20 ether52:54:00:9d:7a:94 txqueuelen 1000 (Ethernet) RX packets 59 bytes 12755 (12.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 9 bytes 1246 (1.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1 (Local Loopback) RX packets 8 bytes 680 (680.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 8 bytes 680 (680.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 04、命令行增加的网卡只保存在内存中,重启就失效,所以需要保存到配置文件中 virsh dumpxml centos73 >/etc/libvirt/qemu/centos73.xml virshdefine /etc/libvirt/qemu/centos73.xmlDomaincentos73 defined from /etc/libvirt/qemu/centos73.xml删除网卡命令#virshdetach-interface centos73--type bridge --mac 52:54:00:c4:8d:84
转载于:https://blog.51cto.com/m51cto/1958517