IP 五元组分流

MP2IP五元组分流,要达到的效果是:

下发IP五元组分流规则到UPF后,符合分流规则的UE流量要分流到边缘MEC网关;删除掉IP五元组分流规则后,原需要分流到边缘MEC网关的流量不再分流,正常转发的DN

因此,对于UPFIP五元组分流规则通过MP2下发后,最重要的是动态生效,也就是UPF需要支持动态修改FD

UPF MP2 IP 五元组分流流程

  • UPF总数据结构upf_main中增加hash表项 hash_pdr_id_by_appid,以APPIDkey值,存储 APPID 关联的 session PDR;

  • 在建立Session时,对于预定义规则,将APPID,session PDR对应关系记录在hash_pdr_id_by_appid中;

  • 增加UPF命令行,动态配置MEC FD,动态生效在PDR ACL,满足IP 五元组分流动态生效。

流程图:

UPF_MP2_ip_trafficRule.png

新增命令行

// 命令行原型
# upf mec-traffic pfd-list appid <name> fd {xxx} [precedence <>] [del <index>] [<del_all>]
// del <index> :为 pfd 索引,可以通过 show upf pfd-list 查看
// del_all : 删除该 mec APPID 下挂所有 pfd

// 新增一条 mec fd
# upf mec-traffic pfd-list appid 1030 fd {permit in ip from 172.20.231.0/24 to 192.168.2.1/32}

// 查看 pfd
# show upf pfd-list
----------------------------------------------------
app id: 1131
precedence: 0
PFD idx: 0
    Flow Describe(1):V4: permit out ip from 192.168.202.0/24 to 172.20.231.0/24 
    URL(0):
    DN(0):
    Customer:(0)=
PFD idx: 1
    Flow Describe(1):V4: permit in ip from 172.20.231.0/24 to 192.168.202.0/24 
    URL(0):
    DN(0):
    Customer:(0)=
----------------------------------------------------
app id: 1030
mec traffic                                                                  // 注意 有 mec traffic 标识的,说明这条 pfd 是为分流到边缘的 pfd
precedence: 0
PFD idx: 0
    Flow Describe(0):V4V6: permit out 0 from any 0 to any 0 
    URL(0):
    DN(0):
    Customer:(0)=
PFD idx: 1
    Flow Describe(1):V4: permit in ip from 172.20.231.0/24 to 192.168.2.1 
    URL(0):(nil)
    DN(0):(nil)
    Customer:(0)=(nil)
    
// 删除一条 mec fd
# upf mec-traffic pfd-list appid 1030 del 1