CS3611 Lab 4

王梓萌 521030910015

Problem 1

image-20230519000809480

Solution

For VM1 the code should be:

1
2
3
4
5
6
7
8
9
10
11
12
# Create bridge and add port
sudo ovs-vsctl add-br br1
sudo ovs-vsctl add-port br1 enp0s8

# Set IP address on bridge interface
sudo ifconfig br1 192.168.56.101/24 up

# Add default route for bridge
sudo ip route add default via 192.168.56.1 dev br1

# Build VXLAN tunnel to remote host
sudo ovs-vsctl add-port s1 vxlan0 -- set interface vxlan0 type=vxlan options:remote_ip=192.168.56.102

Similarly, for VM2 the code should be:

1
2
3
4
5
6
7
8
9
10
11
12
# Create bridge and add port
sudo ovs-vsctl add-br br1
sudo ovs-vsctl add-port br1 enp0s8

# Set IP address on bridge interface
sudo ifconfig br1 192.168.56.102/24 up

# Add default route for bridge
sudo ip route add default via 192.168.56.1 dev br1

# Build VXLAN tunnel to remote host
sudo ovs-vsctl add-port s1 vxlan0 -- set interface vxlan0 type=vxlan options:remote_ip=192.168.56.101

Problem 2

image-20230519005317706

Solution

The screenshot of Wireshark on s1 and enp0s8 is as follow:

image-20230519010119663

From the screenshot, I select an ICMP packet to analyze. We can see that from from the first 4 line, we can recognize many familiar protocols. The protocols in physical layer and link layer are not that important because we are running on a virtual environment. In the Network layer, we see IPv4 and ICMP being used in this packet, In the transport layer, we see UDP being utilized. Also in this layer we finally see VXLAN protocol, which is an encapsulation protocol that allows the creation of virtual Layer 2 networks over a Layer 3 infrastructure.

VXLAN works in the following ways:

  1. Encapsulation: When a node in the VXLAN network wants to send a packet to another node, it encapsulates the original Ethernet frame inside a VXLAN packet. This VXLAN packet is then encapsulated inside a UDP datagram, and this UDP datagram is further encapsulated inside an IP packet.
  2. Transport: The encapsulated packet is then sent across the IP network. The IP network only sees the outer IP and UDP headers and routes the packet based on these headers.
  3. Decapsulation: When the packet reaches the destination node, it decapsulates the packet to extract the original Ethernet frame. The Ethernet frame is then processed as normal.

The VLAN-like encapsulation technique also encapsulate Layer 2 Ethernet frames within Layer 4 UDP datagrams, thus enabling Layer 2 segments to be created over Layer 3 networks and use layer 3 to guide its way towards the target host. That is why VXLAN can reaches destinations across different LANs, surpassing the duty of purely Layer 2.

In addition, the VXLAN header, which includes a 24-bit VXLAN Network Identifier (VNI), segregates different VXLAN overlay networks from each other, so the same IP subnet can be used across different VNIs without conflict.

That is my brief answer to how VXLAN works.

Problem 3

image-20230519013730593

Solution

In the default condition, the bandwidth between s1 and s2 are awful.

image-20230519014134228

The screenshot above shows that the receiver side bandwidth is close to zero, which is abnormal because we had set up a VXLAN between them.

The reasons may be because the VXLan protocol will encapsule the original udp datagram which may increase the packet size. Therefore we have to decrease the messages encapsuled inside VXLAN so that after encapsulation the packet can be sent via the Link.

Problem 4

  1. We can use iperf3 -c 10.0.0.1 -M <MTU_Length> to restrict the length of MTU in iperf3 command.

    When using default MTU size, we get the following result:

    image-20230527193913025

    Setting MTU to be bigger won’t help increase the badnwidth, the reason is also because of the encapsulation of VXLAN and the capacity of our link.

    When we set MTU size to 100, we get the following result:

    image-20230527194206637

    We get a much better result. The -M command VXLAN control the MSS of TCP segmentation. Therefore setting the MSS to be smaller helps reduce the retransmition rate and thus increase the resulted bandwidth.

    It is worth noticing that setting MTU size to be too small reasonably reduce the bandwith, because in this case too many bandwidth are used to transfer controlling messages like headers of datagrams.

  2. We use sudo ifconfig enp0s8 mtu <num> to dictate the mtu size of our network adaptor enp0s8.

    We set the mtu to 9000, and test the bandwidth using iperf3 under default configuration. The result is as follow:

    image-20230527200137893

    image-20230527200212045

    image-20230527195659003

    The bandwidth is much bettwe. As is discussed before, by increasing the MTU allowed to sent via the link, we can encapsule l larger message in the VXLAN packet without worring the retransmission, and thus exploting better use of the link.