一、概念:
SRv6:Segment-Routing version 6
SR-BE:SR-Best Effort,纯粹IPv6报文转发
SR-TE:SR-Traffic Engeering,Source Routing 源路由转发
IPv6报文基本头部(固定)
+ IPv6 扩展头部 SRH:携带沿途 end sid,控路
SRH:Segment Routing Header
包含:Next Header | Segment Left ,有 N-1 个,从目的地址0开始逆序递增到源地址
二、配置过程:
1、全局使能:
segment-routing ipv6
2、SRv6 下配置 Locator 和 function:
segment-routing ipv6
encapsulation source-interface Loopback0 #建议配上,发包时会显示源地址
locator NE1 ipv6-prefix 2001:1::96 static 16
opcode ::1 end psp #次末跳弹出
opcode ::11 end-op #ping测试
总结:
- 1、配置 node-sid:end
- 2、配置 Adj-sid,end-x
3、IGP 使能 SRv6 并通告 locator:
isis
is-name NE1
ipv6 enable topoloby ipv6 #声明 IPv6 单拓扑
segment-routing ipv6 locator NE1 #I GP 下通告 SRv6 locator
dis ipv6 routing-table 2001::5 #查看某个 IPv6 路由的详情
dis ipv6 fib #查看某个 IPv6 的 fib(模拟器不支持)
ping ipv6-sid segment-by-segment 2001:5::5
ping ipv6 -a 2001:1:1 2001:5::5 #只需要两头配,不需要中间节点配 SRv6,直接走的路由,充分说明了 SRv6 是基于源路由的
dis tunnel-info all #可以看到中间没有隧道,直接走的路由
tracert ipv6 2001:5::5
4、通过 BGP 的 IPv6 地址,建立 vpnv4 邻居:
bgp 15
router-id 1.1.1.1
peer 2001::5 as 15
peer 2001::5 connect-interface loo0
ipv4-family vpnv4
peer 2001::5 enable
dis bgp vpnv4 all peer #查看下 vpnv4 邻居
```
5、配置 VRF,把接口划入:
ip vpn-instance A
route-distinguisher 15:1
vpn-target 15:15
int loo1
ip binding vpn-instance A
ip addr 172.16.1.1 32
## 6、PE-CE 路由协议,双向注入:
bgp 15
ipv4-family vpn-instance A
network 172.16.1.1 32
dis ip routing-table vpn-instance A
dis bgp vpnv4 all routing-table #有路由,但不优,原因:数据黑洞,要走隧道,解决:SRv6 调用 SRv6 locator,产生对应的 end sid
```
7、SRv6 应用使能 SRv6:
场景1:L3vpn(ipv4 VRF over srv6)
- 1、在 BGP 的 VRF A 中,使能 SRv6 BE(引流到 BE 路径),并产生动态的 prefix-id opcode:
bgp 15
ipv4-family vpn-instance A
segment-routing ipv6 best-effort #在 VRF A 中,使能 SRv6 BE(引流)
segment-routing ipv6 locator NE1 #在 VRF A 中,调用 SRv6 的 Locator ,产生动态 prefix-sid:
dis segment-routing ipv6 locator-sid end-dt4 forwarding #发现产生了一个 End.DT4 的转发项,由 BGP 的 VPNv4 所产生
以上只是 VRF A 产生了 prefix-sid,但不传递;以下开始声明传递==== - 2、在 BGP 的 vpnv4 环境下,声明 prefix-sid:
-
bgp 15 ipv4-family vpnv4 peer 2001::5 prefix-sid #在 vpnv4 里声明传递 prefix-sid
====这时,查看 BGP VPNv4 路由表,发现优了========
- 3、查看 BGP VPNv4 的路由表、查看 VRF A 的路由表、查看发给 peer 的 VPNv4 路由的详细信息:
dis bgp vpnv4 all routing-table 172.16.5.5 #发现学到了这条路由的详细信息:prefix-sid:2001:5::1:3F
dis ip routing vpn-instance A 172.16.5.5 #发现接口是 SRv6 BE,下一跳是 prefix-sid 2001:5::1:3F
dis bgp vpnv4 all peer 2001::5 advertised-routes 172.16.1.1 #能看到 SRV6 动态生成的 prefix-sid
tracert ipv6 2001:5::1:3F #追踪一下
ping -vpn-instance A 172.16.1.1 172.16.5.5 #ping 一下
* BE 不走隧道,直接走路由,是由IGP决定路径;TE 则会封装到SRH中,走 TE 隧道
========以下用静态生成 opcode==========
segment-routing ipv6
locator NE1 ipv6-prefix 2001:1::96 static 16
opcode ::501 end-dt4 vpn-instance A
bgp 15
ipv4-family vpn-instance A
segment-routing ipv6 best-effort
segment-routing ipv6 locator NE5 auto-sid-disable #禁止自动生成 prefix-sid
dis segment-routing ipv6 local-sid end-dt4 forwarding #查看下 end-dt4 的转发表
### 场景2:ipv4 bgp over srv6
- 1、建立ipv4-family peer,通告路由
bgp 15
ipv4-family unicast
peer 2001::5 enable
network 11.11.1.1 32 #通告路由,但是路由不优
- 2、SRv6 应用使能 SRv6,调用locator
bgp 15
ipv4-family unicast
segment-routing ipv6 best-effort
segment-routing locator NE1
peer 2001::5 prefix-sid
dis segment-routing ipv6 local-sid end-dt4 forwarding #发现产生了_public_的默认vpn ID 0
dis bgp routing-table #这里看不到opcode
dis bgp routing-table peer 2001::1 advertised-routes 11.11.5.0 #这里发的时候能看到opcode
手工指定方式:
segment-routing ipv6
locator NE5
opcode ::505 end-dt4 vpn-instance _public_ #手工指定公共路由表用_public_指代
IPv6 DA:在
将IPv6报文分为两部分:
locater:
function:动作:查 ipv4 public route 表、ipv6 public route 表、查 vpnv4 表、转发到接口、弹出标签。。。