实验要求:
拓扑以及配置:
首先进行ip的配置:
以R1为例:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 10.0.12.1 24
[R1-GigabitEthernet0/0/0]int loop 0
[R1-LoopBack0]ip add 192.168.1.1 24
其他同理:
[R2]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/2 23.1.1.2/24 up up
LoopBack0 2.2.2.2/24 up up(s)
NULL0 unassigned up up(s)
[R3]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 unassigned down down
GigabitEthernet0/0/1 34.1.1.3/24 up up
GigabitEthernet0/0/2 23.1.1.3/24 up up
LoopBack0 3.3.3.3/24 up up(s)
NULL0 unassigned up up(s)
[R4]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/1 34.1.1.4/24 up up
LoopBack0 4.4.4.4/24 up up(s)
NULL0 unassigned up up(s)
[R5]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.0.45.5/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.5.1/24 up up(s)
NULL0 unassigned up up(s)
[R6]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 unassigned down down
GigabitEthernet0/0/1 10.0.26.6/24 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.6.1/24 up up(s)
NULL0 unassigned up up(s)
[R7]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 unassigned down down
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 10.0.47.7/24 up up
LoopBack0 192.168.7.1/24 up up(s)
NULL0 unassigned up up(s)
然后在R2 R3 R4 上面写OSPF:
[R2]ospf 1
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 2.2.2.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[R3]ospf 1
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 3.3.3.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
[R4]ospf 1
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 4.4.4.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
然后写MPLS:
[R2]mpls lsr-id 2.2.2.2
[R2]mpls
[R2-mpls]mpls ldp
[R2]int g 0/0/2
[R2-GigabitEthernet0/0/2]mpls
[R2-GigabitEthernet0/0/2]mpls ldp
[R3]mpls lsr-id 3.3.3.3
[R3]mpls
[R3-mpls]mpls ldp
[R3]int g 0/0/2
[R3-GigabitEthernet0/0/2]mpls
[R3-GigabitEthernet0/0/2]mpls ldp
[R3]int g 0/0/1
[R3-GigabitEthernet0/0/1]mpls
[R3-GigabitEthernet0/0/1]mpls ldp
[R4]mpls lsr-id 4.4.4.4
[R4]mpls
[R4-mpls]mpls ldp
[R4]int g 0/0/1
[R4-GigabitEthernet0/0/1]mpls
[R4-GigabitEthernet0/0/1]mpls ldp
r2以及r4写bgp
[R2]bgp 1
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 4.4.4.4 as-number 1
[R2-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R2-bgp]peer 4.4.4.4 next-hop-local
[R4]bgp 1
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 2.2.2.2 as-number 1
[R4-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R4-bgp]peer 2.2.2.2 next-hop-local
写V*N:
[R2]ip vpn-instance a
[R2-vpn-instance-a]ipv4-family
[R2-vpn-instance-a-af-ipv4]route-distinguisher 1:1
[R2-vpn-instance-a-af-ipv4]vpn-target 1:1
[R2]ip vpn-instance b
[R2-vpn-instance-b]ipv4-family
[R2-vpn-instance-b-af-ipv4]route-distinguisher 2:2
[R2-vpn-instance-b-af-ipv4]vpn-target 2:2
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip binding vpn-instance a
[R2-GigabitEthernet0/0/0]ip add 10.0.12.2 24
[R2]int g 0/0/1
[R2-GigabitEthernet0/0/1]ip binding vpn-instance b
[R2-GigabitEthernet0/0/1]ip add 10.0.26.2 24
[R4]ip vpn-instance a
[R4-vpn-instance-a]ipv4-family
[R4-vpn-instance-a-af-ipv4]route-distinguisher 1:1
[R4-vpn-instance-a-af-ipv4]vpn-target 1:1
[R4]ip vpn-instance b
[R4-vpn-instance-b]ipv4-family
[R4-vpn-instance-b-af-ipv4]route-distinguisher 2:2
[R4-vpn-instance-b-af-ipv4]vpn-target 2:2
[R4]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip binding vpn-instance a
[R4-GigabitEthernet0/0/0]ip add 10.0.45.4 24
[R4]int g 0/0/2
[R4-GigabitEthernet0/0/2]ip binding vpn-instance b
[R4-GigabitEthernet0/0/2]ip add 10.0.47.4 24
再写动态路由协议:
[R1]ospf 1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255
[R6]rip 1
[R6-rip-1]version 2
[R6-rip-1]network 192.168.6.0
[R6-rip-1]network 10.0.0.0
[R2]ospf 2 vpn-instance a
[R2-ospf-2]area 0
[R2-ospf-2-area-0.0.0.0]network 10.0.12.0 0.0.0.255
[R2]rip 1 vpn-instance b
[R2-rip-1]version 2
[R2-rip-1]network 10.0.0.0