一、拓朴图:
环境:R9在A总公司,属于 hub 端;R1 和 R5 属于A总的两个分公司,同属于 spoke 端;三地同属于 AS100
要求:两个分公司之间的通信仅能通过A总公司的 R9 进行
二、配置过程:
1、ISP 内部起IGP,假定为ospf,并在接口起用mpls ldp
2、R2和R4、R2和R8、R4和R8起 IBGP
3、R2和R4起VRF,并分别和R1、R5建立EBGP邻居关系;R2 和 R4 的 EVT 都为9:9,IVT 都为 99:99(这边 spoke 端的导出为 hub 端的导入);R1和R5声明业务IP分别为172.16.1.1和172.16.5.5到BGP里
4、R8和R9建立单臂路由,接口IP为10.1.89.x、10.1.189.x;起 VRF 分别为 hub_in 和 hub_out,配置 hub_in 的 IVT 为 9:9,hub_out 的 EVT 为 99:99,分别承担入向和出向的单向数据流控制
三、常用命令:
dis ip routing-table vpn-instance A |<ip> #查看vpn-instance A里的路由表
dis ip vpn-instance A #查看 vpn-instance A的地址RD、地址族
dis ip vpn-instance verbose #查看 vpn-instance 的详细信息
dis ip vpn-instance interface #查看 vpn-instance 的接口信息:名称、序号、接口地址列表
dis ip routing-table vpn-instance A #查看vpn-instance A的路由表
dis bgp vpnv4 vpn-instance A brief | peer | routing-table #查看vpnv4的vpn-instance对端|路由信息
dis bgp vpnv4 all routing-table <ip> #查看bgp vpnv4总表,这里有RD头、IET、标签
ip vpn-instance A & ipv4-family & undo vpn-target 2:2 import-extcommunity #关掉vpn-instance的RT导入。不导入,则总表里的vpnv4路由也不收了:dis bgp vpnv4 all routing-table ,这里是ARF(Auto RT Filter)造成的,默认ARF是开着的,在ipv4-family vpnv4下面:policy vpnv4-target这条命令是默认存在的
lsp-trigger all|ip-prefix <ip_perfix_name>|none #默认情况下,仅为32位分标签,这条为所有|前缀分标签
route recursive-lookup tunnel
apply-label per-instance #在instance 下敲,为了节省标签和系统资源,instance A下面的所有路由,分配同一标签
ping -vpn-instance A 172.16.5.5
dis vpn-instance |A #查看VRF|A的列表
dis fib vpn-instance | A #查看VRF|A的转发表
dis ip routing-table vpn-instance A #查看VRF A的路由表
dis ip routing-table vpn-instance A |ip | protocol static
dis bgp vpnv4 all peer #查看vpnv4的bgp邻居
dis bgp vpnv4 all routing-table x.x.x.x
dis bgp routing-table peer x.x.x.x advertised-routes|received-routes #查看ipv4-family对端发|收的路由
dis bgp vpnv4 all routing-table | x.x.x.x | peer y.y.y.y advertised-routes|received-routes #查看vpnv4-family对端发|收的路由
dis bgp vpnv4 vpn-instance A peer x.x.x.x verbose #查看vpnv4地址族VRF A对端的详细信息
四、验证:
五、注意的点:
因为 R1、R5、R9、R8 均有同一 AS 发布路由的现象,这里要允许相同AS的路由过来,所以一定要配置peer x.x.x.x allow-as-loop,因为 R1、R5 和 R8 会出现两次as相同现象,所以要配置peer x.x.x.x allow-as-loop 2