Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


vRouter Command Line Utilities


vRouter is the component that takes packets from VMs and forwards them to their destinations. In this effort, vRouter depends on the vRouter agent to make sense of the overall topology, understand the various policies that govern the communication between VMs, and program them in vRouter in a way vRouter understands.

vRouter has a few fundamental data structures that abstracts out the various communication paths. There is "interface," "flow," "route," and "nexthop" that enables vRouter to push packets to their eventual destinations. In addition, vRouter also has good statistics that can help understand and debug packet paths. Various command line utilities provided by the vRouter can be used to display these data structures and better understand the behavior that one sees in a compute node.

This section describes the shell prompt utilities available for examining the state of the vRouter kernel module in Contrail.

vif Command

The vRouter requires vRouter interfaces (vif) to forward traffic. Use the vif command to see the interfaces that are known by the vRouter.


Having interfaces only in the OS (Linux) is not sufficient for forwarding. The relevant interfaces must be added to vRouter. Typically, the set up of interfaces is handled by components like nova-compute or vRouter agent.

The vif command can be used to see the interfaces that the vRouter is aware of by including the --list option.

Example: vif --list

Table 1: vif Fields

vif Output Field



The vRouter assigned name, where 0 is the router ID and X is the index allocated to the interface within the vRouter.

OS: pkt0

The pkt0 (in this case) is the name of the actual OS (Linux) visible interface name. For physical interfaces, the speed and the duplex settings are also displayed.


Type:Virtual HWaddr:00:00:5e:00:01:00 IPaddr:0

The type of interface and its IP address, as defined by vRouter. The values can be different from what is seen in the OS. Types defined by vRouter include:

  • Virtual – Interface of a virtual machine (VM).

  • Physical – Physical interface (NIC) in the system.

  • Host – An interface toward the host.

  • Agent – An interface used to trap packets to the vRouter agent when decisions need to be made for the forwarding path.


Vrf:65535 Flags:L3 MTU:1514 Ref:2

The identifier of the vrf to which the interface is assigned, the flags set on the interface, the MTU as understood by vRouter, and a reference count of how many individual entities actually hold reference to the interface (mainly of debugging value).

Flag options identify that the following are enabled for the interface:

  • P - ​Policy. All traffic that comes to vRouter from this interface are subjected to policy.

  • L3 - ​Layer 3 forwarding

  • L2 - ​Layer 2 bridging

  • X - Cross connect mode, only set on physical and host interfaces, indicating that packets are moved between physical and host directly, with minimal intervention by vRouter. Typically set when the agent is not alive or not in good shape.

  • ​Mt - Mirroring transmit direction. All packets that egresses this interface are mirrored.

  • ​ Mr - Mirroring receive direction​. All packets that ingresses this interface will be mirrored.

  • Tc - ​Checksum offload on the transmit side. Valid only on the physical interface.


RX packets:60 bytes:4873 errors:0

Packets received by vRouter from this interface.


TX packets:21 bytes:2158 errors:0

Packets transmitted out by vRouter on this interface.

vif Options

Use vif –-help to display all options available for the vif command. Following is a brief description of each option.


It is not recommended to use the following options unless you are very experienced with the system utilities.




Creates a “host” interface with name <intf_name> and mac <mac> on the host kernel. The vhost0 interface that you see on Linux is a typical example of invocation of this command.


Adds the existing interfaces in the host OS to vRouter, with type and flag options.


Deletes the interface from vRouter. The <intf_id> i is the vRouter interface ID as given by vif0/X, where X is the ID. So, in vif0/1, 1 is the interface index of that vif inside the vRouter module.


Displays a specific interface. The <intf_id> is the vRouter interface ID, unless the command is appended by the —kernel option, in which case the ID is the kernel ID.


Set working parameters of an interface. The ones supported are the vlan id and the vrf. The vlan id as understood by vRouter differs from what one typically expects and is relevant for interfaces of service instances.


Display all of the interfaces of which the vRouter is aware.


Display all options available for the current command.


Clears statistics for all interfaces on all cores. For more information, see clear Command.

clear Command

Contrail Networking Release 2008 supports clearing of vif statistics counters for all interfaces by using the -clear command. For more information on -clear command options, see Table 2.

Table 2: clear Command Options




Clears statistics for all interfaces on all cores.

-clear -id <vif-id>

Clears statistics for a specific interface.

-clear -core <core-id>

Clears statistics on a specific core for all interfaces.

-clear -id <vif-id> -core <core-id>

Clears statistics for a specific interface on a specific core.

Release History Table
Contrail Networking Release 2008 supports clearing of vif statistics counters for all interfaces by using the -clear command.