Linux KVM: Disable virbr0 NAT Interface

Posted on in Categories , , , last updated February 1, 2011

The virtual network (virbr0) used for Network address translation (NAT) which allows guests to access to network services. However, NAT slows down things and only recommended for desktop installations. To disable Network address translation (NAT) forwarding type the following commands:

Display Current Setup

Type the following command:
# ifconfig
Sample outputs:

virbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:7921 (7.7 KiB)

Or use the following command:
# virsh net-list
Sample outputs:

Name                 State      Autostart
-----------------------------------------
default              active     yes       

To disable virbr0, enter:
# virsh net-destroy default
# virsh net-undefine default
# service libvirtd restart
# ifconfig

21 comment

      1. If we shutdown the libvirtd service as we are not using it, whether virbr0 interface will come down and not show up in ifconfig.

  1. You can use “net-autostart default –disable” instead of “net-undefine default”. This keeps the config on disk so that you may reenable it later if you need it (with “net-autostart default”).

  2. Thanks !

    Worked very well.

    Don’t know whether we can disable it at OS installation itself, if not required.

    Found this on a machine installed by 3rd party and was taking lot of load.

    regards

  3. Thanks – worked just fine on a CentOS 5.8/64 environment on a big server that I want to set up with Xen or KVM – but no NAT is needed/wanted. Next step is to set up a bridge… but not virbr0.

  4. to reverse this you need to recreate default virbr0

    # brctl addbr virbr0
    # ip addr add 192.168.122.1/24 broadcast 192.168.122.255 dev virbr0
    # ip link set dev virbr0 up
    
    # uuidgen virbr0 < gen uuid for virbr0
    # ifconfig | grep virbr0 < get the mac address
    
    # vim /root/default.xml
    
    
      default
      6087308e-2b93-4d4d-aa24-dabd1668b11a
      
    
    # virsh net-list
     Name                 State      Autostart     Persistent
    ----------------------------------------------------------
    
    # cp default.xml /var/lib/libvirt/network/
    
    # virsh net-define default.xml
    # virsh net-autostart default
    # service libvirtd restart
    
    # virsh net-list
     Name                 State      Autostart     Persistent
    ----------------------------------------------------------
     default              active     yes           yes
    

Leave a Comment