CentOS7 删除virbr0虚拟网卡

CentOS7 删除virbr0虚拟网卡

在CentOS 7的安装过程中如果有选择相关虚拟化的的服务安装系统后,启动网卡时会发现有一个以网桥连接的私网地址的virbr0网卡,这个是因为在虚拟化中有使用到libvirtd服务生成的,如果不需要可以关闭后去掉:

一、查看IP及网桥设备
[root@Node1 ~]# ip -4 addr //查看IP地址
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    inet 192.168.10.7/24 brd 192.168.10.255 scope global ens33
       valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
[root@Node1 ~]#
[root@Node1 ~]# brctl show    //查看网桥
bridge name     bridge id               STP enabled     interfaces
virbr0          8000.5254005caf00       yes             virbr0-nic
[root@Node1 ~]#
[root@Node1 ~]# virsh net-list


二、删除网桥
[root@Node1 ~]# ifconfig virbr0 down   
[root@Node1 ~]# brctl delbr virbr0
[root@Node1 ~]# ip link set virbr0-nic down
[root@Node1 ~]# ip link delete virbr0-nic
[root@Node1 ~]# virsh net-destroy default
[root@Node1 ~]# virsh net-undefine default


三、禁用开机服务
[root@Node1 ~]# systemctl disable libvirtd.service  //禁用libvirtd服务开机自启动
Removed symlink /etc/systemd/system/multi-user.target.wants/libvirtd.service.
Removed symlink /etc/systemd/system/sockets.target.wants/virtlockd.socket.
Removed symlink /etc/systemd/system/sockets.target.wants/virtlogd.socket.
[root@Node1 ~]# systemctl mask libvirtd.service
Created symlink from /etc/systemd/system/libvirtd.service to /dev/null.

四、验证
[root@Node1 ~]# ip  -4 add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    inet 192.168.10.100/24 brd 192.168.10.255 scope global noprefixroute ens33
       valid_lft forever preferred_lft forever
[root@Node1 ~]#


五、经过重启验证,发现virbr0已经删除

posted @ 2022-03-25 09:20  花之旭  阅读(226)  评论(0编辑  收藏  举报