目录
配置接口IP地址以及底层IGP协议
配置MPLS LDP协议
Sub与Hub建立Vpnv4邻居
配置PE与CE对接命令
Sub-PE与CE对接配置
Hub与CE对接配置
发现问题
PE与CE之间都采用EBGP方式进行路由传递
MPLS隧道——Hub&Spoke组网_静下心来敲木鱼的博客-CSDN博客_hub spokehttps://blog.csdn.net/m0_49864110/article/details/127595273?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22127595273%22%2C%22source%22%3A%22m0_49864110%22%7D
配置接口IP地址以及底层IGP协议
PE4
配置接口IP地址
int g0/0/1
ip add 100.0.45.4 24
int g0/0/2
ip add 100.0.46.4 24
int g0/0/0
ip add 100.0.34.4 24
int g4/0/0
ip add 100.1.34.4 24
int loop 0
ip add 4.4.4.4 32
配置底层IGP协议
isis 1
net 49.0001.0000.0004.00
int g0/0/1
isis enable 1
int g0/0/2
isis enable 1
int loop 0
isis enable 1
PE5
配置接口IP地址
int g0/0/0
ip add 100.0.15.5 24
int g0/0/1
ip add 100.0.45.5 24
int loop 0
ip add 5.5.5.5 32
配置底层IGP协议
isis 1
net 49.0001.0000.0005.00
int g0/0/1
isis enable 1
int loop 0
isis enable 1
PE6
配置接口IP地址
int g0/0/1
ip add 100.0.46.6 24
int g0/0/0
ip add 100.0.26.6 24
int loop 0
ip add 6.6.6.6 32
配置底层IGP协议
isis 1
net 49.0001.0000.0006.00
int g0/0/1
isis enable 1
int loop 0
isis enable 1
CE1
int g0/0/0
ip add 100.0.15.1 24
int g0/0/1
ip add 172.16.1.254 24
CE2
int g0/0/0
ip add 100.0.26.2 24
int g0/0/1
ip add 192.168.1.254 24
CE3
int g0/0/0
ip add 100.0.34.3 24
int g0/0/2
ip add 100.1.34.3 24
int g0/0/1
ip add 10.0.1.254 24
配置MPLS LDP协议
PE4
mpls lsr-id 4.4.4.4
mpls
mpls ldp
int g0/0/1
mpls
mpls ldp
int g0/0/2
mpls
mpls ldp
PE5
mpls lsr-id 5.5.5.5
mpls
mpls ldp
int g0/0/1
mpls
mpls ldp
PE6
mpls lsr-id 6.6.6.6
mpls
mpls ldp
int g0/0/1
mpls
mpls ldp
Sub与Hub建立Vpnv4邻居
PE4
bgp 100
peer 5.5.5.5 as-number 100
peer 5.5.5.5 connect-interface LoopBack0
peer 6.6.6.6 as-number 100
peer 6.6.6.6 connect-interface LoopBack0
ipv4-family unicast
undo peer 5.5.5.5 enable
undo peer 6.6.6.6 enable
ipv4-family vpnv4
peer 5.5.5.5 enable
peer 6.6.6.6 enable
PE5
bgp 100
peer 4.4.4.4 as-number 100
peer 4.4.4.4 connect-interface LoopBack0
ipv4-family unicast
undo peer 4.4.4.4 enable
ipv4-family vpnv4
peer 4.4.4.4 enable
PE6
bgp 100
peer 4.4.4.4 as-number 100
peer 4.4.4.4 connect-interface LoopBack0
ipv4-family unicast
undo peer 4.4.4.4 enable
ipv4-family vpnv4
peer 4.4.4.4 enable
配置PE与CE对接命令
PE上创建的相关实例
Sub-PE与CE对接配置
Sub-PE5与CE1对接
PE5
创建实例
ip vpn-instance CE1
ipv4-family
route-distinguisher 15:1
vpn-target 200:1 export-extcommunity
vpn-target 100:1 import-extcommunity
接口绑定实例
int g0/0/0
ip bind vpn-instance CE1
ip add 100.0.15.5 24
与CE建立基于实例的BGP邻居
bgp 100
ipv4-family vpn-instance CE1
peer 100.0.15.1 as 10
CE1
bgp 10
peer 100.0.15.5 as 100
net 172.16.1.0 24 将路由宣告进BGP传递给PE
Sub-PE6与CE2对接
PE6
创建实例
ip vpn-instance CE2
ipv4-family
route-distinguisher 26:1
vpn-target 200:1 export-extcommunity
vpn-target 100:1 import-extcommunity
接口绑定实例
int g0/0/0
ip bind vpn-instance CE2
ip add 100.0.26.6 24
与CE建立基于实例的BGP邻居
bgp 100
ipv4-family vpn-instance CE2
peer 100.0.26.2 as 20
CE2
bgp 20
peer 100.0.26.6 as 100
net 192.168.1.0 24
Hub与CE对接配置
PE4
创建入方向的实例(接收Sub-PE发来的路由)
创建实例
ip vpn-instance CE3-IM
ipv4-family
route-distinguisher 34:1
vpn-target 200:1 import-extcommunity
接口绑定实例
int g0/0/0
ip bind vpn-instance CE3-IM
ip add 100.0.34.4 24
与CE建立基于实例的BGP邻居
bgp 100
ipv4-family vpn-instance CE3-IM
peer 100.0.34.3 as 30
创建出方向的实例(向Sub-PE发送路由)
创建实例
ip vpn-instance CE3-EX
ipv4-family
route-distinguisher 34:2
vpn-target 100:1 export-extcommunity
接口绑定实例
int g4/0/0
ip bind vpn-instance CE3-EX
ip add 100.1.34.4 24
与CE建立基于实例的BGP邻居
bgp 100
ipv4-family vpn-instance CE3-EX
peer 100.1.34.3 as 30
CE3
bgp 30
peer 100.0.34.4 as 100
peer 100.1.34.4 as 100
net 10.0.1.0 24
发现问题
此时发现CE3-IM实例有172与192的路由,但是CE3-EX实例只有10网段的路由
会造成Sub-PE只能学习到Hub-PE所连站点的网段,而无法学习到其它Sub-PE所连站点的网段
原因是EBGP邻居默认不接受有重复AS号的路由(PE4将路由发往EBGP邻居CE,CE再将PE发来的路由发往PE4,此时PE会拒收)
此时需要在Hub-PE4上做以下配置
bgp 100
ipv4-family vpn-instance CE3-EX
peer 100.1.34.3 allow-as-loop 接收路由时允许AS号重复一次