删除自己不想要的网卡配置信息
[root@centos7 ~]# ifconfig
ens33: flags=4163mtu 1500
inet 192.168.137.20 netmask 255.255.255.0 broadcast 192.168.137.255
inet6 fe80::917b:8064:5076:5abb prefixlen 64 scopeid 0x20
ether 00:0c:29:32:50:0e txqueuelen 1000 (Ethernet)
RX packets 10511 bytes 14992536 (14.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4377 bytes 301300 (294.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:6c:c5:86 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
查看网络列表
[root@centos7 network-scripts]# virsh net-destroy default
bash: virsh: 未找到命令...
下载下面两个包
[root@centos7 ~]# yum install libguestfs-tools
[root@centos7 ~]# yum install virt-install.noarch
[root@centos7 network-scripts]# virsh net-list
名称 状态 自动开始 持久
----------------------------------------------------------
default 活动 是 是
删除网桥
[root@centos7 ~]# ifconfig virbr0 down
[root@centos7 ~]# virsh net-destroy default
网络 default 被删除
从配置文件中剔除
[root@centos7 ~]# virsh net-undefine default
网络 default 已经被取消定义
重新启动libvirtd服务
[root@centos7 ~]# systemctl restart libvirtd
[root@centos7 ~]# systemctl status libvirtd
● libvirtd.service - Virtualization daemon
Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; disabled; vendor preset: enabled)
Active: active (running) since 二 2019-08-06 16:41:59 CST; 13s ago
Docs: man:libvirtd(8)
https://libvirt.org
Main PID: 20828 (libvirtd)
Tasks: 19 (limit: 32768)
CGroup: /system.slice/libvirtd.service
├─ 8670 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf...
├─ 8673 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf...
└─20828 /usr/sbin/libvirtd
8月 06 16:41:59 centos7.6 systemd[1]: Starting Virtualization daemon...
8月 06 16:41:59 centos7.6 systemd[1]: Started Virtualization daemon.
8月 06 16:42:08 centos7.6 dnsmasq[8670]: no servers found in /etc/resolv.conf, will...ry
8月 06 16:42:08 centos7.6 dnsmasq[8670]: reading /etc/resolv.conf
8月 06 16:42:08 centos7.6 dnsmasq[8670]: using nameserver 192.168.137.254#53
Hint: Some lines were ellipsized, use -l to show in full.
[root@centos7 ~]# systemctl enable libvirtd
Created symlink from /etc/systemd/system/multi-user.target.wants/libvirtd.service to /usr/lib/systemd/system/libvirtd.service.
Created symlink from /etc/systemd/system/sockets.target.wants/virtlockd.socket to /usr/lib/systemd/system/virtlockd.socket.
Created symlink from /etc/systemd/system/sockets.target.wants/virtlogd.socket to /usr/lib/systemd/system/virtlogd.socket.
再次查看IP列表
[root@centos7 ~]# virsh net-list
名称 状态 自动开始 持久
----------------------------------------------------------
[root@centos7 ~]# ifconfig
ens33: flags=4163mtu 1500
inet 192.168.137.20 netmask 255.255.255.0 broadcast 192.168.137.255
inet6 fe80::917b:8064:5076:5abb prefixlen 64 scopeid 0x20
ether 00:0c:29:32:50:0e txqueuelen 1000 (Ethernet)
RX packets 273612 bytes 405730639 (386.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 61249 bytes 3998767 (3.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0