在此页面上
在虚拟接口上配置反向路径转发
瞻博网络支持在 Kubernetes 编排的环境中使用云原生 Contrail® 网络™ 22.1 或更高版本在虚拟接口上进行反向路径转发 (RPF)。
概述
单播反向路径转发 (RPF) 通过执行 RPF 检查来验证数据包是否从有效的源地址发送。RPF 检查是一种验证工具,它使用 IP 路由表来验证传入数据包的源 IP 地址是否来自有效路径。RPF 有助于减少转发可能欺骗 IP 地址的 IP 数据包。
当数据包到达接口时,RPF 会对数据包的源 IP 地址执行转发表查找并检查传入接口。传入接口必须与数据包到达的接口匹配。如果接口不匹配,虚拟路由器将丢弃数据包。如果数据包来自有效路径,vRouter 会将数据包转发到目标地址。
可以基于每个虚拟网络启用或禁用源 RPF。默认情况下,RPF 处于禁用状态。
-
RPF 启用
每当数据包到达接口时,RPF 都会对数据包的源 IP 地址执行检查。如果虚拟路由器未获知路由,则会丢弃所有数据包。接口上仅允许从分配给工作负载的 MAC/IP 地址接收的数据包。
-
RPF 禁用
接口上接受来自任何源的数据包。不会对传入数据包源 IP 地址执行转发表查找。
在虚拟接口上启用 RPF
下面是用于在虚拟接口上配置 RPF 的命名空间 YAML 文件的示例。要启用 RPF,请将下的 virtualNetworkProperties
enable
变量设置为 rpf
。
apiVersion: v1 kind: Namespace metadata: name: rpf-ns --- apiVersion: core.contrail.juniper.net/v1alpha1 kind: Subnet metadata: namespace: rpf-ns name: rpf-subnet-1 annotations: core.juniper.net/display-name: Sample Subnet core.juniper.net/description: Subnet represents a block of IP addresses and its configuration. IPAM allocates and releases IP address from that block on demand. It can be used by different VirtualNetwork in the mean time. spec: cidr: "172.20.10.0/24" --- apiVersion: core.contrail.juniper.net/v1alpha1 kind: VirtualNetwork metadata: namespace: rpf-ns name: rpf-vn-1 annotations: core.juniper.net/display-name: Sample Virtual Network core.juniper.net/description: VirtualNetwork is a collection of end points (interface or ip(s) or MAC(s)) that can communicate with each other by default. It is a collection of subnets whose default gateways are connected by an implicit router spec: v4SubnetReference: apiVersion: core.contrail.juniper.net/v1alpha1 kind: Subnet namespace: rpf-ns name: rpf-subnet-1 fabricSNAT: true virtualNetworkProperties: rpf: enable