具有多个静态 IP 流量分配的 AWS Load Balancer

AWS Load Balancer with multiple Static IP traffic distribution

我试图更好地了解网络负载均衡器内的流量如何分布在多个可用区,以及来自一个 IP(子网-b)的实例是否可以接收来自另一个 IP(子网-a)的流量。

设置:

网络负载均衡器:

Availability Zones
subnet-a - ap-southeast-2a 
IPv4 address: Elastic IP 54.xxx.xxx.101 
(Contains multiple ec2 instances)

subnet-b - ap-southeast-2b 
IPv4 address: Elastic IP 54.xxx.xxx.102  
(Contains multiple ec2 instances)

外部 DNS 记录:

example.com A Record 54.xxx.xxx.101

子网 b (54.xxx.xxx.102) 中的实例是否会收到来自 example.com (54.xxx.xxx.101) 的流量?

AWS 建议您启用多个可用区,以确保将流量路由到跨可用区的健康目标。所以我假设 LB 是非歧视性的,只要你在那里,无论你来自哪里,它都会提供任何可用的东西?如果不是,真丢人。

Availability Zones and load balancer nodes

We recommend that you enable multiple Availability Zones. (With an Application Load Balancer, we require you to enable multiple Availability Zones.) This configuration helps ensure that the load balancer can continue to route traffic. If one Availability Zone becomes unavailable or has no healthy targets, the load balancer can route traffic to the healthy targets in another Availability Zone.

是的,如果启用 cross-zone loadbalancing,流量可以跨子网分布。

流量分配的方式是通过使用流哈希算法

For TCP traffic, the load balancer selects a target using a flow hash algorithm based on the protocol, source IP address, source port, destination IP address, destination port, and TCP sequence number. The TCP connections from a client have different source ports and sequence numbers, and can be routed to different targets. Each individual TCP connection is routed to a single target for the life of the connection.

有更多信息可用here