VMwareVMware vCloud Director
vCloud Director 5.x PowerCli ile External Network oluşturma
Merhaba,
Önceki vCloud Director yazımda sizlere vCloud Director üzerindeki External network ile ilgili çeşitli bilgiler vermiştim. vCloud Director üzerinden oluşturabileceğiniz External network’u isterseniz PowerCli kullanarak’da oluşturabilirsiniz.
Connect-CIServer -server vcloud.tayfundeger.local -User Administrator -Password xxxxx
Yukarıdaki komut ile vCloud Director’a bağlanıyoruz.
$dvPG = "Production-VMs" $vCSName = "VCS1" $vcloud = $DefaultCIServers[0].ExtensionData $admin = $vcloud.GetAdmin() $ext = $admin.GetExtension() $mynetwork = new-object vmware.vimautomation.cloud.views.VMWExternalNetwork $mynetwork.Name = "External_Network_1" $mynetwork.Description = "My First External Network" $vCenter = Search-Cloud VirtualCenter | Get-CIView | where {$_.name -eq $vCSName} $dvpg = get-view -viewtype DistributedVirtualPortGroup | where {$_.name -like $dvPG} write-host "vCenter href: "$vCenter.href write-host "dvPG Key: " $dvPG.key $mynetwork.VimPortGroupRef = new-object VMware.VimAutomation.Cloud.Views.VimObjectRef $mynetwork.VimPortGroupRef.MoRef = $dvPG.key #$mynetwork.VimPortGroupRef.VimObjectType = "NETWORK" $mynetwork.VimPortGroupRef.VimObjectType = "DV_PORTGROUP" $mynetwork.VimPortGroupRef.VimServerRef = new-object VMware.VimAutomation.Cloud.Views.Reference $mynetwork.VimPortGroupRef.VimServerRef.href = $vCenter.href #$mynetwork.VimPortGroupRef.VimServerRef.type = "application/vnd.vmware.admin.vmwvirtualcenter+xml" $mynetwork.Configuration = new-object VMware.VimAutomation.Cloud.Views.NetworkConfiguration $mynetwork.configuration.fencemode = "isolated" $mynetwork.Configuration.IpScopes = new-object VMware.VimAutomation.Cloud.Views.IpScopes $mynetwork.Configuration.IpScopes.IpScope = new-object VMware.VimAutomation.Cloud.Views.IpScope $mynetwork.Configuration.IpScopes.ipscope[0].Gateway = "192.168.1.1" $mynetwork.Configuration.IpScopes.ipscope[0].Netmask = "255.255.255.0" $mynetwork.Configuration.IpScopes.ipscope[0].IsInherited = "False" $mynetwork.Configuration.IpScopes.ipscope[0].ipranges = new-object vmware.vimautomation.cloud.views.ipranges $mynetwork.Configuration.Ipscopes.ipscope[0].ipranges.iprange = new-object vmware.vimautomation.cloud.views.iprange $mynetwork.Configuration.IpScopes.ipscope[0].IpRanges.IpRange[0].startaddress = "192.168.1.200" $mynetwork.Configuration.IpScopes.ipscope[0].IpRanges.IpRange[0].endaddress = "192.168.1.240" $result = $ext.CreateExternalNet($mynetwork) $result
Yukarıdaki script’de bazı bölümleri kendinize göre düzenlemeniz gerekiyor. Portgroup, External network name, External network Description ve IP aralıklarını kendinize göre düzenlemeni unutmayın.
Umarım faydalı olmuştur.
İyi çalışmalar.