如何在Ubuntu / Debian中创build20个以上的vxlan接口?
在Linux内核3.16中,我发现我可以创build20个以上的vxlan接口,但是在发送arp消息时无法正常工作。
在Linux Kernel 4.4中,当创build21'st接口时,出现“ RTNETLINK答案:没有可用的缓冲区空间 ”的错误信息
我已经通过创build一个小的shell脚本testing了这个脚本,它在一个新的ubuntu 14.04&16.04上创build了接口,并在Debian 8上testing了这个脚本。
脚本testvxlan.sh看起来像这样:
#!/bin/bash for i in {1..30} do echo "Setting up interface br0.$i" ip link add br0.$i type vxlan id $i group 239.0.0.$i dev eth0 dstport 4789 ip addr add 192.168.$i.1/24 dev br0.$i ip link set dev br0.$i up #ip link delete br0.$i done
当在新鲜的Ubuntu 16.04上运行时,它看起来像这样:
root@ubuntu-xenial:~# ./testvxlan.sh Setting up interface br0.1 Setting up interface br0.2 Setting up interface br0.3 Setting up interface br0.4 Setting up interface br0.5 Setting up interface br0.6 Setting up interface br0.7 Setting up interface br0.8 Setting up interface br0.9 Setting up interface br0.10 Setting up interface br0.11 Setting up interface br0.12 Setting up interface br0.13 Setting up interface br0.14 Setting up interface br0.15 Setting up interface br0.16 Setting up interface br0.17 Setting up interface br0.18 Setting up interface br0.19 Setting up interface br0.20 Setting up interface br0.21 RTNETLINK answers: No buffer space available Setting up interface br0.22 RTNETLINK answers: No buffer space available Setting up interface br0.23 RTNETLINK answers: No buffer space available Setting up interface br0.24 RTNETLINK answers: No buffer space available Setting up interface br0.25 RTNETLINK answers: No buffer space available Setting up interface br0.26 RTNETLINK answers: No buffer space available Setting up interface br0.27 RTNETLINK answers: No buffer space available Setting up interface br0.28 RTNETLINK answers: No buffer space available Setting up interface br0.29 RTNETLINK answers: No buffer space available Setting up interface br0.30 RTNETLINK answers: No buffer space available
我怎样才能增加这个缓冲空间,甚至可能呢?
由于您使用了多播vxlan,所以限制实际上是IGMP成员关系的最大数量:
[root@cpu1 ~]# cat /proc/sys/net/ipv4/igmp_max_memberships 20
你可以提高这个限制,并且应该能够启动超过20个vxlans:
[root@cpu1 ~]# echo 100 >/proc/sys/net/ipv4/igmp_max_memberships
如果你希望这个改变在重启时保持不变,你需要把下面的代码添加到/etc/sysctl.conf或/etc/sysctl.d/中:
net.ipv4.igmp_max_memberships = 100
我们一直在广泛地使用多播vxlans,在单个节点中有200多个, igmp_max_memberships设置为400 …
除了大量的igmp报告之外,往往会在交换机上发出igmp snooping问题。
因此,我们每256个新的vxlans创build一个新的组,分隔vni的租户。
YMMV,但snooping是限制多播广播域的好方法,即使在具有有限窥探表的elcheapo交换机上也是如此。 无论如何vni字段是16位,所以你可以很容易地适应65535 vxlans在一个MC组。
for grp in `seq 1 4` ; do for vni in `seq 1 64` ; do echo ip link add vx-`printf "%04x" $(($grp*$vni))` type vxlan id $vni group 239.0.1.$grp dev bkpln dstport 4789 done done | sh -x