【问题标题】:How many vrf does linux kernel support and what system resource limits the vrf numbers?linux内核支持多少vrf,哪些系统资源限制了vrf数量?
【发布时间】:2016-11-17 07:13:29
【问题描述】:

Linux 内核现在支持全新的 vrf(虚拟路由和转发)架构,这与旧的网络命名空间解决方案不同。

问题:

  1. linux内核支持多少vrf?
  2. 什么系统资源限制了 vrf 容量?

我是内核源代码的新手,找不到关于上面两个问题的信息。

我编写了一个脚本来添加 4096 vrf 并在 openswitch x86 docker 容器中设置 vrf 设备,一切正常。

脚本:

def main():
    for i in range(0, 4096):
        cmd("ip link add vrf%d type vrf table %d"%(i,i))
        sleep(50)
        cmd("ip link set dev vrf%d up"%i)
        sleep(50)
main()

日志:

root@switch:~# ip link add vrf0 type vrf table 0 
root@switch:~# ip link set dev vrf0 up 
...
root@switch:~# ip link add vrf4095 type vrf table 4095 
root@switch:~# ip link set dev vrf4095 up 
root@switch:~# ip -d link show type vrf vrf4095
4098: vrf4095: <NOARP,MASTER,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether 22:78:87:9d:ca:81 brd ff:ff:ff:ff:ff:ff promiscuity 0 
    vrf table 4095 addrgenmode eui64 
root@switch:~# ip -d link show type vrf | grep "NOARP,MASTER" | wc
4097   61455  485311
root@switch:~# uname -a
Linux switch 4.4.0-45-generic #66-Ubuntu SMP Wed Oct 19 14:12:37 UTC 2016 x86_64 GNU/Linux

我的参考:

  1. Documentation/networking/vrf.txt
  2. drivers/net/vrf.c

【问题讨论】:

    标签: linux networking linux-kernel routing


    【解决方案1】:

    似乎您可以创建的 VRF 数量没有限制,唯一的限制是内存大小(为您创建的每个 VRF netdev 分配内存)和 ifindex 类型限制(它是 int,通常是32位),非常高。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-11-13
      • 1970-01-01
      • 1970-01-01
      • 2022-10-21
      • 1970-01-01
      • 2014-12-19
      • 1970-01-01
      相关资源
      最近更新 更多