您好,登錄后才能下訂單哦!
在前兩篇的博客中主要講解了對(duì)VIP的固定,VIP是針對(duì)云服務(wù),而有時(shí)我們需要針對(duì)虛擬機(jī)的固定,比如當(dāng)我做FTP服務(wù)器的時(shí)候,如果使用VIP的話,我們需要在外部防火墻內(nèi)針對(duì)主動(dòng)可被動(dòng)端口開(kāi)啟許多,給我們的部署帶來(lái)了許多的麻煩,這時(shí)候PIP就比較適合我們了,PIP可以直接穿透外部防火墻到虛擬機(jī),不在單獨(dú)在外部防火墻中開(kāi)啟這么多的端口,但是PIP的這個(gè)特性也決定了他的不安全性,同時(shí)PIP 在固定但是虛擬機(jī)重啟后也會(huì)改變,這是我們?cè)谑褂脮r(shí)也是需要特別注意的。
廢話不多少了,直接開(kāi)始動(dòng)手實(shí)驗(yàn)吧:
創(chuàng)建虛擬機(jī)并得到一個(gè)VIP
2. 從公網(wǎng)申請(qǐng)PIP地址并分配給現(xiàn)有的VM Instance
3. 查看PIP
4. VM重啟
5. 再次查看PIP,IP已經(jīng)發(fā)生了改變
備注:及時(shí)PIP使用powershell固定后VM重啟也會(huì)改變
在新建VM時(shí)保留PIP
(1)首先使用命令從公網(wǎng)獲得一個(gè)PIP
PS C:\> New-AzureReservedIP –ReservedIPName "JEFFPIP" –Label "jeffPIP" –Location "China North"
詳細(xì)信息: 18:54:18 - Begin Operation: New-AzureReservedIP
詳細(xì)信息: 18:54:51 - Completed Operation: New-AzureReservedIP
OperationDescription OperationId OperationStatus
-------------------- ----------- ---------------
New-AzureReservedIP b882b7f3-8661-4d37-a92a-8360ba520cd1 Succeeded
(2)查看成功獲得的PIP
PS C:\> Get-AzureReservedIP
詳細(xì)信息: 18:55:52 - Begin Operation: Get-AzureReservedIP
詳細(xì)信息: 18:55:53 - Completed Operation: Get-AzureReservedIP
ReservedIPName : JEFFPIP
Address : 139.219.14.132
Id : 35b80824-29b8-4491-bd10-2fec1922048a
Label : jeffPIP
Location : China North
State : Created
InUse : False
ServiceName :
DeploymentName :
OperationDescription : Get-AzureReservedIP
OperationId : a1b79933-22f2-4a15-a2ea-61b94764e066
OperationStatus : Succeeded
(3)使用映像或者磁盤在創(chuàng)建VM的時(shí)候使用此PIP(這里主要演示使用映像創(chuàng)建的)
PS C:\> New-AzureVMConfig -Name 'centos' -InstanceSize Small -ImageName jeffcentos-20150402-800866 | Add-AzureProvisioni
ngConfig -Linux -LinuxUser "azureuser" -Password "P@ssw0rd123" | New-AzureVM -ServiceName "testpip" –ReservedIPName "JEF
FPIP" -VNetName 'chinnort'
警告: Subnet should be specified when deploying VMs in a VNET: centos
詳細(xì)信息: 19:03:16 - Begin Operation: New-AzureVM - Create Deployment with VM centos
詳細(xì)信息: 19:04:23 - Completed Operation: New-AzureVM - Create Deployment with VM centos
OperationDescription OperationId OperationStatus
-------------------- ----------- ---------------
New-AzureVM 03626a98-22ed-45b0-bd3f-5c8f66a57067 Succeeded
(4)查看已經(jīng)使用PIP的VM
PS C:\> Get-AzureReservedIP
詳細(xì)信息: 19:09:16 - Begin Operation: Get-AzureReservedIP
詳細(xì)信息: 19:09:19 - Completed Operation: Get-AzureReservedIP
ReservedIPName : JEFFPIP
Address : 139.219.14.132
Id : 35b80824-29b8-4491-bd10-2fec1922048a
Label : jeffPIP
Location : China North
State : Created
InUse : True
ServiceName : testpip
DeploymentName : testpip
OperationDescription : Get-AzureReservedIP
OperationId : c2494b48-d504-4535-b885-ee45043dd785
OperationStatus : Succeeded
備注:在我們創(chuàng)建的時(shí)候有時(shí)候會(huì)遇到下面這個(gè)錯(cuò)誤:
PS C:\> New-AzureVMConfig -Name 'centos' -InstanceSize Small -ImageName jeffcentos-jeffcentos-0-201504020640350599 | Add-AzureProvisioningConfig -Linux -LinuxUser "azureuser" -Password "P@ssw0rd123" | New-AzureVM -ServiceName "testpip" –ReservedIPName "JEFFPIP" -VNetName 'chinnort'
New-AzureVMConfig : Must specify MediaLocation or set a current storage account using Set-AzureSubscription.
所在位置 行:1 字符: 1
+ New-AzureVMConfig -Name 'centos' -InstanceSize Small -ImageName jeffcentos-jeffc ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureVMConfig], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.NewAzure
VMConfigCommand
主要使我們?cè)诖擞嗛喯掠卸鄠€(gè)存儲(chǔ)賬號(hào),這里是要求你制定一個(gè)存儲(chǔ)賬號(hào)來(lái)存儲(chǔ)VM,使用一下辦法解決
PS C:\> Set-Set-AzureSubscription -SubscriptionName "訂閱賬號(hào)" -CurrentStorageAccountName "存儲(chǔ)賬號(hào)"。
查看存儲(chǔ)賬號(hào):Get-AzureStorageAccount
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。