2016年8月2日 星期二

建立自己的 Private Host-Only Network, 使用自己建立的 Host-only 專用虛擬網卡

建立自己的 Private Host-Only Network, 使用自己建立的 Host-only 專用虛擬網卡


Googledoc


(Edit)


如果你的所有 VM 交互協作都在同一台 host 裡面, 哪麼就很適合使用 Host-Only Private Network, 建構彼此溝通的渠道


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

Step 1: Create a Host-Only 虛擬網卡

Command
VBoxManage hostonlyif create


Ex:
Fig. 1. A new host-only nic was created. (Because I have vboxnet0 and vboxnet1)




Step 2: Enable the nic

sudo ip link set vboxnet0 up


Step 3: Attach VM to the private network

Vm1

Step 1: Attach to the virtual host-only nic


Step 2: Setup IP
ifconfig eth0 192.168.100.100


The other VM
Step 1: Attach to the virtual host-only nic


Step 2: Setup IP
Ifconfig eth0 192.168.100.101


Verification

ping 192.168.100.101

References