目录

文章目录

  • 目录
  • L3 vRouter
  • L3 vRouter 操作指令集
    • IP address
    • IP Route(VRF)
    • Ping
  • 应用示例
    • 一、搭建 Connecting Two VPP Instances
    • 二、L3 Routing

L3 vRouter

VPP 可以作为一个现成的 L3 vRouter,支持创建:

  • VRFs - thousands
  • Routes - millions

L3 vRouter 操作指令集

IP address

# 设置 IPv4 地址
set interface ip address [del] <interface> <ip-addr>/<mask> | [all]# 设置 IPv6 地址
set ip6 address VirtualFunctionEthernet0/6/0 fd00::30/8# 设置 IPv6 接口的邻居发现参数。
set ip6 nd VirtualFunctionEthernet0/6/0 ...# 关闭 IPv6 接口的 RA 发送。set ip6 nd VirtualFunctionEthernet0/6/0 ra-suppress  no# 打开 IPv6 接口的 RA 发送。
set ip6 nd VirtualFunctionEthernet0/6/0 ra-suppress  no# 查看接口的 IP 地址
show interface addr

IP Route(VRF)

# 查看 L3 路由表
show ip fib [summary] [table <table-id>] [index <fib-id>] [<ip4-addr>[/<mask>]] [mtrie] [detail]# EXAMPLE
show ip fib
show ip fib summary
show ip fib table 7# 查看路由记录
show fib entry [<index>]# 创建 IPv4 VRF
ip table [add|del] <table-id># 创建 IPv6 VRFip6 table [add|del] <table-id># 将接口挂载到指定的 FIB 路由表中。
set interface ip table 1 VirtualFunctionEthernet0/6/0# 设置路由规则
ip route [add|del][count <n>]<dst-ip-addr>/<width>[table <table-id>]via [next-hop-address] [next-hop-interface] [next-hop-table <value>][weight <value>][preference <value>][udp-encap-id <value>][ip4-lookup-in-table <value>][ip6-lookup-in-table <value>][mpls-lookup-in-table <value>][resolve-via-host][resolve-via-connected][rx-ip4 <interface>][out-labels <value value value>]# 添加一条路由
ip route add 6.0.1.2/32 via 6.0.0.1 GigabitEthernet2/0/0# 删除一条路由
ip route del 6.0.1.2/32 via 6.0.0.1 GigabitEthernet2/0/0# 批量添加路由,多用于测试性能
ip route add count 10 7.0.0.0/24 via 6.0.0.1 GigabitEthernet2/0/0# 添加路由规则到指定的 FIB 表(VRF)
ip route add 172.16.24.0/24 table 7 via GigabitEthernet2/0/0# 添加同一个目的地的多条路由,用于创建等价路径。
ip route add 7.0.0.1/32 via 6.0.0.1 GigabitEthernet2/0/0
ip route add 7.0.0.1/32 via 6.0.0.2 GigabitEthernet2/0/0# 非等价路径由后面的权重指定,下面示例一个走 1/4 的流量,一个走 3/4 的流量
ip route add 7.0.0.1/32 via 6.0.0.1 GigabitEthernet2/0/0 weight 1
ip route add 7.0.0.1/32 via 6.0.0.2 GigabitEthernet2/0/0 weight 3

Ping

ping {<ip-addr> | ipv4 <ip4-addr> | ipv6 <ip6-addr>}[ipv4 <ip4-addr> | ipv6 <ip6-addr>][source <interface>][size <pktsize>][interval <sec>][repeat <cnt>][table-id <id>][verbose]# EXAMPLE
ping 172.16.1.2 source GigabitEthernet2/0/0 repeat 2
ping 172.16.1.2 ipv6 fe80::24a5:f6ff:fe9c:3a36 source GigabitEthernet2/0/0 repeat 2 verbose

应用示例

一、搭建 Connecting Two VPP Instances

VPP 支持在同一个 Linux 主机中运行多个 Instance,并且 Instance 之间可以使用 memif 来进行通信。

memif 是一种高性能的 Direct Memory Interface(直连内存接口),VPP instnace 通过 memif 提供的 Control Channel 的 Socket file 来进行内存的共享。

  1. 编辑 VPP2 的配置。
$ vi /etc/vpp/startup2.conf
unix {nodaemoncli-listen /run/vpp/cli-vpp2.sock
}plugins {plugin dpdk_plugin.so { disable }
}
  1. 启动进程。
$ vpp -c /etc/vpp/startup2.conf
vpp[10715]: clib_elf_parse_file: open `/usr/bin/vp': No such file or director
vpp[10715]: vat-plug/load: vat_plugin_register: oddbuf plugin not loaded...
  1. 进入 CLI。
$ vppctl -s /run/vpp/cli-vpp2.sock_______    _        _   _____  _____/ __/ _ \  (_)__    | | / / _ \/ _ \_/ _// // / / / _ \   | |/ / ___/ ___//_/ /____(_)_/\___/   |___/_/  /_/vpp# show version
vpp v21.01.0-5~g6bd1c77fd built by root on vpp-host at 2021-05-12T16:17:20
  1. Create memif interface on vpp1: This will create an interface on vpp1 memif0/0 using /run/vpp/memif as its socket file. The role of vpp1 for this memif inteface is ‘master’.
vpp# create interface memif id 0 mastervpp# show hardwareName                Idx   Link  Hardware
...
memif0/0                           2    down  memif0/0Link speed: unknownEthernet address 02:fe:04:a3:10:16MEMIF interfaceinstance 0
  1. 配置 VPP1 memif interface 的 IP address:
vpp# set int state memif0/0 upvpp# set int ip address memif0/0 10.10.2.1/24vpp# show interface addr
host-vpp1out (up):L3 10.10.1.2/24
local0 (dn):
memif0/0 (up):L3 10.10.2.1/24
  1. Create memif interface on vpp2: We want vpp2 to pick up the ‘slave’ role using the same run/vpp/memif-vpp1vpp2 socket file.
vpp# create interface memif id 0 slavevpp# show hardwareName                Idx   Link  Hardware
...
memif0/0                           1    down  memif0/0Link speed: unknownEthernet address 02:fe:1c:b3:f2:8eMEMIF interfaceinstance 0
  1. 配置 VPP2 memif interface 的 IP address:
vpp# set int state memif0/0 upvpp# set int ip address memif0/0 10.10.2.2/24 vpp# show interface addr
local0 (dn):
memif0/0 (up):L3 10.10.2.2/24
  1. Ping from vpp1 to vpp2
vpp# ping 10.10.2.2
116 bytes from 10.10.2.2: icmp_seq=2 ttl=64 time=24.0039 ms

二、L3 Routing

初始状态下,Linux Host 是无法与 VPP2 进行通信的,但可以使用 VPP1 充当 L3 Router 的角色,使得处于不同 LAN 的 Host 与 VPP2 可以通信。

$ ping 10.10.2.2
PING 10.10.2.2 (10.10.2.2) 56(84) bytes of data.
  1. Setup host route
$ sudo ip route add 10.10.2.0/24 via 10.10.1.2 dev vpp1host$ route -ne
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
...
10.10.2.0       10.10.1.2       255.255.255.0   UG        0 0          0 vpp1host
  1. Setup return route on vpp2(回程路由)
vpp# ip route add 10.10.1.0/24 table 0 via 10.10.2.1 memif0/0

NOTE:VPP 的 ip route 指令详情如下:

ip route [add|del] <dst-ip-addr>/<width>[count <n>] [table <table-id>][via <next-hop-ip-addr> [<interface>] [weight <weight>]] |[via arp <interface> <adj-hop-ip-addr>] |[via drop|punt|local<id>|arp|classify <classify-idx>][lookup in table <out-table-id>]
  1. Ping from host through vpp1 to vpp2
$ ping 10.10.2.2
PING 10.10.2.2 (10.10.2.2) 56(84) bytes of data.
64 bytes from 10.10.2.2: icmp_seq=1 ttl=63 time=25.2 ms
...
  1. 查看 VPP1 的路由表:
vpp# show ip fib
ipv4-VRF:0, fib_index:0, flow hash:[src dst sport dport proto ] epoch:0 flags:none locks:[adjacency:1, default-route:1, ]
0.0.0.0/0unicast-ip4-chain[@0]: dpo-load-balance: [proto:ip4 index:1 buckets:1 uRPF:0 to:[0:0]][0] [@0]: dpo-drop ip4
0.0.0.0/32unicast-ip4-chain[@0]: dpo-load-balance: [proto:ip4 index:2 buckets:1 uRPF:1 to:[0:0]][0] [@0]: dpo-drop ip4
10.10.1.0/32unicast-ip4-chain[@0]: dpo-load-balance: [proto:ip4 index:10 buckets:1 uRPF:9 to:[0:0]][0] [@0]: dpo-drop ip4
10.10.1.1/32unicast-ip4-chain[@0]: dpo-load-balance: [proto:ip4 index:13 buckets:1 uRPF:12 to:[5:456] via:[12:1008]][0] [@5]: ipv4 via 10.10.1.1 host-vpp1out: mtu:9000 next:3 225be36a2c8502fed6f5de030800
10.10.1.0/24unicast-ip4-chain[@0]: dpo-load-balance: [proto:ip4 index:9 buckets:1 uRPF:8 to:[0:0]][0] [@4]: ipv4-glean: [src:10.10.1.0/24] host-vpp1out: mtu:9000 next:1 ffffffffffff02fed6f5de030806
10.10.1.2/32unicast-ip4-chain[@0]: dpo-load-balance: [proto:ip4 index:12 buckets:1 uRPF:13 to:[20:1776]][0] [@2]: dpo-receive: 10.10.1.2 on host-vpp1out
10.10.1.255/32unicast-ip4-chain[@0]: dpo-load-balance: [proto:ip4 index:11 buckets:1 uRPF:11 to:[0:0]][0] [@0]: dpo-drop ip4
10.10.2.0/32unicast-ip4-chain[@0]: dpo-load-balance: [proto:ip4 index:15 buckets:1 uRPF:16 to:[0:0]][0] [@0]: dpo-drop ip4
10.10.2.0/24unicast-ip4-chain[@0]: dpo-load-balance: [proto:ip4 index:14 buckets:1 uRPF:19 to:[1:96]][0] [@4]: ipv4-glean: [src:10.10.2.0/24] memif0/0: mtu:9000 next:2 ffffffffffff02fe04a310160806
10.10.2.1/32unicast-ip4-chain[@0]: dpo-load-balance: [proto:ip4 index:17 buckets:1 uRPF:20 to:[9:864]][0] [@2]: dpo-receive: 10.10.2.1 on memif0/0
10.10.2.2/32unicast-ip4-chain[@0]: dpo-load-balance: [proto:ip4 index:18 buckets:1 uRPF:22 to:[9:804] via:[5:480]][0] [@5]: ipv4 via 10.10.2.2 memif0/0: mtu:9000 next:4 02fe1cb3f28e02fe04a310160800
10.10.2.255/32unicast-ip4-chain[@0]: dpo-load-balance: [proto:ip4 index:16 buckets:1 uRPF:18 to:[0:0]][0] [@0]: dpo-drop ip4
224.0.0.0/4unicast-ip4-chain[@0]: dpo-load-balance: [proto:ip4 index:4 buckets:1 uRPF:3 to:[0:0]][0] [@0]: dpo-drop ip4
240.0.0.0/4unicast-ip4-chain[@0]: dpo-load-balance: [proto:ip4 index:3 buckets:1 uRPF:2 to:[0:0]][0] [@0]: dpo-drop ip4
255.255.255.255/32unicast-ip4-chain[@0]: dpo-load-balance: [proto:ip4 index:5 buckets:1 uRPF:4 to:[0:0]][0] [@0]: dpo-drop ip4

FD.io/VPP — L3 vRouter相关推荐

  1. FD.io VPP基本介绍:理解向量包处理(VPP)

    FD.io VPP:用户文档 向量包处理器 RToax 2020年9月 1. 什么是向量包处理器(VPP) FD.io的矢量包处理器(VPP)是一个快速,可扩展的2-4层多平台网络协议栈.它在Linu ...

  2. FD.io VPP环境下运行用户应用程序教程

    FD.io VPP环境下运行用户应用程序教程 RToax 2020年9月 相关文章:<FD.io VPP利用iperf3进行UDP灌包测试-英特尔X520万兆网卡> 1. VPP简介 VP ...

  3. FD.io VPP利用iperf3进行UDP灌包测试-英特尔X520万兆网卡

    FD.io VPP:用户文档 iperf3灌包测试 RToax 2020年9月 架构 1. VPP环境配置与启动 1.1. 安装VPP环境 略 1.2. VPP配置文件 启动配置文件startup-i ...

  4. FD.io VPP 使用场景-用例

    目录 路由器/通用CPE等 宽带网络网关 云负载均衡器 入侵防御系统 部署模型 离散电器 虚拟网络功能 FD.io是一种联网技术,可用于构建网络功能星系.如今,一些主要的通信网络提供商和设备制造商正在 ...

  5. FD.io/VPP — 常用指令集合

    目录 文章目录 目录 前言 System Level Interface Add NIC into VPP as Interface Interface State Hardware Interfac ...

  6. FD.io/VPP — Overview

    目录 文章目录 目录 FD.io VPP FD.io 官网:https://fd.io FD.io(Fast data – Input/Output)是 Linux 基金会下属的一个开源项目,成立于 ...

  7. FD.io VPP 20.09版本正式发布:往期VPP文章回顾+下载地址+相关链接

    目录 下载RPM/DEB包 往期文章回顾与推荐 FD.io是一些项目和库的集合,基于DPDK并逐渐演化,支持在通用硬件平台上部署灵活可变的业务.FD.io为软件定义基础设施的开发者提供了一个通用平台, ...

  8. FD.io VPP:探究分段场景下vlib_buf在收发包的处理(dpdk_plugin.so)、rte_mbuf与vlib_buf 关系

    Table of Contents rte_mbuf.vlib_buf 关系及内存分布 使用dpdk-收包接口函数 使用dpdk 发包接口函数 总结 参考阅读 在使用vpp老版本copy报文的时候,经 ...

  9. FD.io VPP:vlib buffer pool(vlib_buffer) 内存初始化

    Table of Contents vlib buffer创建过程 vlib_buffer相关内存初始化 1.函数一开始就查询numa的个数 2.遍历numa节点来初始化 3.查询系统大页大小. 4. ...

最新文章

  1. Hibernate Validation与Spring整合各注解的用法Demo
  2. pl/sql 报ORA-12154: TNS:无法解析指定的连接标志符
  3. 全球及中国混凝土地板行业投资模式分析及前景战略规划报告2022-2027年版
  4. NHibernate+MySql (erro 解决方法)
  5. Lesson_7 上课笔记_1 ----static关键字和导包
  6. 1-3月我国软件业务收入同比增长12.9%
  7. 面试阿里挂了却拿到网易、点我达offer,一个三年经验Java程序员的面试总结
  8. C#中combobox不可编辑与不可选择
  9. 站在巨人的肩膀上学习Android开发
  10. PHP配置问题(找不到指定模块)解决办法
  11. JNI:需要显式指定使用jar的全路径
  12. 『号外』 排名进入2000!再创佳绩!
  13. paypal支付交易数据
  14. 配置静态IP失败总结
  15. 多传感器数据融合发展综述
  16. Android文字广告(Textview上下滚动),使用TextSwitcher控件实现
  17. 阵列分组,不足数,补足
  18. 研究方向三选一选择FPGA/计算机视觉/故障检测
  19. React 常见面试题
  20. C语言——结构体(入门详解)

热门文章

  1. 数据表示字面量整型字面量
  2. rstudio怎么安装ggplot2_如何基于ggplot2构建相关系数矩阵热图
  3. leetcode c程序总提示主函数_帅气中国小哥出“大招”,程序员跳槽面试刷题必备...
  4. 陈桥五笔用户编号怎么获取_委托书中“样品原编号”怎么填?
  5. 回文数猜想代码c语言,跪求用C++写出回文数猜想程序,课程设计需要,谢谢。。。...
  6. 基于AI的便携式神经假肢让截肢14年患者操作自如,高精度、低延迟
  7. Linux启动加载过程解析
  8. JAVA实现重建二叉树(《剑指offer》)
  9. 步子太快容易牺牲精度,梯度下降复杂度这一简单道理,获严格数学证明
  10. 视频台词现在不用背也不用配,连对口型都免了