在CentOS 7的安装过程中如果有选择相关虚拟化的的服务安装系统后,启动网卡时会发现有一个以网桥连接的私网地址的virbr0网卡,这个是因为在虚拟化中有使用到libvirtd服务生成的,如果不需要可以关闭后去掉:
一、查看IP及网桥设备
[root@etc ~]# ifconfig //查看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.133.121/24 brd 192.168.133.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.120.1/24 brd 192.168.120.255 scope global virbr0
valid_lft forever preferred_lft forever
[root@etc ~]# brctl show //查看网桥
bridge name bridge id STP enabled interfaces
virbr0 8321.5254115cdv00 yes virbr0-nic
[root@etc ~]#
二、删除网桥
[root@etc ~]# ifconfig virbr0 down
[root@etc ~]# brctl delbr virbr0 //删除网桥
三、禁用开机服务
[root@etc ~]# 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@etc ~]# systemctl mask libvirtd.service
Created symlink from /etc/systemd/system/libvirtd.service to /dev/null.
再次使用ifconfig查看,即可发现virbr0不在了
[root@Node1 ~]# ifconfig
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.133.121/24 brd 192.168.133.255 scope global ens33
valid_lft forever preferred_lft forever
当然也可直接将libvirtd服务卸载,这样也就不会生成虚拟网卡,更是一劳永逸,待需要使用时,再安装该服务即可。操作命令如下:
yum remove libvirt-libs.x86_64
|