机箱间有状态同步,可实现长期 NAT 和有有状态防火墙流(MS-MPC、MS-MIC)(16.1 及更高版本)
为 NAT 和有状态防火墙配置机箱间 MS-MPC 和 MS-MIC 冗余概述(16.1 及更高版本)
本主题适用于 Junos OS 16.1 及更高版本。
运营商级 NAT (CGN) 和状态防火墙部署可以使用双机箱实施,为路由器中的关键组件提供冗余数据路径和冗余。虽然可以通过使用 AMS 接口在 MX 系列设备中使用机箱内高可用性,但此方法仅在本地处理服务 PIC 和完整的 MS-MPC 或 MS-MIC 卡故障。如果由于任何原因由于路由器中的其他故障而将流量切换到备用路由器,则服务 PIC 的会话状态将丢失。机箱间高可用性通过保留服务 PIC 的 NAT 和有状态防火墙的会话状态,提供更为强大的解决方案。该技术是主-次模型,而不是主动-主动群集。要由为机箱间高可用性配置的服务 PIC 提供服务的流量仅会流经当前作为配对中主设备的 MX 系列设备。
要为 NAT 和有状态防火墙配置机箱间冗余,请配置:
有状态同步,将会话状态从主机箱上的服务 PIC 复制到备份机箱。有关更多信息,请参阅适用于长期 NAT 和有状态防火墙流的机箱间有状态同步(MS-MPC、MS-MIC)概述(16.1 及更高版本)。
服务冗余守护程序,它允许根据受监视的事件进行主角色切换。大多数操作员不希望在不实现服务冗余守护程序的情况下采用有状态同步。有关更多信息,请参阅 服务冗余守护程序概述
适用于长期 NAT 和有状态防火墙流的机箱间有状态同步(MS-MPC、MS-MIC)概述(16.1 及更高版本)
本主题适用于 Junos OS 16.1 及更高版本。
有状态同步可在高可用性对中的主机箱和备用 MX 系列机箱之间同步长期会话。默认情况下,长期会话是在服务 PIC 上处于活动状态的防火墙、NAT 和 IDS 会话,但您可以将其配置为更高或更低的值。有状态防火墙会话、NAT 会话和 IDS 会话是可以同步的会话类型。
机箱间高可用性可与在 MS-MIC 或 MS-MPC 接口卡上配置的 MS 服务接口配合使用。必须为单元 0 以外的 ms- 接口单元配置该 ip-address-owner service-plane 选项。
以下 NAT 转换类型和会话支持有状态同步:
基本 NAT44
动态 NAT44
NAPT-44
NAPT-44 与端点无关映射 (EIM) 或端点无关过滤器 (EIF)
DNAT-44
两次 NAT
状态式 NAT64
以下限制适用:
不支持复制端口块分配 (PBA)、端点无关映射 (EIM) 或端点无关过滤器 (EIF) 功能的状态信息。
为属于有状态同步设置的 NAT 或有状态防火墙配置服务集时,- 服务集的 NAT 和有状态防火墙配置在两台 MX 系列设备上必须相同。
应用层网关 (ALG) 会话不支持有状态同步。
图 1 显示了机箱间高可用性拓扑。
为长期 NAT 和有状态防火墙流(MS-MPC、MS-MIC)配置机箱间有状态同步(16.1 及更高版本)
本主题适用于 Junos OS 16.1 及更高版本。
要在 MS-MIC 或 MS-MPC 服务 PIC 上为有状态防火墙和 NAPT44 配置有状态同步机箱间高可用性,请在高可用性对的每个机箱上执行以下配置步骤。
示例:用于长期 NAT 和有状态防火墙流(MS-MIC、MS-MPC)(16.1 及更高版本)的机箱间有状态同步
此示例说明如何为 NAT 服务配置机箱间高可用性。
要求
此示例使用以下硬件和软件组件:
两台带有 MS-MPC 线卡的 MX480 路由器
Junos OS 16.1 或更高版本
概述
两台 MX 系列路由器的配置相同,以便在机箱发生故障时方便 NAT 服务进行有状态故障切换。
配置
要为此示例配置机箱间高可用性,请执行以下作:
- CLI 快速配置
- 为机箱 1 配置接口
- 为机箱 1 的 MX 系列路由器之间的高可用性同步流量配置路由信息
- 为机箱 1 配置 NAT
- 配置服务集
- 为机箱 2 配置接口
- 为适用于机箱 2 的 MX 系列路由器之间的高可用性同步流量配置路由信息
CLI 快速配置
要在路由器上快速配置此示例,请在删除换行符并替换特定于您站点的接口信息后,复制以下命令并将其粘贴到路由器终端窗口中。
以下配置适用于机箱 1。
[edit] set interfaces ms-4/0/0 redundancy-options redundancy-peer ipaddress 5.5.5.2 set interfaces ms-4/0/0 redundancy-options redundancy-local data-address 5.5.5.1 set interfaces ms-4/0/0 redundancy-options routing-instance HA set interfaces ms-4/0/0 redundancy-options replication-threshold 180 set interfaces ms-4/0/0 unit 10 ip-address-owner service-plane set interfaces ms-4/0/0 unit 10 family inet address 5.5.5.1/32 set interfaces ms-4/0/0 unit 20 family inet set interfaces ms-4/0/0 unit 20 service-domain inside set interfaces ms-4/0/0 unit 30 family inet set interfaces ms-4/0/0 unit 30 service-domain outside set interfaces ge-2/0/0 vlan-tagging set interfaces ge-2/0/0 unit 0 vlan-id 100 family inet address 20.1.1.1/24 set policy-options policy-statement dummy term 1 then reject set routing-instances HA instance-type vrf set routing-instances HA interface ge-2/0/0.0 set routing-instances HA interface ms-4/0/0.10 set routing-instances HA route-distinguisher 1:1 set routing-instances HA vrf-import dummy set routing-instances HA vrf-export dummy set routing-instances HA routing-options static route route 5.5.5.1/32 next-hop ms-4/0/0.10 set routing-instances HA routing-options static route route 5.5.5.2/32 next-hop 20.1.1.2 set routing-options static-route 100.100.100.0/24 next-hop ms-4/0/0.20 set services nat pool p2 address 32.0.0.0/24 set services nat pool p2 port automatic random-allocation set services nat pool p2 address-allocation round-robin set services nat rule r2 match-direction input set services nat rule r2 term t1 from source-address 129.0.0.0/8 set services nat rule r2 term t1 from source-address 128.0.0.0/8 set services nat rule r2 term t1 then translated source-pool p2 set services nat rule r2 term t1 then translated translation-type napt-44 set services nat rule r2 term t1 then translated address-pooling paired set services nat rule r2 term t1 then syslog set services service-set ss2 nat-rules r2 set services service-set ss2 next-hop-service inside-service-interface ms-4/0/0.20 set services service-set ss2 next-hop-service outside-service-interface ms-4/0/0.30 set services service-set ss2 syslog host local class session-logs set services service-set ss2 syslog host local class nat-logs
以下配置适用于机箱 2。机箱 1 和机箱 2 的 NAT 和服务集信息必须相同。
set interfaces ms-4/0/0 redundancy-options redundancy-peer ipaddress 5.5.5.1 set interfaces ms-4/0/0 redundancy-options redundancy-local data-address 5.5.5.2 set interfaces ms-4/0/0 redundancy-options routing-instance HA set interfaces ms-4/0/0 redundancy-options replication-threshold 180 set interfaces ms-4/0/0 unit 10 ip-address-owner service-plane set interfaces ms-4/0/0 unit 10 family inet address 5.5.5.2/32 set interfaces ms-4/0/0 unit 20 family inet set interfaces ms-4/0/0 unit 20 service-domain inside set interfaces ms-4/0/0 unit 30 family inet set interfaces ms-4/0/0 unit 30 service-domain outside set interfaces ge-2/0/0 vlan-tagging set interfaces ge-2/0/0 unit 0 vlan-id 100 family inet address 20.1.1.2/24 set policy-options policy-statement dummy term 1 then reject set routing-instances HA instance-type vrf set routing-instances HA interface ge-2/0/0.0 set routing-instances HA interface ms-4/0/0.10 set routing-instances HA route-distinguisher 1:1 set routing-instances HA vrf-import dummy set routing-instances HA vrf-export dummy set routing-instances HA routing-options static route 5.5.5.2/32 next-hop ms-4/0/0.10 set routing-instances HA routing-options static route 5.5.5.1/32 next-hop 20.1.1.1 set routing-options static-route 100.100.100.0/24 next-hop ms-4/0/0.20 set services nat pool p2 address 32.0.0.0/24 set services nat pool p2 port automatic random-allocation set services nat pool p2 address-allocation round-robin set services nat rule r2 match-direction input set services nat rule r2 term t1 from source-address 129.0.0.0/8 set services nat rule r2 term t1 from source-address 128.0.0.0/8 set services nat rule r2 term t1 then translated source-pool p2 set services nat rule r2 term t1 then translated translation-type napt-44 set services nat rule r2 term t1 then translated address-pooling paired set services nat rule r2 term t1 then syslog set services service-set ss2 nat-rules r2 set services service-set ss2 next-hop-service inside-service-interface ms-4/0/0.20 set services service-set ss2 next-hop-service outside-service-interface ms-4/0/0.30 set services service-set ss2 syslog host local class session-logs set services service-set ss2 syslog host local class nat-logs
为机箱 1 配置接口
分步程序
每个 高可用性路由器对的接口配置相同,但以下服务 PIC 选项除外:
每个机箱上的 必须
redundancy-options redundancy-peer ipaddress address不同,并且必须指向对等机箱上的。redundancy-options redundancy-local data-address data-address包含该选项的
ip-address-owner service-plane单元(0 除外)的 在unit unit-number family inet address address每个机箱上必须不同。
要配置接口:
在机箱 1 上配置冗余服务 PIC。
[edit interfaces} user@host# set interfaces ms-4/0/0 redundancy-options redundancy-peer ipaddress 5.5.5.2 user@host# set interfaces ms-4/0/0 redundancy-options redundancy-local data-address 5.5.5.1 user@host# set interfaces ms-4/0/0 redundancy-options routing-instance HA user@host# set interfaces ms-4/0/0 redundancy-options replication-threshold 180 user@host# set interfaces ms-4/0/0 unit 10 ip-address-owner service-plane user@host# set interfaces ms-4/0/0 unit 10 family inet address 5.5.5.1/32 user@host# set interfaces ms-4/0/0 unit 20 family inet user@host# set interfaces ms-4/0/0 unit 20 service-domain inside user@host# set interfaces ms-4/0/0 unit 30 family inet user@host# set interfaces ms-4/0/0 unit 30 service-domain outside
配置机箱 1 的接口,用作同步流量的机箱间链路。
user@host# set interfaces ge-2/0/0 vlan-tagging user@host# set interfaces ge-2/0/0 unit 0 vlan-id 100 family inet address 20.1.1.1/24
根据需要配置其余接口。
结果
user@host# show interfaces
ge-2/0/0 {
vlan-tagging;
unit 0 {
vlan-id 100;
family inet {
address 20.1.1.1/24;
}
}
}
ms-4/0/0 {
redundancy-options {
redundancy-peer {
address 5.5.5.2;
}
redundancy-local {
data-address 5.5.5.1;
}
routing-instance HA;
}
unit 10 {
ip-address-owner service-plane;
family inet {
address 5.5.5.1/32;
}
}
unit 20 {
family inet;
family inet6;
service-domain inside;
}
unit 30 {
family inet;
family inet6;
service-domain outside;
}
}
为机箱 1 的 MX 系列路由器之间的高可用性同步流量配置路由信息
分步程序
此示例不包含详细的路由配置。机箱之间的高可用性同步流量需要路由实例,如下所示:
要为机箱 1 配置路由实例:
指定虚拟策略语句。路由实例配置中引用了此语句。
user@host# set policy-options policy-statement dummy term 1 then reject
指定路由实例的选项。
user@host# set routing-instances HA instance-type vrf user@host# set routing-instances HA interface ge-2/0/0.0 user@host# set routing-instances HA interface ms-4/0/0.10 user@host# set routing-instances HA route-distinguisher 1:1 user@host# set policy-options policy-statement dummy term 1 then reject user@host# set routing-instances HA vrf-import dummy user@host# set routing-instances HA vrf-export dummy @user@host# set routing-instances HA routing-options static route 5.5.5.1/32 next-hop ms-4/0/0.10 user@host# set routing-instances HA routing-options static route 5.5.5.2/32 next-hop 20.1.1.2
指定应用服务集的下一跃点流量。
user@host# set routing-options static-route 100.100.100.0/24 next-hop ms-4/0/0.20
结果
@user@host# show routing-instances
HA {
instance-type vrf;
interface ge-2/0/0.0;
interface ms-4/0/0.10;
route-distinguisher 1:1;
vrf-import dummy;
vrf-export dummy;
routing-options {
static {
route 5.5.5.1/32 next-hop ms-4/0/0.10;
route 5.5.5.2/32 next-hop 20.1.1.2;
}
}
}
为机箱 1 配置 NAT
分步程序
在两台路由器上以相同的方式配置 NAT。
要配置 NAT,请执行以下作:
指定 NAT 池和规则信息。
user@host# set services nat pool p2 address 32.0.0.0/24 user@host# set services nat pool p2 port automatic random-allocation user@host# set services nat pool p2 address-allocation round-robin user@host# set services nat rule r2 match-direction input user@host# set services nat rule r2 term t1 from source-address 129.0.0.0/8 user@host# set services nat rule r2 term t1 from source-address 128.0.0.0/8 user@host# set services nat rule r2 term t1 then translated source-pool p2 user@host# set services nat rule r2 term t1 then translated translation-type napt-44 user@host# set services nat rule r2 term t1 then translated address-pooling paired user@host# set services nat rule r2 term t1 then syslog
结果
user@host# show services nat
nat {
pool p2 {
address 32.0.0.0/24;
port {
automatic {
random-allocation;
}
}
address-allocation round-robin;
}
rule r2 {
match-direction input;
term t1 {
from {
source-address {
129.0.0.0/8;
128.0.0.0/8;
}
}
then {
translated {
source-pool p2;
translation-type {
napt-44;
}
address-pooling paired;
}
syslog;
}
}
}
}
配置服务集
分步程序
在两台路由器上以相同的方式配置服务集。要配置服务集:
(选答)默认情况下会复制服务集。使用以下选项从复制中排除服务集。
user@host# set services service-set ss2 replicate-services disable-replication-capability
为服务集配置对 NAT 规则的引用。
user@host# set services service-set ss2 nat-rules r2
在 MS-PIC 上配置下一跃点服务接口。
user@host# set services service-set ss2 next-hop-service inside-service-interface ms-4/0/0.20 user@host# set services service-set ss2 next-hop-service outside-service-interface ms-4/0/0.30
配置所需的日志记录选项。
user@host# set services service-set ss2 syslog host local class session-logs user@host# set services service-set ss2 syslog host local class nat-logs
结果
user@host# show services service-set ss2
syslog {
host local {
class {
session-logs;
inactive:
nat-logs;
}
}
replicate-services {
replication-threshold 180;
inactive: disable-replication-capability;
}
nat-rules r2;
next-hop-service {
inside-service-interface ms-3/0/0.20;
outside-service-interface ms-3/0/0.30;
}
}
为机箱 2 配置接口
分步程序
每个 高可用性路由器对的接口配置相同,但以下服务 PIC 选项除外:
redundancy-options redundancy-peer ipaddress addressunit unit-number family inet address address的单元(0 除外)包含选项ip-address-owner service-plane
在机箱 2 上配置冗余服务 PIC。
指向
redundancy-peer ipaddress机ip-address-owner service-plane箱 1 上机箱上 ms-4/0/0 上包含语句的单元(单元 10)地址。[edit interfaces} set interfaces ms-4/0/0 redundancy-options redundancy-peer ipaddress 5.5.5.1 user@host# set interfaces ms-4/0/0 redundancy-options redundancy-local data-address 5.5.5.2 user@host# set interfaces ms-4/0/0 redundancy-options replication-threshold 180 user@host# set interfaces ms-4/0/0 redundancy-options routing-instance HA user@host# set interfaces ms-4/0/0 unit 10 ip-address-owner service-plane user@host# set interfaces ms-4/0/0 unit 10 family inet address 5.5.5.2/32 user@host# set interfaces ms-4/0/0 unit 20 family inet user@host# set interfaces ms-4/0/0 unit 20 service-domain inside user@host# set interfaces ms-4/0/0 unit 30 family inet user@host# set interfaces ms-4/0/0 unit 30 service-domain outside
配置机箱 2 的接口,用作同步流量的机箱间链路
user@host# set interfaces ge-2/0/0 vlan-tagging user@host# set interfaces ge-2/0/0 unit 0 vlan-id 100 family inet address 20.1.1.2/24
根据需要配置机箱 2 的其余接口。
结果
user@host# show interfaces
ms-4/0/0 {
redundancy-options {
redundancy-peer {
address 5.5.5.1;
}
redundancy-local {
data-address 5.5.5.2;
}
routing-instance HA;
}
unit 0 {
family inet;
}
unit 10 {
ip-address-owner service-plane;
family inet {
address 5.5.5.2/32;
}
}
}
ge-2/0/0 {
vlan-tagging;
unit 0 {
vlan-id 100;
family inet {
address 20.1.1.2/24;
}
}
unit 10 {
vlan-id 10;
family inet {
address 2.10.1.2/24;
}
}
}
为适用于机箱 2 的 MX 系列路由器之间的高可用性同步流量配置路由信息
分步程序
此示例不包含详细的路由配置。两个机箱之间的高可用性同步流量需要路由实例,此处包含。
为机箱 2 配置路由实例。
user@host# set routing-instances HA instance-type vrf user@host# set routing-instances HA interface ge-2/0/0.0 user@host# set routing-instances HA interface ms-4/0/0.10 user@host# set routing-instances HA route-distinguisher 1:1 user@host# set policy-options policy-statement dummy term 1 then reject user@host# set routing-instances HA vrf-import dummy user@host# set routing-instances HA vrf-export dummy user@host# set routing-instances HA routing-options static route 5.5.5.2/32 next-hop ms-4/0/0.10 user@host# set routing-instances HA routing-options static route 5.5.5.1/32 next-hop 20.1.1.1 user@host# set routing-options static-route 100.100.100.0/24 next-hop ms-4/0/0.20
注意:以下配置步骤与机箱 1 显示的步骤 相同 。
配置 NAT
配置服务集
结果
@user@host# show services routing-instances
HA {
instance-type vrf;
interface xe-2/2/0.0;
interface ms-4/0/0.10;
route-distinguisher 1:1;
vrf-import dummy;
vrf-export dummy;
routing-options {
static {
route 5.5.5.2/32 next-hop ms-4/0/0.10;
route 5.5.5.1/32 next-hop 20.1.1.1;
}
}
}