需求
1 使用mpls协议配置,路由器 3 4 5 建立bgp 3 4 5为pe 端,678为ce端
2 igp 协议为 ospf
3 ce端将私网路由传递到pe端协议分别为r6 静态 r7rip r8ospf
4 全网可达
实验步骤
一、配置IP
<r1>dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 6
The number of interface that is DOWN in Protocol is 0
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 13.1.1.1/24 up up
GigabitEthernet0/0/1 14.1.1.1/24 up up
GigabitEthernet0/0/2 12.1.1.1/24 up up
GigabitEthernet4/0/0 15.1.1.1/24 up up
LoopBack0 1.1.1.1/24 up up(s)
<r2>dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 6
The number of interface that is DOWN in Protocol is 0
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 24.1.1.1/24 up up
GigabitEthernet0/0/1 23.1.1.1/24 up up
GigabitEthernet0/0/2 12.1.1.2/24 up up
GigabitEthernet4/0/0 25.1.1.1/24 up up
LoopBack0 2.2.2.2/24 up up(s)
NULL0 unassigned up up(s)
<r3>dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 0
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 36.1.1.1/24 up up
GigabitEthernet0/0/1 13.1.1.2/24 up up
GigabitEthernet0/0/2 23.1.1.2/24 up up
LoopBack0 3.3.3.3/24 up up(s)
<r4>dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 0
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 14.1.1.2/24 up up
GigabitEthernet0/0/1 47.1.1.1/24 up up
GigabitEthernet0/0/2 24.1.1.2/24 up up
LoopBack0 4.4.4.4/24 up up(s)
<r5>dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 0
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 25.1.1.2/24 up up
GigabitEthernet0/0/1 58.1.1.1/24 up up
GigabitEthernet0/0/2 15.1.1.2/24 up up
LoopBack0 5.5.5.5/24 up up(s)
NULL0 unassigned up up(s)
<r6>dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 36.1.1.2/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 6.6.6.6/24 up up(s)
<r7>dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 47.1.1.2/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 7.7.7.7/24 up up(s)
NULL0 unassigned up up(s)
<r8>dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 58.1.1.2/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 8.8.8.8/24 up up(s)
NULL0 unassigned up up(s)
二、配置igp协议
[r3]ospf 100 router-id 93.3.3.3
[r3-ospf-100]ar
[r3-ospf-100]area 0
[r3-ospf-100-area-0.0.0.0]net
[r3-ospf-100-area-0.0.0.0]network 13.1.1.2 0.0.0.0
[r3-ospf-100-area-0.0.0.0]net
[r3-ospf-100-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[r3-ospf-100-area-0.0.0.0]net
[r3-ospf-100-area-0.0.0.0]network 23.1.1.2 0.0.0.0
[r1]ospf 100 ro
[r1]ospf 100 router-id 91.1.1.1
[r1-ospf-100]ar
[r1-ospf-100]area 0
[r1-ospf-100-area-0.0.0.0]net
[r1-ospf-100-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[r2]ospf 100 ro
[r2]ospf 100 router-id 92.2.2.2
[r2-ospf-100]ar
[r2-ospf-100]area 0
[r2-ospf-100-area-0.0.0.0]net
[r2-ospf-100-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[r4-ospf-100]ar
[r4-ospf-100]area 0
[r4-ospf-100-area-0.0.0.0]net
[r4-ospf-100-area-0.0.0.0]network 14.1.1.2 0.0.0.0
[r4-ospf-100-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[r4-ospf-100-area-0.0.0.0]network 24.1.1.2 0.0.0.0
[r5-ospf-100-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[r5-ospf-100-area-0.0.0.0]network 15.1.1.2 0.0.0.0
三、创建MPLS VPN
[r3]ip vpn-instance 1
[r3-vpn-instance-1]rou
[r3-vpn-instance-1]route-distinguisher 1:1
[r3-vpn-instance-1-af-ipv4]vpn-t
[r3-vpn-instance-1-af-ipv4]vpn-target 1:1 ex
[r3-vpn-instance-1-af-ipv4]vpn-target 1:1 export-extcommunity
EVT Assignment result:
Info: VPN-Target assignment is successful.
[r3-vpn-instance-1-af-ipv4]vpn-tr
[r3-vpn-instance-1-af-ipv4]vpn-target 2:2 3:3 imp
[r3-vpn-instance-1-af-ipv4]vpn-target 2:2 3:3 import-extcommunity
IVT Assignment result:
Info: VPN-Target assignment is successful.
[r3-vpn-instance-1-af-ipv4]q
[r3-vpn-instance-1]q
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]undo ip add
[r3-GigabitEthernet0/0/0]ip bing
[r3-GigabitEthernet0/0/0]ip bi
[r3-GigabitEthernet0/0/0]ip binding vpn-
[r3-GigabitEthernet0/0/0]ip binding vpn-instance 1
[r3-GigabitEthernet0/0/0]ip add 36.1.1.1 24
[r4]ip vpn-instance 2
[r4-vpn-instance-2]rou
[r4-vpn-instance-2]route-distinguisher 2:2
[r4-vpn-instance-2-af-ipv4]vpn-target 2:2 e
[r4-vpn-instance-2-af-ipv4]vpn-target 2:2 export-extcommunity
EVT Assignment result:
Info: VPN-Target assignment is successful.
[r4-vpn-instance-2-af-ipv4]vpn
[r4-vpn-instance-2-af-ipv4]vpn-
[r4-vpn-instance-2-af-ipv4]vpn-
[r4-vpn-instance-2-af-ipv4]vpn-target 1:1 2:2 im
[r4-vpn-instance-2-af-ipv4]vpn-target 1:1 2:2 import-extcommunity
IVT Assignment result:
Info: VPN-Target assignment is successful.
[r4-vpn-instance-2-af-ipv4]q
[r4-vpn-instance-2]q
[r4]int g 0/0/1
[r4-GigabitEthernet0/0/1]undo ip add
[r4-GigabitEthernet0/0/1]ip binding vpn-instance 2
[r4-GigabitEthernet0/0/1]ip add 47.1.1.1 24
[r5]ip vpn
[r5]ip vpn-instance 3
[r5-vpn-instance-3]rou
[r5-vpn-instance-3]route-distinguisher 3:3
[r5-vpn-instance-3-af-ipv4]vpn-
[r5-vpn-instance-3-af-ipv4]vpn-target 1:1 2:2 im
[r5-vpn-instance-3-af-ipv4]vpn-target 1:1 2:2 import-extcommunity
IVT Assignment result:
Info: VPN-Target assignment is successful.
[r5-vpn-instance-3-af-ipv4]vpn-target 3:3 e
[r5-vpn-instance-3-af-ipv4]vpn-target 3:3 export-extcommunity
EVT Assignment result:
Info: VPN-Target assignment is successful.
[r5-vpn-instance-3-af-ipv4]q
[r5-vpn-instance-3]q
[r5]int g 0/0/1
[r5-GigabitEthernet0/0/1]undo
[r5-GigabitEthernet0/0/1]undo ip add
[r5-GigabitEthernet0/0/1]ip b
[r5-GigabitEthernet0/0/1]ip binding vpn
[r5-GigabitEthernet0/0/1]ip binding vpn-instance 3
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[r5-GigabitEthernet0/0/1]ip add 58.1.1.1 24
四、在R3、R4、R5上建立bgp协议
[r3]bgp 1
[r3-bgp]rou
[r3-bgp]route-select
[r3-bgp]router-id 3.3.3.3
[r3-bgp]peer 4.4.4.4 as
[r3-bgp]peer 4.4.4.4 as-number 1
[r3-bgp]peer 4.4.4.4 c
[r3-bgp]peer 4.4.4.4 capability-advertise
[r3-bgp]peer 4.4.4.4 connect-interface l 0
[r3-bgp]peer 5.5.5.5 as
[r3-bgp]peer 5.5.5.5 as-number 1
[r3-bgp]peer 5.5.5.5 connect-interface l 0
[r3-bgp]ipv4-family vpnv4
[r3-bgp-af-vpnv4]peer 4.4.4.4 en
[r3-bgp-af-vpnv4]peer 4.4.4.4 enable
[r3-bgp-af-vpnv4]peer 4.4.4.4 next
[r3-bgp-af-vpnv4]peer 4.4.4.4 next-hop-local
[r3-bgp-af-vpnv4]peer 4.4.4.4 next-hop-local
[r3-bgp-af-vpnv4]peer 5.5.5.5 en
[r3-bgp-af-vpnv4]peer 5.5.5.5 enable
[r3-bgp-af-vpnv4]peer 5.5.5.5 nex
[r3-bgp-af-vpnv4]peer 5.5.5.5 next-hop-local
[r4]bgp 1
[r4-bgp]rou
[r4-bgp]route-select
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 3.3.3.3 as
[r4-bgp]peer 3.3.3.3 as-number 1
[r4-bgp]peer 3.3.3.3 con
[r4-bgp]peer 3.3.3.3 connect-interface l 0
[r4-bgp]peer 5.5.5.5 as
[r4-bgp]peer 5.5.5.5 as-number 1
[r4-bgp]peeer 5.5.5.5 con
[r4-bgp]peeer 5.5.5.5 con
[r4-bgp]peeer 5.5.5.5 c
[r4-bgp]peeer 5.5.5.5 c
[r4-bgp]peer
[r4-bgp]peer 5.5.5.5 con
[r4-bgp]peer 5.5.5.5 connect-interface l 0
[r4-bgp]ipv4-family vpnv4
[r4-bgp-af-vpnv4]peer 3.3.3.3 en
[r4-bgp-af-vpnv4]peer 3.3.3.3 enable
[r4-bgp-af-vpnv4]
[r4-bgp-af-vpnv4]peer 3.3.3.3 nex
[r4-bgp-af-vpnv4]peer 3.3.3.3 next-hop-invariable
[r4-bgp-af-vpnv4]peer 3.3.3.3 next-hop-local
[r4-bgp-af-vpnv4]peer 5.5.5.5 en
[r4-bgp-af-vpnv4]peer 5.5.5.5 enable
[r4-bgp-af-vpnv4]peer 5.5.5.5 nex
[r4-bgp-af-vpnv4]peer 5.5.5.5 next-hop-local
[r5]bgp 1
[r5-bgp]rou
[r5-bgp]route-select
[r5-bgp]router-id 5.5.5.5
[r5-bgp]peer 3.3.3.3 as
[r5-bgp]peer 3.3.3.3 as-number 1
[r5-bgp]peer 3.3.3.3 con
[r5-bgp]peer 3.3.3.3 connect-interface l 0
[r5-bgp]peer 4.4.4.4 as
[r5-bgp]peer 4.4.4.4 as-number 1
[r5-bgp]peer 4.4.4.4 con
[r5-bgp]peer 4.4.4.4 connect-interface l 0
[r5-bgp]ipv4-
[r5-bgp]ipv4-family vpnv4
[r5-bgp-af-vpnv4]peer 3.3.3.3 en
[r5-bgp-af-vpnv4]peer 3.3.3.3 enable
[r5-bgp-af-vpnv4]
[r5-bgp-af-vpnv4]peer 3.3.3.3 nex
[r5-bgp-af-vpnv4]peer 3.3.3.3 next-hop-local
[r5-bgp-af-vpnv4]peer 4.4.4.4 en
[r5-bgp-af-vpnv4]peer 4.4.4.4 enable
[r5-bgp-af-vpnv4]
[r5-bgp-af-vpnv4]peer 4.4.4.4 nex
[r5-bgp-af-vpnv4]peer 4.4.4.4 next-hop-local
五、起mpls协议
[r3]mp
[r3]mpls ls
[r3]mpls lsr-id 3.3.3.3
[r3]mpls
Info: Mpls starting, please wait... OK!
[r3-mpls]mpls ld
[r3-mpls-ldp]q
[r3]int g 0/0/1
[r3-GigabitEthernet0/0/1]mpls ldp
[r3-GigabitEthernet0/0/1]mpls ldp
Error: Please enable MPLS on this interface first.
[r3-GigabitEthernet0/0/1]mpls ldp
Error: Please enable MPLS on this interface first.
[r3-GigabitEthernet0/0/1]mpls
[r3-GigabitEthernet0/0/1]mpls ldp
[r3-GigabitEthernet0/0/1]q
[r3]int g 0/0/1
[r3-GigabitEthernet0/0/1]mpls
[r3-GigabitEthernet0/0/1]mpls ldp
[r3-GigabitEthernet0/0/1]q
[r3]int g 0/0/2
[r3-GigabitEthernet0/0/2]mpls.
[r3-GigabitEthernet0/0/2]mpls ldp
[r1]mpls ls
[r1]mpls lsr-id 1.1.1.1
[r1]mpls
Info: Mpls starting, please wait... OK!
[r1-mpls]mpls ldp
[r1-mpls-ldp]q
[r1]int g 0/0/1
[r1-GigabitEthernet0/0/1]mpls
[r1-GigabitEthernet0/0/1]mpls ldp
[r1-GigabitEthernet0/0/1]q
[r1]int g 4/0/0
[r1-GigabitEthernet4/0/0]mpls
[r1-GigabitEthernet4/0/0]mpls l
[r1-GigabitEthernet4/0/0]mpls l2vc
[r1-GigabitEthernet4/0/0]mpls ld
[r1-GigabitEthernet4/0/0]mpls ldp
[r1-GigabitEthernet4/0/0]q
[r1]int g 0/0/2
[r1-GigabitEthernet0/0/2]mpls
[r1-GigabitEthernet0/0/2]mpls ldp
[r1-GigabitEthernet0/0/2]
[r1-GigabitEthernet0/0/2]q
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]mpls
[r1-GigabitEthernet0/0/0]mpls ldp
[r2]mpls ls
[r2]mpls lsr-id 2.2.2.2
[r2]mpls
Info: Mpls starting, please wait... OK!
[r2-mpls]mpls ldp
[r2-mpls-ldp]q
[r2]int g 0/0/1
[r2-GigabitEthernet0/0/1]mpls
[r2-GigabitEthernet0/0/1]mpls ldp
[r2-GigabitEthernet0/0/1]q
[r2]int g 0/0/2
[r2-GigabitEthernet0/0/2]mpls
[r2-GigabitEthernet0/0/2]mpls ldp
[r2-GigabitEthernet0/0/2]q
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]mpls
[r2-GigabitEthernet0/0/0]mpls ldp
[r2-GigabitEthernet0/0/0]q
[r2]int g 4/0/0
[r2-GigabitEthernet4/0/0]mpls
[r2-GigabitEthernet4/0/0]mpls ldp
[r4]mpls is
[r4]mpls ls
[r4]mpls lsr-id 4.4.4.4
[r4]mpls
Info: Mpls starting, please wait... OK!
[r4-mpls]mpls ldp
[r4-mpls-ldp]q
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]mpls
[r4-GigabitEthernet0/0/0]mpls ldp
[r4-GigabitEthernet0/0/0]q
[r4]int g 0/0/1
[r4-GigabitEthernet0/0/1]q
[r4]int g 0/0/2
[r4-GigabitEthernet0/0/2]mpls
[r4-GigabitEthernet0/0/2]mpls ld
[r4-GigabitEthernet0/0/2]mpls ldp
[r5]mpls ls
[r5]mpls lsr-id 5.5.5.5
[r5]mpls
Info: Mpls starting, please wait... OK!
[r5-mpls]mpls ldp
[r5-mpls-ldp]q
[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]mpls
[r5-GigabitEthernet0/0/0]mpls ldp
[r5-GigabitEthernet0/0/0]q
[r5]int g 0/0/2
[r5-GigabitEthernet0/0/2]mpls
[r5-GigabitEthernet0/0/2]mpls ldp
[r5-GigabitEthernet0/0/2]
补命令
route recursive-lookup tunnel
六、进行重发布以及配置ce端私网协议
[r6]ip route-static 0.0.0.0 0 36.1.1.1
[r3]bgp 1
[r3-bgp]ipv4-f
[r3-bgp]ipv4-family vpnv4
[r3-bgp-af-vpnv4]q
[r3-bgp]ipv4-family vpn-
[r3-bgp]ipv4-family vpn-instance 1
[r3-bgp-1]import-route di
[r3-bgp-1]import-route direct
[r3-bgp-1]import-route st
[r3-bgp-1]import-route static
[r7]rip 1
[r7-rip-1]v
[r7-rip-1]verify-source
[r7-rip-1]version 2
[r7-rip-1]network 7.0.0.0
[r7-rip-1]net
[r7-rip-1]network 47.0.0.0
[r4]rip 1 v
[r4]rip 1 vpn-instance
[r4]rip 1 vpn-instance
[r4]rip 1 vpn-instance 2
[r4-rip-1]v
[r4-rip-1]verify-source
[r4-rip-1]version 2
[r4-rip-1]net
[r4-rip-1]network 47.0.0.0
[r4-rip-1]imp
[r4-rip-1]import-route bgp
[r4-rip-1]q
[r4]bgp 1
[r4-bgp]ipv4-family vpn-
[r4-bgp]ipv4-family vpn-instance 2
[r4-bgp-2]import-route rip 1
[r8]ospf 2
[r8-ospf-2]q
[r8]ospf 2]rou
[r8]ospf 2]router-id 98.8.8.8
[r8-ospf-2]ar
[r8-ospf-2]area 0
[r8-ospf-2-area-0.0.0.0]net
[r8-ospf-2-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[r5]ospf 2 vpn-
[r5]ospf 2 vpn-instance 3
[r5-ospf-2]ar
[r5-ospf-2]area 0
[r5-ospf-2-area-0.0.0.0]net
[r5-ospf-2-area-0.0.0.0]network 58.1.1.1 0.0.0.0
[r5-ospf-2]import-route bgp
七、全网可达
[r8]ping 6.6.6.6
PING 6.6.6.6: 56 data bytes, press CTRL_C to break
Request time out
Reply from 6.6.6.6: bytes=56 Sequence=2 ttl=252 time=80 ms
Reply from 6.6.6.6: bytes=56 Sequence=3 ttl=252 time=50 ms
Reply from 6.6.6.6: bytes=56 Sequence=4 ttl=252 time=40 ms
Reply from 6.6.6.6: bytes=56 Sequence=5 ttl=252 time=50 ms
--- 6.6.6.6 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 40/55/80 ms
故全网可达