Azure VM: More than one Public IP

后端 未结 7 1085
予麋鹿
予麋鹿 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: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.

提交回复
热议问题