Amazon EC2 is the well-known and maybe the most popular public cloud in the world; in EC2 classic, users can create a VM instance with a private IP address, and acquire an elastic IP(EIP) that is usually a public IP and can be dynamically bound to the VM. If there are more than one VMs, users can unbind and bind the EIP to VMs on demand.
In this example, we will create a deployment that has a public network a private network, and that allows users to bind an EIP created from the public network to VM nics that are on the private network.
We assume you have followed installation guide to install ZStack on a single Linux machine, and the ZStack management node is up and running. To access the web UI, type below URL in your browser (Please use latest Chrome or Firefox browser.):
http://your_machine_ip:5000/
To make things simple, we assume you have only one Linux machine with one network card that can access the internet; besides, there are some other requirements:
sudo su
passwd root
Based on those requirements, we assume below setup information:
open browser with URL(http://your_machine_ip:5000/) and login with admin/password:
click 'Hardware' in the left sidebar and then click 'Zone'to enter the zone page:
click button 'Create Zone' to open the dialog:
name your first zone as 'ZONE1' and click button 'OK':
click 'Cluster' in the left sidebar to enter the cluster page:
click button 'Create Cluster' to open the dialog:
name the cluster as 'CLUSTER1' then click button 'OK':
click 'Host' in the left sidebar to enter host page:
click 'Create Host' button to open the dialog:
click 'PrimaryStorage' in the left slider to enter primary storage page:
click button 'Adc PrimaryStorage' to open the dialog:
click 'BackupStorage' in left sidebar to enter backup storage page:
click button 'Add BackupStorage' to open the dialog:
Input ssh port(22), input SSH credentials for user root, and click button 'OK':
click 'Resource Pool' in left sidebar and click 'Image' to enter image page:
click button 'Add Image' to open the dialog:
this image will be used as user VM image.
click 'Network' in left sidebar and click 'L2Network' to enter L2 network page:
click button 'Create L2Network' to open the dialog:
click 'Create L2Network' again to create the private L2 network:
click 'L3Network' in left sidebar to enter L3 network page:
click 'Public Network' in sidebar to enter L3 public network page:
click button 'Create Public Network' to open the dialog:
Name the L3 network as 'L3Neywork-public' and select L2Network 'L2Network-private'
Input DNS as '8.8.8.8' and click button 'OK'
click 'Virtual Router' in left sidebar and click 'Virtual Router Image' to enter virtual router image page:
click button 'Add Virtual Router Image' to open the dialog:
http://cdn.zstack.io/product_downloads/vrouter/zstack-vrouter-2.0.0.qcow2
click 'Virtual Router Offering' in the left sidebar to enter virtual router offering page:
click 'Create Virtual Router Offering' to open the dialog:
Choose management L3 network 'L3Network-public' , choose public L3 network 'L3Network-public' and click button 'OK'
click 'Network' in the left sidebar, click 'L3Network' and click 'Private Network' to enter L3Network private network page:
click 'Create Private Network' button again to create the private L3 network:
click 'Resource Pool' in the left sidebar and click 'InstanceOffering' to enter instance offering page:
click button 'Create InstanceOffering' to open the dialog:
click 'Resource Pool' in the left sidebar and click 'VmInstance' to enter VM instance page:
click button 'Create VmInstance' to open the dialog:
once the VM is created successfully, click button 'VM1' and then click button 'VMInstance Actions',finnally click item 'Console' to open VM's console:
in the popup window, login the VM by username: root and ping google.com, it should ping successfully:
and by the 'ifconfig' command, you should see the private IP address:
click 'Network' in the left sidebar, click 'Network Service' and then click 'EIP' to enter the EIP page:
click button 'Create EIP' to open the dialog:
once it finishes, you should be able to see the result in EIP page; in our case, the EIP is '10.121.9.98':
use on machine that can reach subnet 192.168.1.0/24 to SSH the IP '10.121.9.98', you should be able to login the VM:
follow instructions in section 11. Create Virtual Machine to create another VM(VM2) on the private L3 network:
go to EIP page, select the EIP1 and click button 'Action'; then in the dropdown box, click item 'Detach' and confirm:
after detaching, click button 'Action' again and select item 'Attach', in the dialog, choose VM2 this time and click button 'Attach':
SSH login to the EIP '10.121.9.98' again and run command 'hostname', you should see the hostname 'vm2', which proves the EIP has been successfully rebound to VM2.