Azure VM: More than one Public IP

后端 未结 7 1031
予麋鹿
予麋鹿 2021-01-01 05:51

Can anyone confirm if Azure VM allows more than one Public IP? We want to host multiple website on single VM and hence want to have different IP for each website. I know we

相关标签:
7条回答
  • 2021-01-01 06:41

    You would need a different Cloud Service (either Web Role or Virtual Machine) to have different IP addresses. Yes, this will increase overall cost.

    The VIP (public IP) for Windows Azure Web Roles and VMs is assigned at the Cloud Service level. Think of a Cloud Service as a logical container - it can contain web/worker roles or VMs (not both currently).

    0 讨论(0)
  • 2021-01-01 06:42

    You can only have one public IP address per deployment. So if you had 3 VMs in a single deployment, they'd share IP address. You can then choose to load-balance traffic across the instances or direct traffic to a particular VM (or role in cloud services) for a specific port number.

    You can use host headers and support multiple websites in a single VM.

    0 讨论(0)
  • 2021-01-01 06:45

    You can add multiple IP addresses for a cloud service. Since the VM's are "inside" the cloud service, this gives you in a way multiple public IP addresses for a virtual machine. The procedure is documented at [1]. Additional addresses currently cost about $3/month.

    Here's the steps to add a new reserved IP address to a cloud service.

    First create a new reserved IP address:

    New-AzureReservedIP –ReservedIPName "MyIPAddress"  –Location "West Europe"
    

    Associate the IP address with cloud service:

    Add-AzureVirtualIP -VirtualIPName MyIPAddress -ServiceName MyCloudService
    

    Create endpoint that maps the IP address to a virtual machines. If you have multiple vm's and want load balancer, repeat this for each vm. In order to run multiple web sites, you would put each website to different port (the localport). The endpoint listens for connections on the public port and forwards them to the virtual machine's localport.

    Get-AzureVM -ServiceName MyCloudService -Name myserver `
    | Add-AzureEndpoint -Name QuvastoMail -Protocol tcp `
          -LocalPort 8002 -PublicPort 80 -VirtualIPName MyIPAddress `
    | Update-AzureVM
    

    [1] http://azure.microsoft.com/en-us/documentation/articles/load-balancer-multivip/

    0 讨论(0)
  • 2021-01-01 06:46

    It appears you can now have multiple public IPs for a load balanced cloud service:

    http://azure.microsoft.com/en-gb/updates/multiple-vips-per-cloud-service/

    Now you can assign more than one load-balanced public IP address to a set of virtual machines, enabling high-availability and high-scale scenarios. You can host multiple secure websites in a cloud service or allow multiple SQL Server AlwaysOn Availability Group listeners to access the same set of virtual machines.

    For more information, please vistit the Load Balancer page. There is no additional charge for this feature.

    0 讨论(0)
  • 2021-01-01 06:52

    In addition to the earlier answer about Cloud Services, it is now possible to have multiple IP addresses on an Azure VM. https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-multiple-ip-addresses-portal

    0 讨论(0)
  • 2021-01-01 06:53

    Very possible, very easy actually.

    1. Have your apps listening at your Azure Resource Managed VM, let's say ports 3001, 3002, 3003..

    2. Then create an Load Balancer (just search it).

    3. Create a Public IP Address.
    4. Add it at your Load Balancer's Front-end Pool
    5. Add your VM to your Load Balancer's Back-end Pool
    6. at Inbound NAT rules of your Load Balancer, click "Add"
    7. Select your frontend IP, your VM's network IP configuration, protocol, port and mapped port (click "Custom") to set a custom port.

    Sample: - You want your newly created public ip "52.165.147.25" to route to your vm's port 3001. - On config that will be port 80 tcp, then port 3001 on mapped port. - No need to enable "Floating IP (direct server return)" in case you see it.

    PS: On linux VM's you might have to "Optimize Your Network Kernel Parameters"..

    Check here (scroll at bottom): http://docs.fluentd.org/v0.12/articles/before-install

    sudo nano /etc/sysctl.conf
    

    Add these entries:

    net.ipv4.tcp_tw_recycle = 1
    net.ipv4.tcp_tw_reuse = 1
    net.ipv4.ip_local_port_range = 10240    65535
    

    Note the spaces, crucial.

    Save it.

    sudo sysctl -p
    

    Done.

    EDIT:

    On the above steps you might have to also take care of CORS (Just google it)

    Also, Another alternative I forgot to mention is to add NIC's / Network Interfaces to ya VM's. That won't be a viable option though because of azure max-nic-per-vm limits.

    0 讨论(0)
提交回复
热议问题