2016年8月2日 星期二

建立自己的 Private Network, 使用自己建立的虛擬網卡

建立自己的 Private Network, 使用自己建立的虛擬網卡


Googledoc


Point
  • 不希望連到外面的 Internet.
  • 使用自己建立的 虛擬 nic

Step 1: Create virtual nic
sudo ip tuntap add mode tap my_net0


ex:


Before
Fig. 1. The original nic list before creating the virtual nic.


After
Fig. 2. Show the new tap nic my_vnet0.


Step 2: Enable the nic
sudo ip link set my_vnet0 up


Ex:
Fig. 3. The vritual nic was enabled.

Verification

VM1

Step 1:  bridge to the new virtual nic, my_vnet0


Step 2: Setup to the private network
ifconfig eth0 192.168.100.100


VM2

Step 1: bridge to the new virtual nic, my_vnet0
Step 2: Setup to the private network
ifconfig eth0 192.168.100.101


Ping Test