第九天作业
实验拓扑图
配置
配置IP
R1
interface GigabitEthernet0/0/0
ip address 12.1.1.1 255.255.255.0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
R2
interface GigabitEthernet0/0/0
ip address 12.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 23.1.1.1 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/2
ip address 24.1.1.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
R3
interface GigabitEthernet0/0/0
ip address 23.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 35.1.1.1 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/2
ip address 36.1.1.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
R4
interface GigabitEthernet0/0/0
ip address 24.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 46.1.1.1 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/2
ip address 45.1.1.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack0
ip address 4.4.4.4 255.255.255.255
R5
interface GigabitEthernet0/0/0
ip address 35.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 45.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/2
ip address 57.1.1.1 255.255.255.0
#
interface LoopBack0
ip address 5.5.5.5 255.255.255.255
R6
interface GigabitEthernet0/0/0
ip address 46.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 36.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/2
ip address 68.1.1.1 255.255.255.0
#
interface LoopBack0
ip address 6.6.6.6 255.255.255.255
R7
interface GigabitEthernet0/0/0
ip address 57.1.1.2 255.255.255.0
#
interface LoopBack0
ip address 7.7.7.7 255.255.255.255
R8
interface GigabitEthernet0/0/0
ip address 68.1.1.2 255.255.255.0
#
interface LoopBack0
ip address 8.8.8.8 255.255.255.255
配置ospf
R2
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 23.1.1.1 0.0.0.0
network 24.1.1.1 0.0.0.0
R3
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 0.0.0.0 255.255.255.255
R4
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 0.0.0.0 255.255.255.255
R5
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 5.5.5.5 0.0.0.0
network 35.1.1.2 0.0.0.0
network 45.1.1.2 0.0.0.0
R6
ospf 1 router-id 6.6.6.6
area 0.0.0.0
network 6.6.6.6 0.0.0.0
network 36.1.1.2 0.0.0.0
network 46.1.1.2 0.0.0.0
配置ibgp
R2
bgp 1
router-id 1.1.1.1
peer 5.5.5.5 as-number 1
peer 5.5.5.5 connect-interface LoopBack0
peer 6.6.6.6 as-number 1
peer 6.6.6.6 connect-interface LoopBack0
ipv4-family vpnv4
peer 5.5.5.5 enable
peer 6.6.6.6 enable
ip vpn-instance 1
ipv4-family
route-distinguisher 1:1
vpn-target 1:1 export-extcommunity
vpn-target 5:5 6:6 import-extcommunity
接口调用
interface GigabitEthernet0/0/0
ip binding vpn-instance 1
写静态
ip route-static vpn-instance 1 1.1.1.1 255.255.255.255 12.1.1.1
[r1]ip route-static 0.0.0.0 0.0.0.0 12.1.1.2
重发布静态
bgp1
ipv4-family vpn-instance 1
import-route static
R6
bgp 1
router-id 6.6.6.6
peer 2.2.2.2 as-number 1
peer 2.2.2.2 connect-interface LoopBack0
peer 5.5.5.5 as-number 1
peer 5.5.5.5 connect-interface LoopBack0
ipv4-family vpnv4
peer 2.2.2.2 enable
peer 5.5.5.5 enable
ip vpn-instance 3
ipv4-family
route-distinguisher 6:6
vpn-target 6:6 export-extcommunity
vpn-target 1:1 5:5 import-extcommunity
接口调用
interface GigabitEthernet0/0/2
ip binding vpn-instance 3
ospf
ospf 2 vpn-instance 3
import-route bgp
area 0.0.0.0
network 68.1.1.1 0.0.0.0
重发布ospf
ospf 2 vpn-instance 3
import-route bgp
bgp 1
#
ipv4-family vpn-instance 3
import-route ospf 2
R5
bgp 1
router-id 5.5.5.5
peer 2.2.2.2 as-number 1
peer 2.2.2.2 connect-interface LoopBack0
peer 6.6.6.6 as-number 1
peer 6.6.6.6 connect-interface LoopBack0.
ipv4-family vpnv4
peer 2.2.2.2 enable
peer 6.6.6.6 enable
接口调用
interface GigabitEthernet0/0/2
ip binding vpn-instance 2
rip发布
rip 1 vpn-instance 2
version 2
network 57.0.0.0
import-route bgp
重发布
bgp 1
#
ipv4-family vpn-instance 2
import-route rip 1
结果