參考資料:
https://blog.csdn.net/cndmss/article/details/80149952
1.建立VM
2.網路配置為NAT,取消DHCP
3.依據VMware NAT裡的子網設定修改 /etc/network/interfaces,重啟網路
e.g.
auto eth0
iface eth0 inet static
address 192.168.152.101
netmask 255.255.255.0
gateway 192.168.152.2
dns-nameservers 8.8.8.8
sudo /etc/init.d/networking restart
sudo ip addr flush dev eth0
sudo ifdown eth0
sudo ifup eth0
4.關機後建立快照,複製所需其餘節點
5.修改節點ip
6.修改 /etc/hostname 和 /etc/hosts
e.g.
127.0.1.1 node-s1
7.安裝openssh-server
sudo apt-get install openssh-server
8.修改/etc/ssh/sshd_config ,修改為PermitRootLogin yes
9.重啟SSH
sudo /etc/init.d/ssh restart
成功建立一個可互聯也可外聯的子網群集