内联 CGNAT
内联运营商等级网络地址转换 (CGNAT) 概述
内联运营商等级网络地址转换 (CGNAT) 将网络地址端口转换 (NAPT) 直接集成到数据包转发引擎 (PFE) 中。这一集成通过 NAT44(IPv4 到 IPv4)和 NAT64(IPv6 到 IPv4)转换实现了高效的地址和端口管理。因此,无需外部服务卡位于 BNG 机箱中,也无需外部 SRX 即可为 BNG 用户执行 CGNAT 功能。内联 CGNAT 是一项基于用户激活数量的许可功能。
关键功能包括为每个用户分配固定的公共 IPv4 地址和端口块、RADIUS 记帐更新以报告这些分配,以及支持在特定路由实例中通告公共地址。通过在防火墙过滤和合法拦截之后以及下游流量的这些服务之前执行 NAT 转换,可以优化流量处理。
内联 NAPT(网络地址端口转换)在用户数据包转发引擎 (PFE) 本身上运行,无需将流量路由到单独的服务 PFE,以实现 CGNAT(运营商等级网络地址转换)功能。
可以使用 RADIUS 在单个用户的基础上实施内联 CGNAT。该功能包括对 RADIUS 记账的更新,使其能够报告分配给每个订阅者的公共 IP 和端口块。这种集成可确保您的订阅者管理系统与 NAT 分配保持同步,提供准确和最新的信息。此外,该功能还支持在特定路由实例中宣传公共地址,帮助优化路由并减少延迟。
内联 CGNAT 的优势
-
通过将 NAPT 直接集成到数据包转发引擎中来提高网络性能,无需外部服务卡。
- 通过高效管理 IP 地址和端口资源提高可扩展性,支持大规模用户部署。
-
使用增强的 CLI 命令简化直接配置和监控,从而提供有关 NAT 池分配和使用情况的详细见解。
-
通过在特定路由实例中启用公共 IP 地址播发,简化路由和订阅者管理。
-
通过结合防火墙过滤器和合法拦截流程执行 NAT 转换来优化流量处理,确保无缝服务交付。
该功能支持以下功能:
-
支持无状态和基于端口块分配的 CGNAT。
-
PPPoE 和 DHCP 用户支持 NAT44,方法是在用户登录时分配公共 IPv4 地址和端口块,并在注销时回收它们。
-
PPPoEv6 和 DHCPv6 用户支持 NAT64,方法是在用户登录期间分配公共 IPv4 地址和端口块,并在注销时回收它们。
-
从动态配置文件中指定的NAT池中,为 IPv4 和 IPv6 订阅者分配一个公共 IPv4 地址和端口块。路由将配置为将公共地址流量定向到订阅者的 PFE。
-
作为订阅者核算流程的一部分,向 RADIUS 服务器报告分配的 IPv4 公共地址和端口块。
配置内联 CGNAT
内联 NAPT 支持 NAT44(IPv4 到 IPv4)和 NAT64(IPv6 到 IPv4)转换,确保您的网络能够处理传统 IPv4 和现代 IPv6 流量,从而促进两种协议之间的平稳过渡和互作性。
配置内联 CGNAT 时,请定义 NAT 池,指定可用于转换的公共 IP 地址和端口的范围。登录时,系统会为每个用户分配一个固定的公共 IPv4 地址和一个特定的端口块,由数据包转发引擎管理。使用增强型 CLI 命令配置这些参数,如 show subscribers,提供有关 NAT 池分配的详细信息, show network-access inline-napt pool以及 ,列出指定 NAT 池中的 IP 地址。这些命令可以有效监控和管理 NAT 资源,及时解决任何潜在的短缺或配置错误。
除了配置内联 CGNAT 的许可证外,您还需要其他订阅者管理许可证。在配置内联 CGNAT 之前,请在设备上启用统一服务和所需的许可证支持。要在设备上启用统一服务,请从 CLI 执行 request system enable unified-services 并重新启动设备。
要使用最佳资源来设置 PFE 以进行 NAPT 扩展,请使用以下命令配置线卡:
[edit chassis]
{
fpc <slot> {
napt;
}
}
您可以通过为订阅者发送值为 1 的 VSA NAPT-NAT64-Enable 来从 RADIUS 启用内联 NAPT。
[edit dynamic-profiles name services]
{
inline-napt {
nat44 {
“disable:$junos-napt-nat64-enable;
}
}
}
您可以通过为订阅者发送值为 0 的 VSA NAPT-NAT64-Enable 来禁用 RADIUS 的内联 NAPT。
如果未从 RADIUS 发送 VSA NAPT-NAT44-Enable,则默认启用 NAPT NAT64 功能。
要有效实施内联 CGNAT,请配置 NAT 池和动态配置文件:
[edit services]
{
nat {
source {
pool POOL_NAME {
address IP_RANGE;
port {
range PORT_RANGE;
block-allocation {
block-size SIZE;
}
}
mapping-timeout TIMEOUT;
routing-instance INSTANCE_NAME;
}
}
}
}
例如:
[edit services]
{
nat {
source {
pool BBE-NAT-POOL {
address 192.168.0.1/32 to 192.168.0.2/32;
port {
range 5001 to 65000;
block-allocation {
block-size 1000;
}
}
mapping-timeout 120;
routing-instance CGN-VRF;
}
}
}
}
要将 NAT 池映射到路由实例,请使用以下 CLI 命令。这会将定义的 NAT 池映射到相应的路由实例,从而实现详细而灵活的网络配置。
[edit system]
{
services {
subscriber-management {
inline-napt {
routing-instance-pool-map {
routing-instance INSTANCE_NAME pool POOL_NAME;
}
}
}
}
}
例如:
[edit system]
{
services {
subscriber-management {
inline-napt {
routing-instance-pool-map {
routing-instance default pool BBE-NAT-POOL;
routing-instance sub-vrf1 pool BBE-NAT-POOL;
routing-instance sub-business pool BBE-NAT-POOL1;
}
}
}
}
}
通过将 NAT 池映射到特定路由实例,您可以确保不同的网段或订阅者组具有专用地址转换设置,从而更好地管理 NAT 资源并提高整体网络性能。
也可以看看
监控内联 CGNAT
登录时,系统会为每个用户分配一个固定的公共 IPv4 地址和一个特定的端口块,由数据包转发引擎管理。
您可以使用增强型 CLI 命令查看和监控这些参数。该 show subscribers 命令提供有关订阅者使用的 NAT 公共地址和特定于订阅者的 CGNAT 参数的详细信息。该 show network-access inline-napt pool 命令会列出指定 NAT 池中的 IP 地址。
user@host> show subscribers detail Type: NAT IP Address: 192.168.0.1 Routing Instance: default Radius Accounting ID: 4 Session ID: 4 Login Time: 2024-12-11 00:13:28 IST IP Address Pool: BBE-CGNAT-POOL Type: NAT IP Address: 192.168.0.2 Routing Instance: VRF1 Radius Accounting ID: 10 Session ID: 10 Login Time: 2024-12-11 03:13:28 IST IP Address Pool: BBE-CGNAT-POOL Type: DHCP IP Address: 10.0.0.1 IP Netmask: 10.255.0.0 Primary DNS Address: 192.0.2.0 Secondary DNS Address: 192.0.2.1 Primary WINS Address: 192.0.2.3 Secondary WINS Address: 192.0.2.4 Logical System: default Routing Instance: default Interface: demux0.3073741824 Interface type: Dynamic Dynamic Profile Name: dhcp-demux-prof MAC Address: 00:00:5e:00:53:98 State: Active Radius Accounting ID: example :2304 Idle Timeout (seconds): 600 Login Time: 2024-12-11 14:43:52 PDT DHCP Options: len 52 35 01 01 39 02 02 40 3d 07 01 00 10 94 00 00 08 33 04 00 00 00 3c 0c 15 63 6c 69 65 6e 74 5f 50 6f 72 74 20 2f 2f 36 2f 33 2d 37 2d 30 37 05 01 06 0f 21 2c Service Sessions: 2 NAT Pool: BBE-CGNAT-POOL NAT Public IP Address: 192.168.0.1 NAT Port Block: 5001-6000 NAPT Block Allocation Time: 2024-12-11 14:43:52 PDT Type: DHCP IP Address: 10.0.0.2 IP Netmask: 10.255.0.0 Primary DNS Address: 192.0.2.0 Secondary DNS Address: 192.0.2.1 Primary WINS Address: 192.0.2.3 Secondary WINS Address: 192.0.2.4 Logical System: default Routing Instance: default Interface: demux0.3073741825 Interface type: Dynamic Dynamic Profile Name: dhcp-demux-prof MAC Address: 00:00:5e:00:53:98 State: Active Radius Accounting ID: example :2304 Idle Timeout (seconds): 600 Login Time: 2024-12-11 14:43:52 PDT DHCP Options: len 52 35 01 01 39 02 02 40 3d 07 01 00 10 94 00 00 08 33 04 00 00 00 3c 0c 15 63 6c 69 65 6e 74 5f 50 6f 72 74 20 2f 2f 36 2f 33 2d 37 2d 30 37 05 01 06 0f 21 2c Service Sessions: 2 NAT Pool: BBE-CGNAT-POOL NAT Public IP Address: 192.168.0.2 NAT Port Block: 5001-6000 NAPT Block Allocation Time: 2024-12-11 14:50:25 PDT
要查看 IP 地址和分配的端口块大小的详细信息,请执行和show network-access aaa statistics inline-napt pool <pool-name>show system subscriber-management inline-napt pool <pool-name>命令。
user@host> show network-access aaa statistics inline-napt pool BBE-CGNAT-POOL Pool name: BBE-CGNAT-POOL Address total: 4 Addresses in use: 2 Address Usage (percent): 50 Out of Addresses: 0
user@host> show system subscriber-management inline-napt pool BBE-CGNAT-POOL External address Access PFE Routing-Instance Port block size Block use 172.16.0.1 ge-0/0/0 default 1000 2/60 172.16.0.2 ge-0/0/0 VRF1 1000 1/60
如果用户已耗尽分配给它的端口块大小中的所有端口,则将显示以下系统日志消息。
PROCESSOR_IPV4_NAPT_BINDING_PORTBLOCK_LIMIT_EXCEEDED Napt Session port block limit exceeded. No free port available for IpAddr:10.1.1.1