在一个单一的互联星空/子网ReservedIPs对Azure的虚拟机 [英] ReservedIPs for Azure VMs in a single VNet/subnet

查看:408
本文介绍了在一个单一的互联星空/子网ReservedIPs对Azure的虚拟机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经运行在Azure上一个互联星空8的虚拟机(基于Linux)。如果我跑这说明我机器的状态,或显示了一些常见的细节是特定的虚拟机在同一端口上服务两个虚拟机。例如说

I've 8 VMs (linux based) running a single VNet on Azure. If I've two VMs running a service on the same port which shows me machine status or shows some common details which is specific to the VM. Say for example

VM-1运行已经部署的VM-2 8080端口,同一样的服务的服务即同一端口8080上运行,对服务的访问端口8080上运行,我通过VM-1打开一个端口终点。我能够从Web浏览器通过VM-1使用servicename.webapp.net:8080访问8080。但如果我要检查VM-2的状态,我不能够打开端口8080上VM-2。大概是因为端口被打开的服务水平,而不是虚拟机级。有没有一种方法,我可以在虚拟机级打开端口并使用VM-X:端口

VM-1 runs a service on 8080 port and same same service has been deployed on VM-2 which runs on the same port 8080. To access to a service running on port 8080 I am opening a port on VM-1 through end points. I am able to access 8080 from web browser through VM-1 using servicename.webapp.net:8080. But If I want to check the status of VM-2, I am not able to open the port 8080 on the VM-2. Probably because the port is opened at the service level and not the VM level. Is there a way I can open the port at the VM level and use VM-x:port?

我想这可能是有用的另一种方法是:分配staticIP / ReservedIP到每一个VM,并打开各个机器的端口应该是可能的,而不是开放的端口在互联星空/服务水平。是有可能的静态/保留的IP一旦被启动,并且运行分配给机器的所有8?我们还需要确保的是,重启后的8台机器保持相同的IP地址。

Another approach I thought which could be useful is : Assign the staticIP/ReservedIP to each of the VM and open the port on individual machines should be possible, instead of open the port at the VNet/service level. Is it possible to assign static/reserved IP to all 8 of the machines once they have been started and operational? And we also need to make sure that, after restart all the eight machines retain the same IPs.

我试过以下博客的https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-reserved-public-ip/并尝试下面的命令:

I tried following blog https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-reserved-public-ip/ and tried following command :

$image = Get-AzureVMImage|?{$_.ImageName -like "*AMI-20150919-849187*"} 
New-AzureVMConfig -Name StaticIPVMCOnfig -InstanceSize Small -ImageName $image.ImageName 
-CurrentStorageAccountName "myStorageACName" 
| Add-AzureProvisioningConfig -Linux -LinuxUser root -Password MyP@ssword! 
| New-AzureVM -ServiceName myCloudServiceName -ReservedIPName MyReservedIP 
-Location "West Europe"

我仍然看到新的虚拟机是越来越有相同的VIP相同的其他虚拟机在互联星空推出。我不知道如果我失去了一些东西。

I still see the new VM is getting launched with same same VIP as the other VMs in the VNet. I am not sure if I am missing something.

附加的截图一个不带静电/ reservedIP的cmdlet创建的。另一种是从PowerShell的创建。两者共享相同的VIP。

Attaching the screenshots one is created without static/reservedIP CMDlets. Another is created from PowerShell. Both share the same VIP.

此虚拟机之前创建的PowerShell没有或reservedIPs

此虚拟机使用PowerShell创建。
可能有人请这方面的帮助?

Could someone please help with this?

PS:故意我保持公众贵宾,表明他们是一样的。 (我已经关闭,而不是使用这项服务了)。

PS: Intentionally I am keeping the public VIPs to show that they are same. (I've closed and not using this service anymore).

谢谢,
JE

Thanks, JE

推荐答案

是的,你可以静态IP使用PowerShell命令分配给虚拟机 -

Yes you can assign static IP to to the VMs using powershell command-

get-azurevm -servicename "testservice" -name "testvm" | Set-AzureStaticVNetIP -IPAddress "10.87.96.41" | Update-AzureVM

接下来的事情就是你要确保当实例进入停止状态不会丢失的IP。为此,您可以做的是定义明确的参数 StayProvisioned 在PowerShell中停止蔚蓝VM命令 -

Next thing is you want to make sure you don't lose the IP when instance goes to stopped state. For this what you can do is define explicit parameter StayProvisioned with the stop azure vm command in powershell-

stop-azurevm -ServiceName "testservice" -Name "testvm" -StayProvisioned

StayProvisioned不允许IP,即使虚拟机已停止被释放。

StayProvisioned doesn't allow IP to be freed even if VM is stopped.

如果您正在寻找VM的公共IP -

If you are looking for public IP of VM-

每一个虚拟机自动分配一个免费的公共虚拟IP(VIP)地址

"Every Virtual Machine is automatically assigned a free public Virtual IP (VIP) address"

为了找出公共IP goto- Azure的门户网站,那么你的虚拟机控制台。在这里,在右侧可以看到一个快速浏览标签中,您将可以看到公网IP下。快照供大家参考 -

In order to find out the public ip goto- Azure portal and then your VM dashboard. Here at the right side you see a quick glance tab under which you will be able to see the public IP. Snapshot for your reference-

在这里输入的形象描述

您可以使用此公网IP直接连接使用RDP的虚拟机。中使用PowerShell您可以使用下面的命令为同一个。

You can use this public ip to directly connect to vm using RDP. Using powershell you can use below command for the same.

Get-AzureVM -ServiceName "testservice" -Name "testvm" | select PublicIPAddress

注意 - 公共IP将是无效的,如果实例处于停止状态。要知道更多的公网IP​​,你可以阅读 -

NOTE - Public IP will be null if instance is in stopped state. To know more on public IP you can read this-

<一个href=\"https://azure.microsoft.com/en-in/documentation/articles/virtual-networks-instance-level-public-ip/\" rel=\"nofollow\">https://azure.microsoft.com/en-in/documentation/articles/virtual-networks-instance-level-public-ip/

这篇关于在一个单一的互联星空/子网ReservedIPs对Azure的虚拟机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆