Linux KVM: Disable virbr0 NAT Interface

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:

ADVERTISEMENTS

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

This entry is 9 of 14 in the CentOS / Redhat (RHEL) KVM Virtulization series. Keep reading the rest of the series:
  1. CentOS / Redhat: Install KVM Virtualization Software
  2. CentOS / Redhat: KVM Bridged Network Configuration
  3. KVM virt-manager: Install CentOS As Guest Operating System
  4. KVM virt-install: Install FreeBSD / CentOS As Guest Operating System
  5. KVM: Install CentOS / RHEL Using Kickstart File (Automated Installation)
  6. Troubleshooting KVM Virtualization Problem With Log Files
  7. KVM Virsh: Redirect FreeBSD Console To A Serial Port
  8. KVM: Starting / Stopping Guest Operating Systems With virsh Command
  9. Linux KVM: Disable virbr0 NAT Interface
  10. FreeBSD / OpeBSD Running in KVM Does Not Accept FTP Traffic
  11. KVM: Start a Virtual Machine / Guest At Boot Time
  12. KVM virt-install: Install OpenBSD As Guest Operating System
  13. Linux KVM: OpenBSD Guest Hangs At Starting tty Flags
  14. KVM Virtualization: Start VNC Remote Access For Guest Operating Systems
🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
22 comments… add one
  • Pankaj Gadhari Sep 14, 2010 @ 17:25

    Hi Vivek,

    Whether disabling virbr0 i mean the steps you have given above needs a restart of the machine.

    • 🐧 nixCraft Sep 14, 2010 @ 18:06

      No just restart the libvirtd service.

      • Pankaj Gadhari Sep 14, 2010 @ 18:31

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

  • Simon Hamp Nov 25, 2010 @ 18:12

    How would I reverse this?

  • ToddB Jan 2, 2011 @ 9:41

    Thanks for this tip! I was getting frustrated for a couple of hours trying to disable this nic!

  • Jony Mark Feb 5, 2011 @ 22:34

    Great topic
    please tell me how I can enable virbr0 if it was disable ?
    Reply ASAP
    Regards

  • MAD-Max Aug 2, 2011 @ 15:54

    Thank you

  • Nignog Nov 28, 2011 @ 15:36

    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”).

    • chadunplugged Mar 13, 2013 @ 22:25

      Negative, this did not work for me on centos 6.3. The article steps did work though.

      • zizouya Aug 22, 2013 @ 20:35

        virsh net-autostart default –-disable then reboot worked on RHEL6.4. Thanks

  • ANDRE Jun 16, 2012 @ 0:04

    Thank you!

    I had no idea how to disable virbr0.

    Very useful to your post.

    Hugs!

  • jestin Paul Aug 1, 2012 @ 6:36

    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

  • Manuel Oct 2, 2012 @ 21:34

    Thanks, you safe me really

  • David Ramirez Nov 1, 2012 @ 15:38

    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.

  • Suleman Mar 31, 2013 @ 11:12

    thanks, works very well

  • ndawg Sep 10, 2013 @ 22:46

    This tip helped me in Red Hat 6.4 also had to reboot system
    now virbr0 is disabled.

    Thanks a lot.

    ndawg

  • sharif mridha Aug 14, 2014 @ 13:07

    Thanks a lot now my virbr() disabled.

  • sudi Jul 31, 2015 @ 4:37

    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
    
  • fusch Mar 19, 2016 @ 16:38

    Why is this enabled by default after a fresh install?
    I guess its related to a guest login ?

  • Khang Feb 15, 2017 @ 15:03

    thank you so much

  • Kingneutron Mar 19, 2017 @ 21:20

    Thanks, your article just helped me :)

  • karan Apr 26, 2017 @ 20:51

    Thanks a lot , very precise and useful

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.