> For the complete documentation index, see [llms.txt](https://eric-zhang-seattle.gitbook.io/mess-around/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eric-zhang-seattle.gitbook.io/mess-around/network-components/cloud-network-todo.md).

# 云中网络-TODO

* [Network in the cloud](#network-in-the-cloud)
  * [Virtualization networkcard](#virtualization-networkcard)
    * [Flowchart](#flowchart)
    * [Share access](#share-access)
      * [Connect internally](#connect-internally)
      * [Connect to the outside](#connect-to-the-outside)
        * [Network bridging](#network-bridging)
        * [NAT](#nat)
    * [Separation access](#separation-access)
  * [Overlay network](#overlay-network)
    * [Motivation](#motivation)
    * [Definition](#definition)
    * [Approaches](#approaches)
      * [GRE - Generic Routing Encapsulation](#gre---generic-routing-encapsulation)
      * [VXLAN](#vxlan)
  * [SDN](#sdn)
    * [Use cases](#use-cases)
    * [OpenFlow and Openvswitch](#openflow-and-openvswitch)
  * [References](#references)

## Network in the cloud

### Virtualization networkcard

#### Flowchart

* The steps are shown in the graph below:
  1. Virtual machine could open a char dev file called TUN/TAP.
  2. After opening this file, a virtual network card driver will be seen on the physical machine.
  3. This virtual network card will intercept network packets and send it through TCP/IP.
  4. The virtual network card tap0 will send network packets.

![](/files/yGR61O8lRuCiygG41Y3r)

#### Share access

**Connect internally**

1. Use the Linux command to create an ethernet bridge

> brctl addbr br0

1. Connect two virtual network card to br0

![](/files/dQUOFjAc30CdlDcDxR3T)

**Connect to the outside**

**Network bridging**

* Def: Virtual machine and physical machine will share the same IP address.

![](/files/CXNKsmevPvFuZthI5XcR)

![](/files/-Mk8h-KpnGYMLL1dsch6)

* Within cloud, the virtual machines inside Linux also share the same address as physical machines.

![](/files/KEk6VcBiIBBdQtYHPNx3)

![](/files/MMEKOrfwyjVCj1LCS7Iv)

* Cons: When there is a large scale of machines, broadcast will be a problem because each virtualized machine needs to be broadcasted.

**NAT**

* Def: Virtual machines will have different ip address as physical machines.

![](/files/pL3LxrYt3mS9eDFfgT2p)

* A DHCP server will be created for assigning ip addresses to virtual machines dynamically.

![](/files/-Mk8h-KtOPK5KPs1oALK)

#### Separation access

* Approach: create VLAN based on physical network card eth0

> vconfig

* Within the same machine, there is no connectivity between network bridges.
* Across machines, as long as physical bridge support VLAN, there will be no connectivity between different VLANs.

![](/files/RikUGnSgaT88tf82uf0u)

### Overlay network

#### Motivation

* Limitation of VLAN: Only has 12 bits and a capacity of 4096.
* Possible solutions
  * Modify the VLAN protocol.
  * Extend the protocol by adding an additional header.

#### Definition

* Underlay network: Physical network
* Overlay network: Virtual network implemented on top of underlay network.

#### Approaches

**GRE - Generic Routing Encapsulation**

* Idea: It increases the number of VLAN ID by the way of tunnel.

![](/files/-Mk8h-KvZK8kmdtDx8Hz)

* Example

![](/files/Ro79dxp7vvik4l7bzzgE)

* Limitation:
  * The number of tunnels
  * It does not support group cast.

**VXLAN**

* Idea:

![](/files/-Mk8h-Kx4ZpN8o4JfGh1)

### SDN

#### Use cases

* Control and forward

![](/files/AFJSe9LBpZhRCBwGBfFf)

#### OpenFlow and Openvswitch

* SDN controller administrates the network by OpenFlow protocol.

![](/files/58Isk8LuoOaMNkDhjSgT)

* Within the Openvswitch, there is a flow table which defines flow rules.

![](/files/-Mk8h-L-BhPRWCte3ryL)

### References

* [趣谈网络协议](https://time.geekbang.org/column/article/10742)
