哈喽,大家好!我是艺博东 ,是一个思科出身、专注于华为的网工;好了,话不多说,我们直接进入正题。
由于特殊原因,所以把“N”字母替换为“#”符号。
1、将骨干网络打通IGP
2、配置公网的LSP隧道,PE,P设备的loopack的主机路由建立LSP
3、PE之间配置MP-IBGP邻居关系(可以通过RR简化MP-IBGP全互联邻居关系)
4、VP#业务接入配置,在PE上创建VPN实例,接入用户私网路由
IS-IS
AR2
[Huawei]sysname AR2
[AR2]int l0
[AR2-LoopBack0]ip address 2.2.2.2 32
[AR2-LoopBack0]int g0/0/0
[AR2-GigabitEthernet0/0/0]ip address 10.1.23.2 24
[AR2-GigabitEthernet0/0/0]q
[AR2]isis
[AR2-isis-1]network-entity 12.0001.0000.0000.0002.00
[AR2-isis-1]is-level level-2
[AR2-isis-1]int g0/0/0
[AR2-GigabitEthernet0/0/0]isis enable
[AR2-GigabitEthernet0/0/0]int l0
[AR2-LoopBack0]isis enable
[AR2-LoopBack0]q
[AR2]int g0/0/1
[AR2-GigabitEthernet0/0/1]ip address 10.1.12.2 24
AR3
[Huawei]sysname AR3
[AR3]int l0
[AR3-LoopBack0]ip address 3.3.3.3 32
[AR3-LoopBack0]int g0/0/0
[AR3-GigabitEthernet0/0/0]ip address 10.1.34.3 24
[AR3-GigabitEthernet0/0/0]int g0/0/1
[AR3-GigabitEthernet0/0/1]ip address 10.1.23.3 24
[AR3-GigabitEthernet0/0/1]q
[AR3]isis
[AR3-isis-1]network-entity 12.0001.0000.0000.0003.00
[AR3-isis-1]is-level level-2
[AR3-isis-1]int l0
[AR3-LoopBack0]isis enable
[AR3-LoopBack0]int g0/0/0
[AR3-GigabitEthernet0/0/0]isis enable
[AR3-GigabitEthernet0/0/0]int g0/0/1
[AR3-GigabitEthernet0/0/1]isis enable
[AR3-GigabitEthernet0/0/1]q
AR4
[Huawei]sysname AR4
[AR4]int l0
[AR4-LoopBack0]ip address 4.4.4.4 32
[AR4-LoopBack0]int g0/0/1
[AR4-GigabitEthernet0/0/1]ip address 10.1.34.4 24
[AR4-GigabitEthernet0/0/1]q
[AR4]isis
[AR4-isis-1]network-entity 12.0001.0000.0000.0004.00
[AR4-isis-1]is-level level-2
[AR4-isis-1]int l0
[AR4-LoopBack0]isis enable
[AR4-LoopBack0]q
[AR4]int g0/0/1
[AR4-GigabitEthernet0/0/1]isis enable
[AR4-GigabitEthernet0/0/1]int g0/0/0
[AR4-GigabitEthernet0/0/1q
[AR4]int g0/0/0
[AR4-GigabitEthernet0/0/0]ip address 10.1.45.4 24
[AR3]dis isis peer
MPLS
AR2
[AR2]mpls lsr-id 2.2.2.2
[AR2]mpls
[AR2-mpls]mpls ldp
[AR2-mpls-ldp]int g0/0/0
[AR2-GigabitEthernet0/0/0]mpls
[AR2-GigabitEthernet0/0/0]mpls ldp
AR3、AR4配置类似
AR3
[AR3]bgp 100
[AR3-bgp]peer 2.2.2.2 as-number 100
[AR3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[AR3-bgp]peer 2.2.2.2 next-hop-local
[AR3-bgp]peer 4.4.4.4 as-number 100
[AR3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[AR3-bgp]peer 4.4.4.4 next-hop-local
[AR3-bgp]peer 2.2.2.2 reflect-client
[AR3-bgp]peer 4.4.4.4 reflect-client
[AR3-bgp]ipv4-family vp#v4
[AR3-bgp-af-vp#v4]peer 2.2.2.2 enable
[AR3-bgp-af-vp#v4]peer 2.2.2.2 reflect-client
[AR3-bgp-af-vp#v4]peer 4.4.4.4 enable
[AR3-bgp-af-vp#v4]peer 4.4.4.4 reflect-client
AR2
[AR2]bgp 100
[AR2-bgp]peer 3.3.3.3 as-number 100
[AR2-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[AR2-bgp]peer 3.3.3.3 next-hop-local
[AR2-bgp]ipv4-family vp#v4
[AR2-bgp-af-vp#v4]peer 3.3.3.3 enable
AR4
[AR4]bgp 100
[AR4-bgp]peer 3.3.3.3 as-number 100
[AR4-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[AR4-bgp]peer 3.3.3.3 next-hop-local
[AR4-bgp]ipv4-family vp#v4
[AR4-bgp-af-vp#v4]peer 3.3.3.3 enable
VP#v4
AR2
[AR2]bgp 100
[AR2-bgp]ipv4-family unicast
[AR2-bgp-af-ipv4]undo peer 3.3.3.3 enable
AR3
[AR3]bgp 100
[AR3-bgp]ipv4-family unicast
[AR3-bgp-af-ipv4]undo peer 2.2.2.2 enable
[AR3-bgp-af-ipv4]undo peer 4.4.4.4 enable
AR4
[AR4]bgp 100
[AR4-bgp]ipv4-family unicast
[AR4-bgp-af-ipv4]undo peer 3.3.3.3 enable
查看v4地址族的BGP邻居关系
[AR3]dis bgp vp#v4 all peer dis bgp
[AR3]dis bgp vp#v4 all peer verbose
VP#业务接入配置
AR2
[AR2]ip -instance ybd
[AR2--instance-ybd]route-distinguisher 10:1
[AR2--instance-ybd-af-ipv4]vp#-target 100:1 both
[AR2]int g0/0/1
[AR2-GigabitEthernet0/0/1]ip binding vp#-instance ybd
[AR2-GigabitEthernet0/0/1]ip address 10.1.12.2 24
[AR2]dis ip routing-table vp#-instance ybd
[AR2]ping -vp#-instance ybd 10.1.12.1
OSPF
AR1
[AR1]ospf 1 router-id 1.1.1.1
[AR1-ospf-1]a 0
[AR1-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.0
[AR1-ospf-1-area-0.0.0.0]network 10.1.12.1 0.0.0.0
AR2
[AR2]ospf 1 vp#-instance ybd
[AR2-ospf-1]a 0
[AR2-ospf-1-area-0.0.0.0]network 10.1.12.2 0.0.0.0
[AR2]dis ospf peer brief
[AR2]dis ip routing-table vp#-instance ybd
AR1、AR2
[AR1]int l10
[AR1-LoopBack10]ip address 192.168.10.1 32
[AR2]ip route-static vp#-instance ybd 192.168.10.0 24 10.1.12.1
[AR2]dis ip routing-table vp#-instance ybd
RIP
AR4
[AR4]ip vp#-instance ybd6
[AR4-vp#-instance-ybd6]route-distinguisher 10:2
[AR4-vp#-instance-ybd6-af-ipv4]vp#-target 100:1 both
[AR4-vp#-instance-ybd6-af-ipv4]q
[AR4-vp#-instance-ybd6]q
[AR4]int g0/0/0
[AR4-GigabitEthernet0/0/0]ip binding vp#-instance ybd6
[AR4-GigabitEthernet0/0/0]ip address 10.1.45.4 24
[AR4-GigabitEthernet0/0/0]q
[AR4]rip 1 vp#-instance ybd6
[AR4-rip-1]version 2
[AR4-rip-1]network 10.0.0.0
AR5
[AR5]rip 1
[AR5-rip-1]version 2
[AR5-rip-1]network 10.0.0.0
[AR5-rip-1]network 192.168.2.0
[AR4]dis ip routing-table vp#-instance ybd6
VP#业务接入配置
vp#-instacen ybd 路由 —> vp#-instance vp#v4 路由 —> vp#-insance Ai vp#v4 BGP路由
AR2
[AR2]bgp 100
[AR2-bgp]ipv4-family vp#-instance ybd
[AR2-bgp-ybd]import-route ospf 1
[AR2-bgp-ybd]import-route static
[AR2]display bgp vp#v4 all routing-table
在AR2的G0/0/0接口进行抓包
policy vp#target 开启基于RT属性VP#v4路由的过滤
1、如果本路由器没有VP#实例业务接入,则丢弃所有vp#v4路由
2、如果本路由器存在VP#实例业务接口,则对ert和本端所有VP#实例的irt做匹配,如果ert没有和任何一个本端vp#实例的irt匹配,则丢弃。
[AR3-bgp]dis bgp vp#v4 all routing-table
没bgp vp#v4路由
RR上
[AR3-bgp]ipv4-family vp#v4
[AR3-bgp-af-vp#v4]undo policy vp#-target
[AR3-bgp-af-vp#v4]dis bgp vp#v4 all routing-table
[AR4]dis bgp vp#v4 all routing-table
AR4已接收相应的路由。
[AR4]dis ip routing-table vp#-instance ybd6 protocol bgp
最有路由。
AR4
[AR4]bgp 100
[AR4-bgp]ipv4-family vp#-instance ybd6
[AR4-bgp-ybd6]import-route rip 1
[AR4-rip-1]import-route bgp
[AR5]dis ip routing-table protocol rip
[AR4]dis ip routing-table vp#-instance ybd6
[AR2]ospf
[AR2-ospf-1]import-route bgp
[AR2]dis ip routing-table vp#-instance ybd
[AR1]dis ip routing-table 192.168.2.5
下面说一下AR5的192.168.2.5是怎么访问AR1的192.168.1.1的路由。
AR5查找路由表192.168.1.1,发现下一跳是10.1.45.4
然后
然后根据AR4的接口下绑定的ybd6路由表,去查相关路由。
[AR4]dis bgp v4 vp#-instance ybd6 routing-table 192.168.1.1
数据封装成
压入标签为2个。
然后AR4根据G0/0/1接口发出去,
2.2.2.2的进标签1024,出标签是3,然后进行弹出顶部标签,从G0/0/1接口发送出去。
通过BGP协议得到的标签,收到的标签如果是1027的话,就属于ybd路由表进行转发的。
从接口g0/0/1发出,下一跳是10.1.12.1。
反过来也是一样的。
创建一个telnet
AR5
[AR5]user-interface vty 0 4
[AR5-ui-vty0-4]set authentication password cipher ybd666666
[AR5-ui-vty0-4]user privilege level 15
telnet -a 192.168.1.1 192.168.2.5
模拟内网冲突的场景,路由冲突的时候怎么区分?
本地路由一样是可以通过VP#实例来进行区分的。
RD:区分实例,标记路由,只在本地有效,区分不同站点的相同路由;
RT:对路由进行控制,控制路由的导入与导出。
注意:可以是相同的DR的
AR2
[AR2]int g0/0/2
[AR2-GigabitEthernet0/0/2]ip address 10.1.26.2 24
[AR2]ip vp#-instance ybd99
[AR2--instance-ybd99]route-distinguisher 20:3
[AR2--instance-ybd99]vp#-target 200:1 both
[AR2]int g0/0/2
[AR2-GigabitEthernet0/0/2]ip binding vp#-instance ybd99
[AR2-GigabitEthernet0/0/2]ip address 10.1.26.2 24
[AR2]isis 10 vp#-instance ybd99
[AR2-isis-10]is-level level-2
[AR2-isis-10]network-entity 12.0099.0000.0000.0002.00
[AR2-isis-10]int g0/0/2
[AR2-GigabitEthernet0/0/2]isis enable 10
AR6
[Huawei]sysname AR6
[AR6]int g0/0/0
[AR6-GigabitEthernet0/0/0]ip address 10.1.26.6 24
[AR6-LoopBack0]ip address 192.168.1.1 32
[AR6]isis
[AR6-isis-1]network-entity 12.0099.0000.0000.0006.00
[AR6-isis-1]is-level level-2
[AR6-isis-1]int g0/0/0
[AR6-GigabitEthernet0/0/0]isis enable
[AR6-GigabitEthernet0/0/0]int l0
[AR6-LoopBack0]isis enable
[AR2]bgp 100
[AR2-bgp]ipv4-family vp#-instance ybd99
[AR2-bgp-ybd99]import-route isis 10
[AR6]dis isis peer
[AR2]dis isis peer vp#-instance ybd99
AR4
[AR4]ip vp#-instance ybd666
[AR4-vp#-instance-ybd666]route-distinguisher 20:3
[AR4-vp#-instance-ybd666-af-ipv4]vp#-target 200:1 both
[AR4-vp#-instance-ybd666-af-ipv4]int g0/0/2
[AR4-GigabitEthernet0/0/2]ip binding vp#-instance ybd666
[AR4-GigabitEthernet0/0/2]ip address 10.1.47.4 24
[AR4]bgp 100
[AR4-bgp]ipv4-family vp#-instance ybd666
[AR4-bgp-ybd666]peer 10.1.47.7 as 64523
华为设备当将BGP路由引入到IGP时,只将EBGP路由引入。
AR7
[Huawei]sysname AR7
[AR7]int l0
[AR7-LoopBack0]ip address 192.168.10.1 32
[AR7-LoopBack0]int g0/0/0
[AR7-GigabitEthernet0/0/0]ip address 10.1.47.7 24
[AR7]bgp 64523
[AR7-bgp]peer 10.1.47.4 as 100
[AR7-bgp]network 192.168.10.1 32
[AR2]isis 10
[AR2-isis-10]import-route bgp
[AR4]dis bgp v4 all routing-table
RD、RT不一样。
192.168.10.1 PING测 192.168.1.1
已学到192.168.1.1/32的路由,下一跳是10.1.47.4;
然后根据AR4的接口下绑定的ybd666路由表,去查找相关的路由。
由以上输出结果可知,下一跳是2.2.2.2。
[AR4]dis bgp v4 vp#-instance ybd666 routing-table 192.168.1.1
通过BGP协议得到的标签,收到的标签如果是1037的话,就属于ybd99路由表进行转发的。
192.168.1.1属于ybd99本地的报文
温故而知新,可以为师矣。
欢迎访问我的易百纳技术社区文章《华为 BGP/MPLS VP#》
https://www.ebaina.com/articles/140000005374
好了这期就到这里了,如果你喜欢这篇文章的话,请点赞评论分享收藏,如果你还能点击关注,那真的是对我最大的鼓励。谢谢大家,下期见!