hbugs001 发表于 5 天前

实验案例:华为 CE6800 跑通 VXLAN 分布式网关

<h1>实验案例:华为 CE6800 跑通 VXLAN 分布式网关(Spine-Leaf + M-LAG + BGP EVPN,12 节点 / 28 链路)</h1>
<p>用 <strong>eNSP Pro 移植的华为镜像</strong>在 EVE-NG 里做 IPv4 单栈版本。<br />
对应工程 <code>IaC/vxlan-dist-gw/</code>,验收脚本 <code>tools/vxlan-dist-gw-verify.js</code>。</p>
<p><img src="data/attachment/forum/202611/05/003719gb46b6btgnn4db5x.png" alt="topology.png" title="topology.png" /></p>
<p><img src="data/attachment/forum/202611/05/003748iz5jr4ajghflj5d4.png" alt="image.png" title="image.png" /></p>
<p><a href="forum.php?mod=attachment&amp;aid=3643" title="attachment"><img src="/source/plugin/zhanmishu_markdown/template/editor/images/upload.svg" alt="upload" /> 附件:vxlan-dist-gw.zip</a></p>
<h2>0. 实测结果</h2>
<table>
<thead>
<tr>
<th>项目</th>
<th>结果</th>
</tr>
</thead>
<tbody>
<tr>
<td>基础验收</td>
<td><strong>30/30 通过</strong></td>
</tr>
<tr>
<td>含故障切换(<code>--fault</code>,停 Leaf1)</td>
<td><strong>33/33 通过</strong></td>
</tr>
<tr>
<td>OSPF 邻居</td>
<td>Spine 各 4 个 Full、Leaf 各 2 个 Full</td>
</tr>
<tr>
<td>BGP EVPN 邻居</td>
<td>Spine 4 个 Established、Leaf 2 个 Established</td>
</tr>
<tr>
<td>M-LAG</td>
<td>4 台 leaf 的 <code>m-lag 1/2</code> 均 <code>active(*)-active</code>;两台 Spine 的 peer-link 两成员均 Selected</td>
</tr>
<tr>
<td>东西向</td>
<td>同网段跨对 5/5 TTL 64;跨 BD 同对 5/5 TTL 63;跨 BD 跨对 5/5 TTL 62</td>
</tr>
<tr>
<td>南北向</td>
<td>服务器 ↔ 公网双向 5/5,TTL 61</td>
</tr>
<tr>
<td>故障切换</td>
<td>停 Leaf1 后 SRV-A→SRV-B 仍 5/5 <code>ttl=63</code>、→Internet 仍 5/5 <code>ttl=61</code>,Leaf2 侧 m-lag 1 变 <code>active(*)-inactive</code></td>
</tr>
</tbody>
</table>
<blockquote>
<p>实测日期 <strong>2026-11-04</strong>;镜像 <code>huaweice6800_YunShan</code>(eNSP Pro 移植,CE6800 V300)、<br />
<code>huaweiar6700</code>(AR6700)、<code>eve-gui-server</code>(docker)。EVE 侧版本不同,控制台行为可能不一样。</p>
</blockquote>
<h2>1. 这个实验解决什么</h2>
<p>文章里的架构有三个卖点,这个实验逐个验证它们<strong>真的在转发</strong>:</p>
<ol>
<li><strong>M-LAG 双活</strong>:两台 leaf 组成一台逻辑设备,服务器双网卡分别接两台、做 bond,<br />
任意一台 leaf 挂掉服务器不掉线。</li>
<li><strong>分布式网关</strong>:每台 leaf 都有本地 BD 的网关,跨 BD 流量在入口 leaf 就完成三层转发,<br />
不绕 spine。</li>
<li><strong>BGP EVPN</strong>:VNI 成员关系(type-3)和跨 BD 前缀(type-5)都由 EVPN 承载,<br />
没有一条静态 VXLAN 隧道。</li>
</ol>
<p>顺带把「<strong>怎么证明它真的在转发</strong>」这件事做成可复现的判据——TTL 阶梯 + 故意不亮的过滤器。</p>
<h2>2. 镜像与规格</h2>
<table>
<thead>
<tr>
<th>模板 id</th>
<th>设备</th>
<th>数量</th>
<th>内存</th>
<th>角色</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>huaweice6800_YunShan</code></td>
<td>CE6800</td>
<td>6</td>
<td>4 GB</td>
<td>Spine1/2(RR + 出口)、Leaf1~4(分布式网关)</td>
</tr>
<tr>
<td><code>huaweiar6700</code></td>
<td>AR6700</td>
<td>1</td>
<td>4 GB</td>
<td>PE1,南北向出口路由器</td>
</tr>
<tr>
<td><code>eve-gui-server</code></td>
<td>docker</td>
<td>5</td>
<td>小</td>
<td>SRV-A~D(双网卡)+ Internet</td>
</tr>
</tbody>
</table>
<p>网络设备 7 台 × 4 GB = <strong>约 28 GB</strong>,另加 5 台轻量 docker 容器(各几百 MB,不在这 28 GB 里)。<br />
部署前先确认宿主机放得下。</p>
<p><strong>这是二阶段配置设备</strong>:<code>system-view</code> 下改完要 <code>commit</code> 才生效,<br />
提示符 <code>[*Name]</code> = 有未提交改动,<code>[~Name]</code> = 已提交未保存,<code></code> = 干净。</p>
<h2>3. 拓扑与地址</h2>
<blockquote>
<p>配图:<code>figures/vxlan-dist-gw-topology.png</code>(2800×1520,源文件同名 <code>.svg</code>)</p>
</blockquote>
<pre><code>                  ┌──────────┐   peer-link Eth-Trunk1   ┌──────────┐
                  │Spine1│══ (GE1/0/7, GE1/0/8) ══│Spine2│
                  │4.4.4.4 │   GE1/0/9 = DAD          │5.5.5.5 │
                  │ VTEP 1.1.1.1 ═════════════════════│VTEP1.1.1.1│
                  └─┬─┬─┬─┬──┘                         └─┬─┬─┬─┬─┘
    192.168.1~4.0/24│ │ │ │                           │ │ │ │192.168.5~8.0/24
                  ┌──┘ │ │ └──┐                     ┌───┘ │ │ └──┐
             ┌────┴──┐ ┌┴──┴─┐┌┴─────┐          ┌───┴──┐┌─┴──┴─┐
             │ Leaf1 │ │Leaf2 ││Leaf3 │          │Leaf4 ││ ...│
             │ 6.6.6.6││7.7.7.7││8.8.8.8│         │9.9.9.9││      │
             │VTEP2.2.2.2(对)││VTEP3.3.3.3(对)│└──────┘└──────┘
             └─┬──┬──┘└──┬──┬─┘└─┬──┬──┘
      Eth-Trunk2││      ││    ││peer-link(GE1/0/3,4)
               SRV-A ─────┘└────┘└──── SRV-D
               SRV-B                  SRV-C
</code></pre>
<blockquote>
<p>ASCII 图只示意连法,节点位置和链路走向<strong>以 PNG 为准</strong>。<br />
Spine1/2 之间那条 <code>═</code> 只表示两端 VTEP 地址相同,<strong>不是 VXLAN 隧道</strong>——<br />
anycast VTEP 的目的就是让对端用一个地址到达这一对,两台之间不需要建隧道。</p>
</blockquote>
<h3>Loopback 与 anycast VTEP</h3>
<table>
<thead>
<tr>
<th>设备</th>
<th>LoopBack0(router-id)</th>
<th>LoopBack1(VTEP)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Spine1</td>
<td><code>4.4.4.4/32</code></td>
<td><code>1.1.1.1/32</code></td>
</tr>
<tr>
<td>Spine2</td>
<td><code>5.5.5.5/32</code></td>
<td><code>1.1.1.1/32</code></td>
</tr>
<tr>
<td>Leaf1</td>
<td><code>6.6.6.6/32</code></td>
<td><code>2.2.2.2/32</code></td>
</tr>
<tr>
<td>Leaf2</td>
<td><code>7.7.7.7/32</code></td>
<td><code>2.2.2.2/32</code></td>
</tr>
<tr>
<td>Leaf3</td>
<td><code>8.8.8.8/32</code></td>
<td><code>3.3.3.3/32</code></td>
</tr>
<tr>
<td>Leaf4</td>
<td><code>9.9.9.9/32</code></td>
<td><code>3.3.3.3/32</code></td>
</tr>
</tbody>
</table>
<p><strong>每一对设备共用 VTEP IP 和 Nve1 MAC</strong>——对端只需要一个地址就能到这对里的任意一台:</p>
<table>
<thead>
<tr>
<th>对</th>
<th>VTEP IP</th>
<th>Nve1 MAC</th>
</tr>
</thead>
<tbody>
<tr>
<td>Spine1 / Spine2</td>
<td><code>1.1.1.1</code></td>
<td><code>0000-5e00-0101</code></td>
</tr>
<tr>
<td>Leaf1 / Leaf2</td>
<td><code>2.2.2.2</code></td>
<td><code>0000-5e00-0102</code></td>
</tr>
<tr>
<td>Leaf3 / Leaf4</td>
<td><code>3.3.3.3</code></td>
<td><code>0000-5e00-0103</code></td>
</tr>
</tbody>
</table>
<h3>Underlay</h3>
<table>
<thead>
<tr>
<th>段</th>
<th>网段</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>Spine1 ↔ Leaf1~4</td>
<td><code>192.168.1.0/24</code> ~ <code>192.168.4.0/24</code></td>
<td>OSPF p2p,Spine 侧 .1</td>
</tr>
<tr>
<td>Spine2 ↔ Leaf1~4</td>
<td><code>192.168.5.0/24</code> ~ <code>192.168.8.0/24</code></td>
<td>同上</td>
</tr>
<tr>
<td>Spine1 ↔ Spine2 DAD</td>
<td><code>10.10.10.0/30</code></td>
<td>dual-active detection</td>
</tr>
<tr>
<td>Leaf1 ↔ Leaf2 DAD</td>
<td><code>10.10.20.0/30</code></td>
<td>同上</td>
</tr>
<tr>
<td>Leaf3 ↔ Leaf4 DAD</td>
<td><code>10.10.30.0/30</code></td>
<td>同上</td>
</tr>
<tr>
<td>Spine1/2 ↔ PE1</td>
<td><code>10.1.10.0/24</code>、<code>10.1.30.0/24</code></td>
<td>属于 <code>vpn1</code></td>
</tr>
</tbody>
</table>
<h3>租户与服务器</h3>
<p><code>ip vpn-instance vpn1</code>,L3VNI <code>5000</code>,RD <code>&lt;router-id&gt;:1</code>,RT <code>0:1</code>。</p>
<table>
<thead>
<tr>
<th>BD</th>
<th>VNI</th>
<th>网关</th>
<th>网关 MAC</th>
<th>RT</th>
<th>服务器</th>
<th>双归到</th>
</tr>
</thead>
<tbody>
<tr>
<td>BD10</td>
<td>10</td>
<td><code>10.1.1.1/24</code></td>
<td><code>0000-5e00-0105</code></td>
<td><code>0:10</code></td>
<td>SRV-A <code>10.1.1.11</code></td>
<td>Leaf1/2 Eth-Trunk2</td>
</tr>
<tr>
<td>BD20</td>
<td>20</td>
<td><code>10.1.2.1/24</code></td>
<td><code>0000-5e00-0106</code></td>
<td><code>0:20</code></td>
<td>SRV-B <code>10.1.2.11</code></td>
<td>Leaf1/2 Eth-Trunk3</td>
</tr>
<tr>
<td>BD20</td>
<td>20</td>
<td>同上</td>
<td>同上</td>
<td>同上</td>
<td>SRV-C <code>10.1.2.12</code></td>
<td>Leaf3/4 Eth-Trunk2</td>
</tr>
<tr>
<td>BD30</td>
<td>30</td>
<td><code>10.1.3.1/24</code></td>
<td><code>0000-5e00-0107</code></td>
<td><code>0:30</code></td>
<td>SRV-D <code>10.1.3.12</code></td>
<td>Leaf3/4 Eth-Trunk3</td>
</tr>
</tbody>
</table>
<p>BD20 横跨两对 leaf —— 这正是「同网段跨 leaf 对走纯二层 VXLAN」的验证场景。</p>
<h2>4. 关键设计</h2>
<ol>
<li><strong>anycast 网关四要素</strong>:同一个 <code>Vbdif</code> 地址 + 同一个 MAC +<br />
<code>vxlan anycast-gateway enable</code> + <code>arp collect host enable</code>。<br />
少了 <code>arp collect host</code>,远端主机的 ARP 学不到,主机路由也就没有。</li>
<li><strong>Spine 双角色</strong>:既是 BGP RR(<code>reflect-client</code>),又是南北向的 L3VNI 网关。<br />
出口默认路由用 <code>network 0.0.0.0 0.0.0.0</code> 通告成 type-5。</li>
<li><strong>monitor-link</strong>:leaf 上把上行和下行绑成一组,上行全断时把下行口拉 down,<br />
逼服务器切到另一台 leaf。</li>
<li><strong><code>stp v-stp enable</code> + <code>stp bridge-address 1-1-1</code></strong>:M-LAG 对要当成一台桥,<br />
V-STP 是前提。</li>
<li><strong>三对 M-LAG 复用同一个 <code>bridge-address 1-1-1</code> 为什么没事</strong>:对内必须相同,<br />
不同对之间本该错开。本实验能复用是因为三对之间<strong>没有二层通路</strong>——<br />
跨对只走 underlay 三层和 VXLAN,BPDU 不跨三层、VXLAN 也不传 BPDU,<br />
三个 STP 域天生隔离。生产环境若对之间有二层延伸(比如 DCI 打二层),<br />
必须改成不同地址,否则会并成一个 STP 域、选主冲突。</li>
</ol>
<h2>5. 核心配置</h2>
<blockquote>
<p>下面都是节选,完整预配在 <code>IaC/vxlan-dist-gw/configs/</code>。<br />
两条通用前提:<strong>CE6800 的 GE 口默认是二层,要做三层必须先 <code>undo portswitch</code></strong>;<br />
所有接口/BD 改完要 <code>commit</code>。</p>
</blockquote>
<h3>5.1 Spine1(节选:省略 Eth-Trunk1 成员口、GE1/0/2~4 的重复段;Spine2 同构)</h3>
<pre><code>sysname Spine1
stp mode rstp
stp v-stp enable
stp bridge-address 1-1-1
evpn-overlay enable
#
dfs-group 1
priority 150
source ip 4.4.4.4
dual-active detection source ip 10.10.10.1 peer 10.10.10.2
#
ip vpn-instance vpn1
vxlan vni 5000
ipv4-family
route-distinguisher 4.4.4.4:1
vpn-target 0:1 export-extcommunity evpn
vpn-target 0:1 import-extcommunity evpn
#
interface LoopBack0
ip address 4.4.4.4 32
interface LoopBack1
ip address 1.1.1.1 32
#
interface GE1/0/1
undo portswitch
ip address 192.168.1.1 24
ospf network-type p2p
#… GE1/0/2~4 分别接 Leaf2/3/4
interface GE1/0/5
undo portswitch
ip binding vpn-instance vpn1
ip address 10.1.10.1 24
#
interface Eth-Trunk1
mode lacp-dynamic
peer-link 1
#
interface Nve1
source 1.1.1.1
mac-address 0000-5e00-0101
vni 5000 head-end peer-list protocol bgp
#
bgp 100
router-id 4.4.4.4
peer 6.6.6.6 as-number 100
peer 6.6.6.6 connect-interface LoopBack0
# … 7.7.7.7 / 8.8.8.8 / 9.9.9.9 同形
ipv4-family vpn-instance vpn1
import-route static
network 0.0.0.0 0.0.0.0
advertise l2vpn evpn
l2vpn-family evpn
undo policy vpn-target
peer 6.6.6.6 enable
peer 6.6.6.6 advertise irb
peer 6.6.6.6 reflect-client
#
ip route-static vpn-instance vpn1 0.0.0.0 0.0.0.0 10.1.10.2
</code></pre>
<blockquote>
<p><strong>Spine2 不能只换互联地址</strong>:Loopback 换成 <code>5.5.5.5</code>/<code>1.1.1.1</code>,互联地址换成<br />
<code>192.168.5~8.0/24</code> 和 <code>10.1.30.1</code>,<strong>默认路由下一跳要改成 <code>10.1.30.2</code></strong><br />
(PE1 在 <code>10.1.30.0/24</code> 上的地址)。写错了不会报错,只会南北向静默不通。</p>
</blockquote>
<blockquote>
<p><strong>注意 OSPF 放在整份配置的最后</strong>。<code>peer X enable</code> 在邻居已建立时会弹<br />
<code>Warning: This operation will reset the peer session. Continue? :</code>,<br />
这个交互提示会把后面推送的配置行当答案吃掉。把 OSPF 挪到最后,<br />
推 BGP 时邻居还起不来,就不会弹。</p>
</blockquote>
<h3>5.2 Leaf1(节选:省略 BD20 / Vbdif20 / Eth-Trunk3 等同构段;Leaf2 同构,Leaf3/4 换成 BD20+BD30、VTEP <code>3.3.3.3</code>)</h3>
<pre><code>sysname Leaf1
stp mode rstp
stp v-stp enable
stp bridge-address 1-1-1
evpn-overlay enable
#
dfs-group 1
priority 150
source ip 6.6.6.6
dual-active detection source ip 10.10.20.1 peer 10.10.20.2
#
ip vpn-instance vpn1
vxlan vni 5000
ipv4-family
route-distinguisher 6.6.6.6:1
vpn-target 0:1 export-extcommunity evpn
vpn-target 0:1 import-extcommunity evpn
#
bridge-domain 10
vxlan vni 10
evpn
route-distinguisher 6.6.6.6:10
vpn-target 0:10 export-extcommunity
vpn-target 0:1 export-extcommunity      # 同时带 L3VNI 的 RT,见下方说明
vpn-target 0:10 import-extcommunity
#
interface Eth-Trunk1
mode lacp-dynamic
peer-link 1
interface Eth-Trunk2
mode lacp-dynamic
dfs-group 1 m-lag 1
stp edged-port enable
interface Eth-Trunk2.10 mode l2
encapsulation dot1q vid 10
bridge-domain 10
#
interface Vbdif10
ip binding vpn-instance vpn1
ip address 10.1.1.1 24
mac-address 0000-5e00-0105
vxlan anycast-gateway enable
arp collect host enable               # 不收主机 ARP 就没有主机路由
#
interface Nve1
source 2.2.2.2
mac-address 0000-5e00-0102
vni 10 head-end peer-list protocol bgp
vni 20 head-end peer-list protocol bgp
#
monitor-link group 1
port GE1/0/1 uplink
port GE1/0/2 uplink
port Eth-Trunk2 downlink 1
port Eth-Trunk3 downlink 2
#
bgp 100
router-id 6.6.6.6
ipv4-family vpn-instance vpn1
import-route direct
advertise l2vpn evpn
l2vpn-family evpn
peer 4.4.4.4 enable
peer 4.4.4.4 advertise irb
peer 5.5.5.5 enable                  # 两台 Spine 都要建邻居,否则 RR 挂一台就断
peer 5.5.5.5 advertise irb
</code></pre>
<blockquote>
<p><strong>BD 为什么要 export L3VNI 的 RT <code>0:1</code></strong>:BD 的 type-2 路由(MAC/IP)只有同时带上<br />
<code>0:1</code>,VPN 实例那边才会把这些主机路由收进来,分布式的三层转发才有下一跳。<br />
只 export 不 import —— import 方向由 L3VNI 自己的 <code>0:1 import</code> 负责,<br />
这样 BD 不会把别的 BD 的路由搅进二层域。</p>
<p><strong>LEAF 的 BGP 邻居是两台 Spine</strong>:<code>4.4.4.4</code> 和 <code>5.5.5.5</code> 各一条,<br />
判据里「Leaf 2 个 Established」说的就是这个。</p>
</blockquote>
<h3>5.3 服务器(docker 启动配置是一段 shell)</h3>
<pre><code class="language-sh">ip link add bond0 type bond mode 802.3ad miimon 100 lacp_rate fast xmit_hash_policy layer3+4 || true
ip link set eth0 down || true
ip link set eth1 down || true
ip link set eth0 master bond0 || true
ip link set eth1 master bond0 || true
ip link set eth0 up || true
ip link set eth1 up || true
ip link set bond0 up || true
ip link add link bond0 name bond0.10 type vlan id 10 || true
ip link set bond0.10 up || true
ip addr add 10.1.1.11/24 dev bond0.10 || true
ip route add default via 10.1.1.1 || true
</code></pre>
<p>每行都带 <code>|| true</code> —— docker 镜像的启动配置是<strong>逐行执行</strong>的,任何一行失败会中断后面所有行。</p>
<h3>5.4 PE1</h3>
<pre><code>sysname PE1
interface GE0/0/0
ip address 10.1.10.2 24
interface GE0/0/1
ip address 10.1.30.2 24
interface GE0/0/2
ip address 10.0.0.1 24
ip route-static 10.1.0.0 255.255.0.0 10.1.10.1
ip route-static 10.1.0.0 255.255.0.0 10.1.30.1
</code></pre>
<h2>6. 复现步骤</h2>
<pre><code class="language-bash"># 1. 部署(拓扑 + 启动配置)
node tools/eve-mcp.js call eve_iac_plan      '{&quot;lab&quot;:&quot;vxlan-dist-gw&quot;}'
node tools/eve-mcp.js call eve_iac_reconcile '{&quot;lab&quot;:&quot;vxlan-dist-gw&quot;,&quot;confirm&quot;:true}'
node tools/eve-mcp.js call eve_iac_start   '{&quot;lab&quot;:&quot;vxlan-dist-gw&quot;}'

# 2. 等设备起来(6 台 CE6800 大概 10~15 分钟)
# 3. 逐台检查启动配置是否推全(见踩坑 8.1),不全就登录后逐行重推
# 4. 验收
node tools/vxlan-dist-gw-verify.js --skip-boot
node tools/vxlan-dist-gw-verify.js --skip-boot --fault
</code></pre>
<blockquote>
<p>上面的自动化依赖 EVE-MCP 工具链;没有这套工具的读者,按 §5 手工配、按 §7 的命令逐条验证,<br />
判据和结论完全一致。</p>
</blockquote>
<h2>7. 验收判据</h2>
<h3>7.1 控制面</h3>
<pre><code>display ospf peer brief          → Spine 4 个 Full,Leaf 2 个 Full
display bgp evpn peer            → Spine 4 个 Established,Leaf 2 个
display vxlan tunnel             → 每台 leaf 两条 up(1.1.1.1 / 对端 VTEP)
</code></pre>
<blockquote>
<p><code>display bgp evpn peer</code> 在<strong>本镜像实测可用</strong>;如果你的 CE 版本不认,<br />
换成 <code>display bgp evpn all peer</code>。</p>
</blockquote>
<h3>7.2 VNI 状态要看懂</h3>
<p><code>display vxlan vni</code> 的 State <strong>只表示「有没有远端 VTEP」</strong>:</p>
<table>
<thead>
<tr>
<th>设备</th>
<th>期望</th>
</tr>
</thead>
<tbody>
<tr>
<td>Leaf1</td>
<td>VNI 20 <code>up</code>、VNI 10 <code>down</code></td>
</tr>
<tr>
<td>Leaf3</td>
<td>VNI 20 <code>up</code>、VNI 30 <code>down</code></td>
</tr>
</tbody>
</table>
<p>VNI 10 只在 Leaf1/2 对内、VNI 30 只在 Leaf3/4 对内,<strong>没有远端 VTEP,不建 VXLAN 隧道</strong>,<br />
所以它们本来就是 down。对内流量走 M-LAG 的 Eth-Trunk,<br />
出接口在远端 leaf 时才过 peer-link——不是所有流量都走 peer-link。<br />
把这条写进判据,才不会误判成故障。</p>
<blockquote>
<p><strong><code>display vxlan vni</code> 不列 L3VNI</strong>。两台 Spine 上都是 <code>Number of vxlan vni : 0</code>,<br />
这是正常的。要确认 VNI 5000 用 <code>display interface Nve1</code>(current state UP)+<br />
<code>display vxlan tunnel</code>。</p>
</blockquote>
<h3>7.3 TTL 是最便宜的判据</h3>
<table>
<thead>
<tr>
<th>场景</th>
<th>TTL</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>SRV-B → SRV-C(同网段跨 leaf 对)</td>
<td>64</td>
<td>纯二层延伸,不过网关</td>
</tr>
<tr>
<td>SRV-A → SRV-B(跨 BD 同 leaf 对)</td>
<td>63</td>
<td>只在入口 leaf 路由一次</td>
</tr>
<tr>
<td>SRV-A → SRV-C(跨 BD 跨 leaf 对)</td>
<td><strong>62</strong></td>
<td>入口 leaf 路由 + 出口 leaf 查表转发</td>
</tr>
<tr>
<td>SRV-A → 公网</td>
<td>61</td>
<td>再过 Spine 和 PE1</td>
</tr>
</tbody>
</table>
<p>62 容易被当成「绕路了」,其实不是:入口 leaf 和出口 leaf 各做一次查表,<br />
<code>traceroute</code> 能看到两个跳(中间那个 <code>*</code> 是出口 leaf 不回 TTL-exceeded)。<br />
<strong>真绕了 spine 会是 61</strong>,所以 62 本身就否证了三角路由。</p>
<h3>7.4 故障切换</h3>
<pre><code class="language-bash">node tools/vxlan-dist-gw-verify.js --skip-boot --fault
</code></pre>
<p>停掉 Leaf1,等 100 秒(LACP 超时收敛),然后:</p>
<ul>
<li>SRV-A → SRV-B 仍 5/5 <code>ttl=63</code>(bond 切到 Leaf2;此时 SRV-A、SRV-B 都在 Leaf2 上,<br />
变成「跨 BD 同 leaf 对」,入口只路由一次,所以还是 63 而不是 62)</li>
<li>SRV-A → 公网仍 5/5 <code>ttl=61</code></li>
<li>Leaf2 侧 <code>display dfs-group 1 m-lag brief</code> 出现 <code>inactive</code></li>
</ul>
<blockquote>
<p>这 100 秒是 <strong>LACP 超时</strong>的时间尺度,不是设备重启收敛。<br />
如果是把 Leaf1 停掉再启动,隧道/EVPN/OSPF 虽然能自恢复,<br />
但重启后头几分钟流量会抖(见 8.8),要等更久再跑验收。</p>
</blockquote>
<h3>7.5 过滤器面板</h3>
<p><strong>会亮</strong>:ARP-Request/Reply、ICMP-Request/Reply、VXLAN-VNI20-BD20(SRV-B ↔ SRV-C 纯二层)、<br />
VXLAN-L3VNI5000(跨 BD 三层)、OSPF-Hello、BGP-EVPN、LACP、<br />
<strong>DAD-Heartbeat(三根 DAD 直连链上常亮)</strong>、DAD-Probe(underlay 各链路)。</p>
<p><strong>故意不亮</strong>:VXLAN-VNI10-BD10、VXLAN-VNI30-BD30(对内 BD,没有远端 VTEP、不建隧道)。<br />
<strong>这两条不亮才是对的</strong>。</p>
<blockquote>
<p><strong>DAD 心跳是 UDP 1025,不是 ICMP。</strong> 拿 Wireshark 抓 Spine2 <code>GE1/0/9</code> 看得很清楚:<br />
<code>10.10.10.1 ↔ 10.10.10.2</code>,UDP 1025→1025,每 ~200ms 一个,168 字节。<br />
一开始按别的 M-LAG 实验的经验写成 <code>icmp == 0xffff</code>,<strong>这根线一直不亮</strong>。</p>
<p>但<strong>不能因此把 ICMP 探针并进来</strong>:<code>id=0xffff</code> 的 ICMP Echo(<code>192.168.2.2→192.168.2.2</code><br />
这种自己打自己、<code>ttl=1/2</code>、收不到回应)是 DFS 的另一种探针,<strong>会泛洪到 underlay 各条链路上</strong>。<br />
合并成一条的后果是 underlay 全线发黄,反而把「心跳只跑在 DAD 链上」这个结构事实糊掉。<br />
最终拆成两条:<code>DAD-Heartbeat</code> = <code>udp port 1025</code>(黄),<code>DAD-Probe</code> = <code>icmp == 0xffff</code>(淡黄),<br />
各亮各的链路。</p>
</blockquote>
<p>配色要对准 <strong>EVE 的深色画布</strong> + <strong>默认链路是蓝色</strong>这两条:</p>
<ul>
<li>避开蓝/青系,否则和普通链路分不开;</li>
<li>深色底上要够亮——<code>#212121</code> 这种近黑在画布上等于没有高亮(本实验踩过,已改成 <code>#aa00ff</code>);</li>
<li>请求↔应答要么互补、要么色相远隔(ARP 红 <code>#e53935</code> ↔ 草绿 <code>#76ff03</code>,<br />
ICMP 品红 <code>#d81b60</code> ↔ 绿 <code>#43a047</code>);</li>
<li>同亮度邻近色相不行(橙 <code>#fb8c00</code> 和琥珀、蓝和青这种)。</li>
</ul>
<h2>8. 踩坑清单(按「会骗到你」的程度排序)</h2>
<blockquote>
<p><strong>★ 越多越坑</strong>:★★★ = 会直接把你带偏、白折腾几小时;★ = 知道就好;<br />
没标星的是「边界条件」,不影响主流程。</p>
</blockquote>
<h3>8.1 启动配置推一半就丢了 ★★★</h3>
<p>EVE 在设备还在初始化时推启动配置,<strong>后面的行会丢,每台丢的位置还不一样</strong><br />
(Leaf2 停在 <code>stp v-stp enable</code>、Leaf3/4 停在 <code>dfs-group</code>)。<br />
表现是控制台看着正常、<code>display ospf peer</code> 却是空的。</p>
<p><strong>药方</strong>:登录后<strong>一行一条、等提示符再发下一条</strong>重推,一次性灌一大块照样会丢。<br />
起手式接 8.2:先 <code>{expect: &quot;&quot;, send: &quot;&quot;}</code> 敲个回车把控制台唤醒,<br />
再一行一条发、每行之后用提示符正则确认落地。</p>
<h3>8.2 控制台安静时不吐字节 ★★</h3>
<p><code>console_history</code> 只有 <strong>10 字节</strong>(<code>ESC]0;&lt;Name&gt;BEL</code>,一个窗口标题),<br />
<code>console_run</code> 读回来只有那 10 字节,<strong>看着像节点死了,其实设备活得好好的</strong>。</p>
<p>根因是工具语义:<strong><code>send</code> 之后的 <code>expect</code> 只匹配该次 <code>send</code> 之后新收到的字节</strong>。<br />
所以「先等提示符再发回车」在冷控制台上永远等不到。</p>
<p><strong>正确起手:<code>{expect: &quot;&quot;, send: &quot;&quot;}</code>(空正则立即命中 → 无条件敲回车)</strong>,<br />
再另起一步看落在哪儿。华为 CE 和 docker 容器都是这个毛病。<br />
(这次为了它白重启过 Leaf3/Leaf4——重启并不能解决。)</p>
<h3>8.3 <code>peer X enable</code> 的 <code></code> 把后续配置吃掉 ★★</h3>
<pre><code>Warning: This operation will reset the peer session. Continue? :
</code></pre>
<p>邻居已建立时配 <code>peer X enable</code> 会弹这个。逐行推送时它会吃掉下一行,<br />
控制台卡在 <code>Please choose 'YES' or 'NO' first before pressing 'Enter'</code>。</p>
<p><strong>结构性解法:把 <code>ospf 1</code> 整段放到 BGP 之后</strong>,推 BGP 时邻居起不来就不弹。<br />
兜底:推送脚本侦测 <code></code> 和 <code></code> 自动答 <code>Y</code>。</p>
<h3>8.4 <code>display vxlan vni</code> 不列 L3VNI ★</h3>
<p>Spine 上 <code>Number of vxlan vni : 0</code> 是正常的。差点据此判「VNI 5000 没起来」。</p>
<h3>8.5 两条 BGP 查询命令这个镜像不认</h3>
<pre><code>display bgp vpn-instance vpn1 routing-table            → Unrecognized command
display bgp evpn all routing-table prefix-route 10.1.3.0 24→ Wrong parameter
</code></pre>
<p>替代:<code>display ip routing-table vpn-instance vpn1 &lt;prefix&gt;</code>,<br />
看下一跳是不是远端 VTEP、出接口是不是 VXLAN。</p>
<h3>8.6 默认路由不能靠 <code>import-route static</code></h3>
<p>VRP 的 <code>import-route static</code> <strong>不导入 <code>0.0.0.0/0</code></strong>。<br />
要在 <code>ipv4-family vpn-instance vpn1</code> 下单独写 <code>network 0.0.0.0 0.0.0.0</code><br />
才能通告成 type-5。</p>
<p><code>import-route static</code> 本身不是没用——<strong>非默认的静态路由照样能导入</strong>,<br />
只有默认路由必须用 <code>network</code> 单独通告。</p>
<h3>8.7 EVE 不把容器的 veth admin 状态传给对端 ★</h3>
<p>在容器里 <code>ip link set eth1 down</code> <strong>不算故障</strong>,leaf 侧看不到。<br />
真正的故障测试要停整台 leaf,而且要靠 <strong>LACP 超时</strong>发现(约 100 秒)。</p>
<h3>8.8 重启后头几分钟流量会抖 ★</h3>
<p>Leaf1 重启后隧道/EVPN/OSPF 都能自恢复,但<strong>头几分钟丢包 20~45%</strong>。<br />
别在收敛期跑验收,不然会拿到一堆 <code>4/5</code> 的假失败。</p>
<h3>8.9 <code>display current-configuration</code> 看着被截断</h3>
<p>其实是分页器(默认 24 行)。先 <code>screen-length 0 temporary</code>。</p>
<h2>9. 已知限制</h2>
<ol>
<li><strong>IPv6 单栈缺失</strong>:这套 eNSP Pro 移植镜像上 IPv6 over VXLAN 不通,<br />
所以只做 IPv4,文章里的 IPv6 部分没有复现。</li>
<li><strong><code>return</code> 会弹未提交确认</strong>:有未提交改动时 <code>return</code> 会问<br />
<code></code>,自动化要能答。</li>
<li><strong>内存</strong>:6 台 CE6800 + 1 台 AR6700 各 4 GB,合计约 28 GB,另加 5 台轻量容器。</li>
<li><strong>控制台空闲会掉回 <code>Password:</code></strong>,验收脚本要能自动重登。</li>
<li><strong>EVE 虚拟链路对 LACP 的透传取决于底层实现</strong>:本实验环境实测可通<br />
(服务器 bond <code>802.3ad</code> 与 leaf <code>mode lacp-dynamic</code> 协商成功,M-LAG 显示 <code>active(*)-active</code>)。<br />
如果你的 EVE 版本 LACP 不通,可以把 M-LAG 改成静态模式(<code>mode manual load-balance</code>),<br />
服务器 bond 改 <code>balance-rr</code>,先把三层/EVPN 的部分验证完。</li>
</ol>
<h2>10. 附录</h2>
<p><strong>附件</strong>:<code>实验案例模板/附件/vxlan-dist-gw.zip</code>(315 KB)——<br />
<code>README.md</code> / <code>topology.yml</code>(12 节点 28 链路 13 filter)/ <code>.eve-iac.yml</code> /<br />
<code>configs/default/n_1~n_12.cfg</code>(MCP 读回的原字节)/ <code>topology.png</code>。</p>
<table>
<thead>
<tr>
<th>文件</th>
<th>SHA-256</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>vxlan-dist-gw.zip</code></td>
<td><code>48ba6d0d32c041398dd5d6f44e5cd787b17967a36f10d9f72778a037f8c6d232</code></td>
</tr>
<tr>
<td><code>topology.yml</code></td>
<td><code>2cf528257464ed1c62a0c9adc04ec5a093bd789b99f847468348880145377984</code></td>
</tr>
<tr>
<td><code>topology.png</code></td>
<td><code>614bb58fe38377e7185f022f0b8e92e62db0bf25a662f1fc6acbc1d1b2da0558</code></td>
</tr>
</tbody>
</table>
<ul>
<li>活工程:<code>IaC/vxlan-dist-gw/</code></li>
<li>验收脚本:<code>tools/vxlan-dist-gw-verify.js</code>(30 项 + <code>--fault</code> 3 项)</li>
<li>相关案例:<code>实验案例-VXLAN-EVPN-IOL-XE.md</code>(IOL XE 版,手工 anycast 网关)、<br />
<code>实验案例-华为M-LAG双镜像互测.md</code>(CE6800 与 S6730H 的 M-LAG 能力边界)</li>
</ul>

strausren 发表于 4 天前

<p>感谢 太强大了</p>
页: [1]
查看完整版本: 实验案例:华为 CE6800 跑通 VXLAN 分布式网关