John DeNisco | 06dcd45 | 2018-07-26 12:45:10 -0400 | [diff] [blame] | 1 | .. _vhost03: |
| 2 | |
| 3 | Bridge the Interfaces |
| 4 | --------------------- |
| 5 | |
| 6 | To connect the 2 interfaces we put them on an L2 bridge. |
| 7 | |
| 8 | Use the "set interface l2 bridge" command. |
| 9 | |
| 10 | .. code-block:: console |
| 11 | |
| 12 | vpp# set interface l2 bridge VirtualEthernet0/0/0 100 |
| 13 | vpp# set interface l2 bridge TenGigabitEthernet86/0/0 100 |
| 14 | vpp# show bridge |
| 15 | BD-ID Index BSN Age(min) Learning U-Forwrd UU-Flood Flooding ARP-Term BVI-Intf |
| 16 | 100 1 0 off on on on on off N/A |
| 17 | vpp# show bridge 100 det |
| 18 | BD-ID Index BSN Age(min) Learning U-Forwrd UU-Flood Flooding ARP-Term BVI-Intf |
| 19 | 100 1 0 off on on on on off N/A |
| 20 | |
| 21 | Interface If-idx ISN SHG BVI TxFlood VLAN-Tag-Rewrite |
| 22 | VirtualEthernet0/0/0 3 1 0 - * none |
| 23 | TenGigabitEthernet86/0/0 1 1 0 - * none |
| 24 | vpp# show vhost |
| 25 | |
| 26 | Bring the Interfaces Up |
| 27 | ----------------------- |
| 28 | |
| 29 | We can now bring all the pertinent interfaces up. We can then we will then be able to communicate |
| 30 | with the VM from the remote system running Linux. |
| 31 | |
| 32 | Bring the interfaces up with :ref:`setintstate` command. |
| 33 | |
| 34 | .. code-block:: console |
| 35 | |
| 36 | vpp# set interface state VirtualEthernet0/0/0 up |
| 37 | vpp# set interface state TenGigabitEthernet86/0/0 up |
| 38 | vpp# sh int |
| 39 | Name Idx State Counter Count |
| 40 | TenGigabitEthernet86/0/0 1 up rx packets 2 |
| 41 | rx bytes 180 |
| 42 | TenGigabitEthernet86/0/1 2 down |
| 43 | VirtualEthernet0/0/0 3 up tx packets 2 |
| 44 | tx bytes 180 |
| 45 | local0 0 down |
| 46 | |
| 47 | Ping from the VM |
| 48 | ---------------- |
| 49 | |
| 50 | The remote Linux system has an ip address of "10.0.0.2" we can now reach it from the VM. |
| 51 | |
| 52 | Use the "virsh console" command to attach to the VM. "ctrl-D" to exit. |
| 53 | |
| 54 | .. code-block:: console |
| 55 | |
| 56 | $ virsh console iperf-server3 |
| 57 | Connected to domain iperf-server3 |
| 58 | Escape character is ^] |
| 59 | |
| 60 | Ubuntu 16.04.3 LTS iperfvm ttyS0 |
| 61 | ..... |
| 62 | |
| 63 | root@iperfvm:~# ping 10.0.0.2 |
| 64 | 64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.285 ms |
| 65 | 64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.154 ms |
| 66 | 64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=0.159 ms |
| 67 | 64 bytes from 10.0.0.2: icmp_seq=4 ttl=64 time=0.208 ms |
| 68 | |
| 69 | |
| 70 | On VPP you can now see the packet counts increasing. The packets from the VM are seen as **rx packets** |
| 71 | on **VirtualEthernet0/0/0**, they are then bridged to **TenGigabitEthernet86/0/0** and are seen leaving the |
| 72 | system as **tx packets**. The reverse is true on the way in. |
| 73 | |
| 74 | .. code-block:: console |
| 75 | |
| 76 | vpp# sh int |
| 77 | Name Idx State Counter Count |
| 78 | TenGigabitEthernet86/0/0 1 up rx packets 16 |
| 79 | rx bytes 1476 |
| 80 | tx packets 14 |
| 81 | tx bytes 1260 |
| 82 | TenGigabitEthernet86/0/1 2 down |
| 83 | VirtualEthernet0/0/0 3 up rx packets 14 |
| 84 | rx bytes 1260 |
| 85 | tx packets 16 |
| 86 | tx bytes 1476 |
| 87 | local0 0 down |
| 88 | vpp# |