Original address: http://www.wangdk.com /? P = 63
The following content is to create an isolated guest Network (not a network in the VPC) in the advance zone of cloudstack. vlan id: 305. The VM template is Ubuntu 10.04,
Flowchart
The main process for creating VMS and Vm communication.
When you see the flowchart, you should be clear about what is going on. Some of your summary may be incorrect. If you have any objection, you can discuss it.
Problems encountered during verification and conclusions
1. Each isolated guest network has a separate vrouter Virtual Machine providing the gateway service. Different VLANs can have the same subnet.
2. When a VM is created using an isolated guest network, a vrouter virtual machine is created for the network. The host where the vrouter is located and the host where the newly created VM is located wear VLAN interfaces, as shown in: (the system allocates vlan id: 305 to the network, and the isolated network is 192.168.1.1/24)
2.1 when creating a virtual machine in an isolated network, first create the vrouter virtual machine corresponding to the network. The NIC information of the vrouter virtual machine is:
[[NIC: Public-10.41.2.233-vlan: // untagged], [NIC: Guest-192.168.1.1-vlan: // 305], [NIC: Control-169.254.3.76-null]
2.2 configure the MAC address and IP address of the VM to be created to the vrouter VM.
Execute the function:
Com.cloud.agent.resource.virtualnetwork.virtualroutingresource.exe cute (dhcpentrycommand)
Execute the script dhcp_entry.sh. The final execution script is/root/edithosts. Sh on the vrouter Virtual Machine (this script is mainly used to configure DHCP, which is not described in this article)
2.3 create a VM with Nic information: [NIC: Guest-192.168.1.113-vlan: // 305], but this IP address is used, the IP address of the VM is obtained from the vrouter VM (obtained based on the MAC address of the newly created VM)
2.4
When starting the VM, a VLAN interface will be created on the host HOST: function:
Com. Cloud. hypervisor. KVM. Resource. libw.computingresource. createvifs (virtualmachineto, libw.vmdef)
Get vlanid using script modifyvlan. Sh (incoming parameters (305, eth0, breth0-305, VLAN) Create VLAN Interface on host (breth0-305, eth0.305)
Where 305 is the vlanid of the network, and eth0 is the physical interface corresponding to the private network on the machine.
Nic parameters passed to the agent:
2.5 important code in script modifyvlan. Sh
Vconfig set_name_type dev_plus_vid_no_pad
Vconfig add $ PIF $ vlanid // ($ PIF = eth0 $ vlanId-305) eth0 network port increase VLAN 305
Brctl addbr $ vlanbr // ($ vlanbr = br0eth0-305) add bridge br0eth0-305
Brctl addif $ vlanbr $ vlandev // ($ vlanbr = br0eth0-305 $ vlandev = eth0.305) Use eth0.305 as a port of the bridge br0eth0-305, that is, all traffic destined for eth0.305, will be treated as the destination for the br0eth0-305, and when the traffic flow through the br0eth0-305, all traffic will be treated as Outbound from the eth0.305 network port.