TCP vs UDP in load balancing rule with Azure Load Balancer - azure

What is the difference between TCP vs UDP in the load balancing rule?
What if UDF in the red box below is selected?
Image above is from the https://learn.microsoft.com/en-us/azure/load-balancer/manage-rules-how-to

This can be either used for port swapping or if you need to use port forwarding to keep consistency on your incoming sessions and so on...
Please take a look to the following URL below:
Load-balancing rules are used to specify a pool of backend resources to route traffic to, balancing the load across each instance. For example, a load balancer rule can route TCP packets on port 80 of the load balancer across a pool of web servers.**
https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-faqs

Related

Azure load balancing rule based on source network

Is it possible with the Azure load balancer to create a load balancing rule based on source network? For example:
Connections from 10.1.0.0/16 to port 9000 go to backend port 9100
Connections from 10.2.0.0/16 to port 9000 go to backend port 9200
No, it's not possible because the frontend IP configuration only includes the IP address, protocol, and port. Refer here. Also, if you intend to configure an internal LB, then frontends and backends should be inside a virtual network.
A Load Balancer rule is used to define how traffic is distributed to
the VMs. You define the frontend IP configuration for the incoming
traffic and the backend IP pool to receive the traffic, along with the
required source and destination port.
and
The frontend (aka VIP) is defined by a 3-tuple comprised of an IP
address (public or internal), a transport protocol (UDP or TCP), and a
port number from the load balancing rule.
For more information, you could read multiple frontends for Azure Load Balancer.

Azure outbound traffic is being blocked

I have setup a few VM's and a load balancer so that we can have one outgoing IP. Right now i am having issues to connect to the internet from inside my VM. If i open internet explorer and try to access a website, it shows waiting for reply and then "This page can’t be displayed".
Each VM is connected to the same subnet.
The subnet has a NSG attached to it and each VM is part of the subnet.
NSG attached to the subnet.
There is then a load balancer to allow incoming RDP but with different ports to the different VM's.
I think i am missing the SNAT but i have no idea where to configure that. From what i have read, i am using level 2 "Public Load Balancer associated with a VM (no Instance Level Public IP address on the instance)". Multiple VM's on a subnet and one load balancer to share one IP address.
Where do i actually go to set up the SNAT? Or is there another issue i am missing here?
Probably, you could add the load balancing rules for TCP port 80 or 443 instead of inbound NAT rules. NAT rules always use for port forwarding. Moreover, you do not need add NAT rules for DNS. This works on my side.
A load balancer rule defines how traffic is distributed to the VMs. The rule defines the front-end IP configuration for incoming traffic, the back-end IP pool to receive the traffic, and the required source and destination ports.

Public LB configuration for NTP service in azure

I am trying to get NTP daemon working on my virtual machines in azure which are behind public load balancer for outbound access to internet.
NTP service is configured in client mode (default) and I have allowed outbound UDP 123 access in security group.
Now, the ntp service is not working if I am not configuring an incoming UDP 123 rule in my external load balancer to the VMs.
Running ntpdate -dq 0.centos.pool.ntp.org shows that packets are being transmitted, but none received if there is no LB incoming rule.
Adding the rule fixes the problem, but my concern is that it shouldn't be required at all, since in client mode the ntp service doesn't required inbound connections. Why is the service not working without this rule?
I guess you are using Standard SKU LB.
Standard SKU SNAT programming is per IP transport protocol and derived from the load balancing rule. If only a TCP load balancing rule exists, SNAT is only available for TCP. If you have only a TCP load balancing rule and need outbound SNAT for UDP, create a UDP load balancing rule from the same frontend to the same backend pool. This will trigger SNAT programming for UDP.
From my understanding, any UDP port load balancing rule should work.
https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-outbound-connections#preallocatedports

How to test an internal load balancer in Azure?

I created an internal load balancer in Azure with 2 vms connected to it, what is the best way to test it?
Thanks
Depending on your end goal, you should be able to set up an IIS/Apache/nginx website, depending on your VM operating system. After that, create a simple load balancing rule for port tcp 80 and see if the configured website responds.
Pretty sure you could also create a load balancing rule for RDP (tcp 3389) or SSH (tcp 22) and test to connect against your load balancer IP address.
If you are unsure whether your LB or back-end services are functional, refer to this: https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-troubleshoot

How is 'Inbound NAT rules' different from 'Load Balancing Rules' different from each other in Azure Load Balancer v2

Can someone explain to me what actually happens in the back-end to the load balancer (v2) for the two scenarios:
Applying Inbound NAT rules.
Applying Load Balancing Rules.
You would use NAT rule when you have 1 backend server or you know which backend server to get to and loadbalancing rule when you want to loadbalance to multiple backend servers.
NAT rule must be explicitly attached to a VM (or network interface) to complete the path to the target; whereas Load Balancing rule need not be. In the latter case, a VM is selected (from the back-end address pool or VMs) to complete the path to the target.
Please note that "Load balancing rule" used to distribute the traffic to available backend VMs while "Inbound nat rule" used to forward the traffic to a specific VM.
For example, assume your front end IP is 10.10.10.4 while you have three VMs in the backend pool which is having IP's of 10.10.10.5, 10.10.10.6, 10.10.10.7 respectively.
If you want to distribute the traffic which hits your frontend IP to all the three backend VMs, you will use "load balancing rule" option.
If you want to forward the traffic which hits your frontend IP to a specific VM 10.10.10.5 then you will use "inbound nat rule" option.
So in simple words,
Load balancing rule - Distributes,
Inbound nat rule - Forwards
this documentation link will help: https://learn.microsoft.com/en-us/azure/load-balancer/components#inbound-nat-rules
We added examples to help clarify. You can think of inbound NAT rules as a special type of Load Balancing rules to reference specific VMs.
-- Anavi N
Senior PM load, Azure Load Balancer

Resources