There is only one Network card on machine but ifconfig shows 2 interface by name virbr0
and lxcbr0
. How to remove or disable them permanently if not using them.
# ifconfig .... lxcbr0 Link encap:Ethernet HWaddr 82:61:68:AC:39:0F inet addr:10.116.186.1 Bcast:0.0.0.0 Mask:255.255.255.0 inet6 addr: fe80::8061:68ff:feac:390f/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:5 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:390 (390.0 b) virbr0 Link encap:Ethernet HWaddr 52:54:00:80:A7:C3 inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Solution
On a Linux host server, the virtual network switch shows up as a network interface. The default one, created when the libvirt daemon is first installed and started, shows up as virbr0. It will act as a gateway for the VMs to route traffic. libvirtd will also insert iptables rules in the iptable configuration for proper routing/natting of VM packets.
If you don't want to use libvirtd service, you can stop the same which will remove all these network configurations from the system for virbr0 interface.
lxcbr0
– is a virtual bridge created when you install and configure lxc container with package lxc. you may also remove this interface if not running any lxc containers.
Removing virbr0 interface
Case 1 : Not using libvirtd service
If not using libvirtd service then you may stop that service.
For RHEL/CentOS 5,6
1. Stop the libvirtd service.
2. Disable the libvirtd service permanently, so that it will not start at boot.
# chkconfig --list | grep libvirtd # chkconfig libvirtd off
For RHEL/CentOS 7
1. Check the status of the service and disable the libvirtd service using systemctl command.
# /bin/systemctl stop libvirtd.service
# /bin/systemctl status libvirtd.service ● libvirtd.service - Virtualization daemon Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled) Active: inactive (dead) since Fri 2016-10-07 11:04:31 IST; 2s ago Docs: man:libvirtd(8) http://libvirt.org Process: 1275 ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS (code=exited, status=0/SUCCESS) Main PID: 1275 (code=exited, status=0/SUCCESS)
1. Check the status of the service and disable the libvirtd service using systemctl command.
# /bin/systemctl stop libvirtd.service
Case 2 : Using libvirtd and dont want “virbr0”
In this scenario libvirtd service will be kept running but we will remove the virbr0 interface. Follow the steps below to remove the virbr0 interface.
1. List the default network set-up for the virtual machines
# virsh net-list Name State Autostart Persistent ---------------------------------------------------------- default active yes yes
2. Destroy the network default.
# virsh net-destroy default Network default destroyed
3. Permanently remove the default vitual network from the configuration.
# virsh net-undefine default Network default has been undefined
4. The interface virbr0 is now gone. You can verify it in the ifconfig or ip command output.
# ifconfig virbr0 virbr0: error fetching interface information: Device not found
Removing virbr0 interface on running machines ( non-persistence across reboots )
1. First, list out the virtual bridge interfaces available on the system using the below command.
# brctl show bridge name bridge id STP enabled interfaces virbr0 8000.5254003008b6 yes virbr0-nic
2. Make the bridge interface down before removal.
# ip link set virbr0 down
3. Now, remove the bridge
# brctl delbr virbr0
4. check if the bridge is removed
# brctl show bridge name bridge id STP enabled interfaces
Removing lxcbr0 interface
lxcbr0 is a virtual bridge created when you install and configure lxc container with package lxc. To remove the lxcbr0 interface follow the steps given below.
1. change the below line in /etc/sysconfig/lxc. This will be effective after reboot. change the line from
USE_LXC_BRIDGE="true"
to
USE_LXC_BRIDGE="false"
2. you may remove the lxcbr0 bridge interface for the running system. But this will not be effective after reboot. hence need to perform above step first. Lets first list the bridge interfaces.
# brctl show
3. Make the bridge interface down before removal
# ip link set lxcbr0 down
4. Now, remove the bridge using the ‘brctl delbr’ command.
# brctl delbr lxcbr0
5. check if the bridge is removed.
# brctl show