有没有办法同时使用 IPv4 和 IPv6 配置 stick-table?

有没有办法同时使用 IPv4 和 IPv6 配置 stick-table?

当配置 HaProxy 以使用 Stick Tables 时,可以使用以下命令使用用户的 IP:

stick-table type ip size 1m expire 60s store conn_cur

问题是,从我在文档中找到的内容来看,这只会影响 IPv4,而不会影响 v6。为了定位 IPv6,您需要有另一个 stick 表:

stick-table type ipv6 size 1m expire 60s store conn_cur

这迫使您拥有两个后端(每个 stick 表一个)和两组针对 v4 和 v6 的配置。

有没有办法让两个 IP 版本仅使用一个 stick-table?

提前致谢。

答案1

使用一个ipv6stick 表,删除该ip表。源码放入 6 个表中将产生 IPv4 映射的 IPv6 地址。

src : ip
This is the source IPv4 address of the client of the session. It is of type
IP and works on both IPv4 and IPv6 tables. On IPv6 tables, IPv4 addresses are
mapped to their IPv6 equivalent, according to RFC 4291.

相关内容