How virbr0-nic is created?

How can I create a virtual network interface like virbr0-nic? I am trying to find a way to create a NIC like virbr0-nic but everything which I can find on the Internet is how to create an interface attached to the physical interface like eth0:0. When I write

# brctl show
bridge name bridge id       STP enabled interfaces
virbr0      8000.525400e0af01   yes virbr0-nic
virbr1      8000.525400e8a6b1   yes virbr1-nic
                            vnet1

So virbr0 is the bridge to which virbr0-nic is attached. So how are virbr0-nic and vnet1 created?


These are dummy devices. You can run

modprobe dummy

To create a network interface called dummy0.

If you want more than one device, you can create say 5 with

modprobe dummy numdummies=5

You can then control these devices like any other network device.

Give it a MAC address with

ip link set dummy0 address aa:aa:aa:bb:bb:bb

Give it an IP address with

ip addr add 10.0.0.1/24 dev dummy0

Add it to your existing bridge with

brctl addif virbr0 dummy0

Set it up, set it down, NAT off it, and so on.


The libvirt is using TUN device for this purpose. You can manually create this device by following command:

# /usr/bin/tunctl -t virbr0-nic

virbr0-nic stands for Virtual bridge NIC.

It's basically a bridge between your physical Network Card and your Virtual Machine's virtual Network Card.

To manage bridged interface you can use the brctl command. You can list all your bridged interfaces with

brctl show 

and add or modify bridges accordingly to your needs. To create a new bridge use

brctl addbr <name>

where <name> will be your new bridge's name (as virbr0-nic).Then you can add interfaces to the bridge with

brctl addif <brname> <ifname>

You can refer to the man page for additional information.


It is not clear exactly which types of devices virbr0-nic and vnet1 are in your setup. There are a few types of virtual devices which can be useful to include in a bridge, some of which can be created using the ip command.

One kind of virtual devices is veth which creates pairs of connected virtual Ethernet interfaces.

ip link add veth0 type veth peer name veth1

In this example veth0 and veth1 are arbitrary interface names that I came up with for the example. This method can for example be useful if you want to move one of the two interfaces to a different networking namespace.

Another kind of virtual interface is vlan where you create a single virtual Ethernet interface attached to a specific 802.1q tag on a physical interface:

ip link add link eth0 name eth0.10 type vlan id 10

There is a man page with information about even more types of virtual interfaces which can be created with the ip command. The name of the man page depends on which version you have installed, I have seen it named ip-link or just ip.

Additionally if you are using any virtualization there are virtual interfaces connecting host and VM. The specifics of those depend on the virtualization solution you are using.