11 #. Create a veth interface in Linux host
12 #. Assign an IP address to one end of the veth interface in the Linux host
13 #. Create a vpp host-interface that connected to one end of a veth interface via AF_PACKET
14 #. Add an ip address to a vpp interface
16 VPP commands learned in this exercise
17 --------------------------------------
19 #. `create host-interface <https://docs.fd.io/vpp/17.04/clicmd_src_vnet_devices_af_packet.html#clicmd_create_host-interface>`_
20 #. `set int state <https://docs.fd.io/vpp/17.04/clicmd_src_vnet.html#clicmd_set_interface_state>`_
21 #. `set int ip address <https://docs.fd.io/vpp/17.04/clicmd_src_vnet_ip.html#clicmd_set_interface_ip_address>`_
22 #. `show hardware <https://docs.fd.io/vpp/17.04/clicmd_src_vnet.html#clicmd_show_hardware-interfaces>`_
23 #. `show int <https://docs.fd.io/vpp/17.04/clicmd_src_vnet.html#clicmd_show_interfaces>`_
24 #. `show int addr <https://docs.fd.io/vpp/17.04/clicmd_src_vnet.html#clicmd_show_interfaces>`_
25 #. `trace add <https://docs.fd.io/vpp/17.04/clicmd_src_vlib.html#clicmd_trace_add>`_
26 #. `clear trace <https://docs.fd.io/vpp/17.04/clicmd_src_vlib.html#clicmd_clear_trace>`_
27 #. `ping <https://docs.fd.io/vpp/17.04/clicmd_src_vnet_ip.html#clicmd_ping>`_
28 #. `show ip neighbors <https://docs.fd.io/vpp/21.06/db/dba/clicmd_src_vnet_ip-neighbor.html#clicmd_show_ip_neighbors>`_
29 #. `show ip fib <https://docs.fd.io/vpp/17.04/clicmd_src_vnet_fib.html#clicmd_show_ip_fib>`_
34 .. figure:: /_images/Create_Interface_Topology.jpg
35 :alt: Figure: Create Interface Topology
37 Figure: Create Interface Topology
42 The initial state here is presumed to be the final state from the previous sections
45 Create veth interfaces on host
46 -------------------------------
48 In Linux, there is a type of interface call 'veth'. Think of a 'veth'
49 interface as being an interface that has two ends to it (rather than
52 Create a veth interface with one end named **vpp1out** and the other
55 .. code-block:: console
57 $ sudo ip link add name vpp1out type veth peer name vpp1host
61 .. code-block:: console
63 $ sudo ip link set dev vpp1out up
64 $ sudo ip link set dev vpp1host up
69 .. code-block:: console
71 $ sudo ip addr add 10.10.1.1/24 dev vpp1host
75 .. code-block:: console
77 $ ip addr show vpp1host
78 5: vpp1host@vpp1out: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
79 link/ether e2:0f:1e:59:ec:f7 brd ff:ff:ff:ff:ff:ff
80 inet 10.10.1.1/24 scope global vpp1host
81 valid_lft forever preferred_lft forever
82 inet6 fe80::e00f:1eff:fe59:ecf7/64 scope link
83 valid_lft forever preferred_lft forever
85 Create vpp host-interface
86 --------------------------
88 Make sure VPP is running, if not start it.
90 .. code-block:: console
93 vagrant 2141 903 0 05:28 pts/0 00:00:00 grep --color=auto vpp
94 # vpp is not running, so start it
95 $ sudo /usr/bin/vpp -c startup1.conf
97 These commands are run from the vpp shell. Enter the VPP shell with the following
100 .. code-block:: console
102 $ sudo vppctl -s /run/vpp/cli-vpp1.sock
103 _______ _ _ _____ ___
104 __/ __/ _ \ (_)__ | | / / _ \/ _ \
105 _/ _// // / / / _ \ | |/ / ___/ ___/
106 /_/ /____(_)_/\___/ |___/_/ /_/
110 Create a host interface attached to **vpp1out**.
112 .. code-block:: console
114 vpp# create host-interface name vpp1out
117 Confirm the interface:
119 .. code-block:: console
122 Name Idx Link Hardware
123 host-vpp1out 1 up host-vpp1out
124 Ethernet address 02:fe:d9:75:d5:b4
125 Linux PACKET socket interface
129 Turn up the interface:
131 .. code-block:: console
133 vpp# set int state host-vpp1out up
135 Confirm the interface is up:
137 .. code-block:: console
140 Name Idx State MTU (L3/IP4/IP6/MPLS) Counter Count
141 host-vpp1out 1 up 9000/0/0/0
142 local0 0 down 0/0/0/0
144 Assign ip address 10.10.1.2/24
146 .. code-block:: console
148 vpp# set int ip address host-vpp1out 10.10.1.2/24
150 Confirm the ip address is assigned:
152 .. code-block:: console