blob: e5ff59110b7df6c7bd38d3a1b1d0be8407442d2b [file] [log] [blame]
John DeNisco06dcd452018-07-26 12:45:10 -04001.. toctree::
2
3.. _vhost01:
4
5Prerequisites
6-------------
7
8For this use case we will assume FD.io VPP is installed. We will also assume the user can create and start
9basic virtual machines. This use case will use the linux virsh commands. For more information on virsh
10refer to `virsh man page <https://linux.die.net/man/1/virsh>`_.
11
12The image that we use is based on an Ubuntu cloud image downloaded from:
13`Ubuntu Cloud Images <https://cloud-images.ubuntu.com/xenial/current>`_.
14
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +020015All FD.io VPP commands are being run from a su shell.
John DeNisco06dcd452018-07-26 12:45:10 -040016
17.. _vhosttopo:
18
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +020019Topology
John DeNisco06dcd452018-07-26 12:45:10 -040020---------
21
22In this case we will use 2 systems. One system we will be running standard linux, the other will
23be running FD.io VPP.
24
25.. figure:: /_images/vhost-topo.png
26 :alt:
27
28 Vhost Use Case Topology
29
30Creating The Virtual Interface
31------------------------------
32
33We will start on the system running FD.io VPP and show that no Virtual interfaces have been created.
34We do this using the :ref:`showintcommand` command.
35
36Notice we do not have any virtual interfaces. We do have an interface (TenGigabitEthernet86/0/0) that
37is up. This interface is connected to a system running, in our example standard linux. We will use
38this system to verify our connectivity to our VM with ping.
39
40.. code-block:: console
41
42 $ sudo bash
43 # vppctl
44 _______ _ _ _____ ___
45 __/ __/ _ \ (_)__ | | / / _ \/ _ \
46 _/ _// // / / / _ \ | |/ / ___/ ___/
47 /_/ /____(_)_/\___/ |___/_/ /_/
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +020048
John DeNisco06dcd452018-07-26 12:45:10 -040049 vpp# clear interfaces
50 vpp# show int
51 Name Idx State Counter Count
52 TenGigabitEthernet86/0/0 1 up
53 TenGigabitEthernet86/0/1 2 down
54 local0 0 down
55 vpp#
56
57For more information on the interface commands refer to: :ref:`intcommands`
58
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +020059The next step will be to create the virtual port using the ``createvhostuser`` command.
John DeNisco06dcd452018-07-26 12:45:10 -040060This command will create the virtual port in VPP and create a linux socket that the VM will
61use to connect to VPP.
62
63The port can be created using VPP as the socket server or client.
64
65Creating the VPP port:
66
67.. code-block:: console
68
69 vpp# create vhost socket /tmp/vm00.sock
70 VirtualEthernet0/0/0
71 vpp# show int
72 Name Idx State Counter Count
73 TenGigabitEthernet86/0/0 1 up
74 TenGigabitEthernet86/0/1 2 down
75 VirtualEthernet0/0/0 3 down
76 local0 0 down
77 vpp#
78
79Notice the interface **VirtualEthernet0/0/0**. In this example we created the virtual interface as
80a client.
81
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +020082We can get more detail on the vhost connection with the ``showvhost`` command.
John DeNisco06dcd452018-07-26 12:45:10 -040083
84.. code-block:: console
85
86 vpp# show vhost
87 Virtio vhost-user interfaces
88 Global:
89 coalesce frames 32 time 1e-3
90 number of rx virtqueues in interrupt mode: 0
91 Interface: VirtualEthernet0/0/0 (ifindex 3)
92 virtio_net_hdr_sz 12
93 features mask (0xffffffffffffffff):
94 features (0x58208000):
95 VIRTIO_NET_F_MRG_RXBUF (15)
96 VIRTIO_NET_F_GUEST_ANNOUNCE (21)
97 VIRTIO_F_ANY_LAYOUT (27)
98 VIRTIO_F_INDIRECT_DESC (28)
99 VHOST_USER_F_PROTOCOL_FEATURES (30)
100 protocol features (0x3)
101 VHOST_USER_PROTOCOL_F_MQ (0)
102 VHOST_USER_PROTOCOL_F_LOG_SHMFD (1)
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200103
John DeNisco06dcd452018-07-26 12:45:10 -0400104 socket filename /tmp/vm00.sock type client errno "No such file or directory"
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200105
John DeNisco06dcd452018-07-26 12:45:10 -0400106 rx placement:
107 tx placement: spin-lock
108 thread 0 on vring 0
109 thread 1 on vring 0
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200110
John DeNisco06dcd452018-07-26 12:45:10 -0400111 Memory regions (total 0)
112
113Notice **No such file or directory** and **Memory regions (total 0)**. This is because the
114VM has not been created yet.
115