linux操作知識,CentOS 7對虛擬網(wǎng)卡virbr0的處理
在CentOS 7的安裝過程中如果有選擇相關(guān)虛擬化的的服務(wù)安裝系統(tǒng)后,啟動網(wǎng)卡時會發(fā)現(xiàn)有一個以網(wǎng)橋連接的私網(wǎng)地址的virbr0網(wǎng)卡,這個是因為在虛擬化中有使用到libvirtd服務(wù)生成的,如果不需要可以關(guān)閉后去掉:
一、查看IP及網(wǎng)橋設(shè)備
[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? ? //查看網(wǎng)橋
bridge name? ???bridge id? ?? ?? ?? ?? ?STP enabled? ???interfaces
virbr0? ?? ?? ? 8321.5254115cdv00? ?? ? yes? ?? ?? ?? ? virbr0-nic
[root@etc ~]#
二、刪除網(wǎng)橋
[root@etc ~]# ifconfig virbr0 down? ?
[root@etc ~]# brctl delbr virbr0? ?//刪除網(wǎng)橋
三、禁用開機服務(wù)
[root@etc ~]# systemctl disable libvirtd.service? ? //禁用libvirtd服務(wù)開機自啟動
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查看,即可發(fā)現(xiàn)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
當(dāng)然也可直接將libvirtd服務(wù)卸載,這樣也就不會生成虛擬網(wǎng)卡,更是一勞永逸,待需要使用時,再安裝該服務(wù)即可。操作命令如下:
yum remove libvirt-libs.x86_64
