利用BGPmpls技术实现全网通
基础配置:
R1:
R2:
R3:
R4:
R5:
R6:
R7:
R8:
启用ospf:
[R1]ospf 1 router-id 91.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[R2]ospf 1 router-id 92.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[R3]ospf 1 router-id 93.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 13.1.1.2 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 23.1.1.2 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 14.1.1.2 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 24.1.1.2 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[R5]ospf 1 router-id 95.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 15.1.1.2 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 25.1.1.2 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
部署BGP:
[R3]bgp 100
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 4.4.4.4 as-number 100
[R3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R3-bgp]peer 5.5.5.5 as-number 100
[R3-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R4]bgp 100
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 3.3.3.3 as-number 100
[R4-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R4-bgp]peer 5.5.5.5 as-number 100
[R4-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R5]bgp 100
[R5-bgp]router-id 5.5.5.5
[R5-bgp]peer 3.3.3.3 as-number 100
[R5-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R5-bgp]peer 4.4.4.4 as-number 100
[R5-bgp]peer 4.4.4.4 connect-interface LoopBack 0
部署MPLS:
[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]interface g0/0/0
[R1-GigabitEthernet0/0/0]mpls
[R1-GigabitEthernet0/0/0]mpls ldp
[R1-GigabitEthernet0/0/0]q
[R1]interface g0/0/2
[R1-GigabitEthernet0/0/2]mpls
[R1-GigabitEthernet0/0/2]mpls ldp
[R1-GigabitEthernet0/0/2]q
[R1]interface g0/0/1
[R1-GigabitEthernet0/0/1]mpls
[R1-GigabitEthernet0/0/1]mpls ldp
[R1-GigabitEthernet0/0/1]q
[R1]interface g4/0/0
[R1-GigabitEthernet4/0/0]mpls
[R1-GigabitEthernet4/0/0]mpls ldp
[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]interface g0/0/1
[R2-GigabitEthernet0/0/1]mpls
[R2-GigabitEthernet0/0/1]mpls ldp
[R2-GigabitEthernet0/0/1]q
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]mpls
[R2-GigabitEthernet0/0/0]mpls ldp
[R2-GigabitEthernet0/0/0]q
[R2]interface g0/0/2
[R2-GigabitEthernet0/0/2]mpls
[R2-GigabitEthernet0/0/2]mpls ldp
[R2-GigabitEthernet0/0/2]q
[R2]interface g4/0/0
[R2-GigabitEthernet4/0/0]mpls
[R2-GigabitEthernet4/0/0]mpls ldp
[R3]mpls
Info: Mpls starting, please wait... OK!
[R3-mpls]mpls ldp
[R3-mpls-ldp]q
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]mpls
[R3-GigabitEthernet0/0/0]mpls ldp
[R3]interface g0/0/1
[R3-GigabitEthernet0/0/1]mpls
[R3-GigabitEthernet0/0/1]mpls ldp
[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]interface g0/0/0
[R4-GigabitEthernet0/0/0] mpls
[R4-GigabitEthernet0/0/0]mpls ldp
[R4-GigabitEthernet0/0/0]q
[R4]interface g0/0/2
[R4-GigabitEthernet0/0/2]mpls
[R4-GigabitEthernet0/0/2]mpls ldp
[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]interface g0/0/0
[R5-GigabitEthernet0/0/0]mpls
[R5-GigabitEthernet0/0/0]mpls ldp
[R5-GigabitEthernet0/0/0]q
[R5]interface g0/0/2
[R5-GigabitEthernet0/0/2]mpls
[R5-GigabitEthernet0/0/2]mpls ldp
部署VPN:
[R3]bgp 100
[R3-bgp]ipv4-family vpnv4
[R3-bgp-af-vpnv4]peer 4.4.4.4 enable
[R3-bgp-af-vpnv4]peer 5.5.5.5 enable
[R3-bgp-af-vpnv4]peer 4.4.4.4 next-hop-local
[R3-bgp-af-vpnv4]peer 5.5.5.5 next-hop-local
[R4]bgp 100
[R4-bgp]ipv4-family vpnv4
[R4-bgp-af-vpnv4]peer 3.3.3.3 enable
[R4-bgp-af-vpnv4]peer 5.5.5.5 enable
[R4-bgp-af-vpnv4]peer 3.3.3.3 next-hop-local
[R4-bgp-af-vpnv4]peer 5.5.5.5 next-hop-local
[R5]bgp 100
[R5-bgp]ipv4-family vpnv4
[R5-bgp-af-vpnv4]peer 3.3.3.3 enable
[R5-bgp-af-vpnv4]peer 4.4.4.4 enable
[R5-bgp-af-vpnv4]peer 3.3.3.3 next-hop-local
[R5-bgp-af-vpnv4]peer 4.4.4.4 next-hop-local
创建虚拟接口:
[R3]ip vpn-instance 1
[R3-vpn-instance-1]route-distinguisher 1:1
[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-target 2:2 3:3 import-extcommunity
IVT Assignment result:
Info: VPN-Target assignment is successful.
[R4]ip vpn-instance 2
[R4-vpn-instance-2]route-distinguisher 2:2
[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-target 1:1 3:3 import-extcommunity
IVT Assignment result:
Info: VPN-Target assignment is successful.
[R5]ip vpn-instance 3
[R5-vpn-instance-3]route-distinguisher 3:3
[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]vpn-target 1:1 2:2 import-extcommunity
IVT Assignment result:
Info: VPN-Target assignment is successful.
R3绑定接口:
[R3]interface g0/0/2
[R3-GigabitEthernet0/0/2]undo ip address
Aug 17 2024 19:49:35-08:00 R3 %%01IFNET/4/LINK_STATE(l)[25]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the DOWN state.
[R3-GigabitEthernet0/0/2]ip binding vpn-instance 1
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[R3-GigabitEthernet0/0/2]ip address 36.1.1.1 24
Aug 17 2024 19:50:13-08:00 R3 %%01IFNET/4/LINK_STATE(l)[26]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
R3,R6静态设置:
[R3]ip route-static vpn-instance 1 6.6.6.6 24 36.1.1.2
Info: The destination address and mask of the configured static route mismatched
, and the static route 1.1.1.0/24 was generated.
[R6]ip route-static 0.0.0.0 0 36.1.1.1
R3重发布:
[R3]bgp 100
[R3-bgp]ipv4-family vpn-instance 1
[R3-bgp-1]import-route static
R4绑定接口,重发布:
[R4]interface g0/0/1
[R4-GigabitEthernet0/0/1]undo ip address
Aug 17 2024 19:59:08-08:00 R4 %%01IFNET/4/LINK_STATE(l)[25]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the DOWN state.
[R4-GigabitEthernet0/0/1]ip binding vpn-instance 2
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[R4-GigabitEthernet0/0/1]ip address 47.1.1.1 24
Aug 17 2024 19:59:42-08:00 R4 %%01IFNET/4/LINK_STATE(l)[26]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R4]ospf 2 vpn-instance 2
[R4-ospf-2]area 0
[R4-ospf-2-area-0.0.0.0]network 47.1.1.1 0.0.0.0
[R4-ospf-2-area-0.0.0.0]q
[R4-ospf-2]import-route bgp
[R4]bgp 100
[R4-bgp]ipv4-family vpn-instance 2
[R4-bgp-2]import-route ospf 2
R7进行宣告:
[R7]ospf 2 router-id 7.7.7.7
[R7-ospf-2]area 0
[R7-ospf-2-area-0.0.0.0]network 0.0.0.0 255.255.255.255
R5绑定接口,重发布:
[R5]interface g0/0/1
[R5-GigabitEthernet0/0/1]undo ip address
Aug 17 2024 20:08:05-08:00 R5 %%01IFNET/4/LINK_STATE(l)[25]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the DOWN state.
[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 address 58.1.1.1 24
Aug 17 2024 20:08:32-08:00 R5 %%01IFNET/4/LINK_STATE(l)[26]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R5]rip 1 vpn-instance 3
[R5-rip-1]version 2
[R5-rip-1]network 58.0.0.0
[R5-rip-1]import-route bgp
[R5]bgp 100
[R5-bgp]ipv4-family vpn-instance 3
[R5-bgp-3]import-route rip 1
R8进行宣告:
[R8]rip 1
[R8-rip-1]version 2
[R8-rip-1]network 58.0.0.0
[R8-rip-1]network 8.0.0.0