vxlan tunnel收发原理

该博客介绍了Linux内核中VXLAN设备的优化,允许将VXLAN设备置于一种新的基于流的模式,从而实现按需收集和处理隧道元数据,提高大规模隧道端点和ID的处理能力。这种优化减少了额外的处理成本,并为Open vSwitch移除特定VXLAN代码铺平道路。在接收到VXLAN报文后,通过软中断和流分类机制进行处理,利用tcflowerfilter进行匹配和转发决策。

 

commit ee122c79d4227f6ec642157834b6a90fcffa4382
Author: Thomas Graf <tgraf@suug.ch>
Date:   Tue Jul 21 10:43:58 2015 +0200

    vxlan: Flow based tunneling

    Allows putting a VXLAN device into a new flow-based mode in which
    skbs with a ip_tunnel_info dst metadata attached will be encapsulated
    according to the instructions stored in there with the VXLAN device
    defaults taken into consideration.

    Similar on the receive side, if the VXLAN_F_COLLECT_METADATA flag is
    set, the packet processing will populate a ip_tunnel_info struct for
    each packet received and attach it to the skb using the new metadata
    dst.  The metadata structure will contain the outer header and tunnel
    header fields which have been stripped off. Layers further up in the
    stack such as routing, tc or netfitler can later match on these fields
    and perform forwarding. It is the responsibility of upper layers to
    ensure that the flag is set if the metadata is needed. The flag limits
    the additional cost of metadata collecting based on demand.

    This prepares the VXLAN device to be steered by the routing and other
    subsystems which allows to support encapsulation for a large number
    of tunnel endpoints and tunnel ids through a single net_device which
  &n

### VXLAN 配置教程及工作原理详解 #### 一、VXLAN 工作原理概述 虚拟可扩展局域网 (Virtual eXtensible Local Area Network, VXLAN) 是一种用于解决大型数据中心内部二层网络隔离问题的技术。它通过在网络层封装原始以太帧,从而允许跨越三层网络传输二层流量[^3]。 具体来说,在 VXLAN 实现中,当通过组播实现控制平面路径发现时,VTEP 设备之间使用无状态隧道,这些设备间不保持持久化连接。为了使数据包能够被正确转发到目标位置,VXLAN 要求在本地建立包含 VNI(VXLAN 网络标识符)、内源MAC 地址以及外源IP地址这三项要素构成的映射关系表项[^2]。 #### 二、VXLAN 的配置流程 ##### 1. 创建并配置 VTEPs VTEP(VXLAN Tunnel End Point),即 VXLAN 隧道终结点,负责处理进入或离开 VXLAN 域的数据流转换任务。通常情况下,这类组件是由具备相应功能模块的支持硬件路由器/交换机担任,并由专业的 IT 运维人员来进行初始化设置与参数调整[^1]。 ```bash # 示例命令:创建一个新的 VTEP 接口 switch(config)# interface vxlan vtep-name ``` ##### 2. 定义 VXLAN Overlay 网络属性 在此阶段需指定所使用的 VLAN ID 和对应的 VXLAN 网络ID (VNI),同时还要指明参与该覆盖网络通信的所有远程站点的信息,比如它们各自的 IP 地址等细节内容。 ```bash # 示例命令:关联物理接口至特定 VXLAN overlay network switch(config-if-vxlan)# member vni <vni-id> switch(config-if-vxlan-member-vni)# mcast-group <multicast-ip-address> ``` ##### 3. 设置 ARP 表同步机制 为了让不同地理位置上的主机可以互相识别对方的存在,必须确保各个节点间的ARP缓存得到及时更新。为此可以在 VTEP 上启用动态学习模式或是静态预设的方式完成此项操作。 ```bash # 示例命令:开启自动学习远端 MAC 地址的功能 switch(config-if-vxlan-member-vni)# flooding reduce ``` 以上就是关于 VXLAN 技术的基础介绍及其典型应用场景下的部署指南。值得注意的是实际环境中可能还会涉及到更多复杂的因素考量,因此建议读者深入研究官方文档获取最权威指导信息。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值