实验拓扑
实验步骤与配置
ip和loopback地址配置
R1 # sysname R1 # interface LoopBack0 ip address 10.0.1.1 255.255.255.255 # interface GigabitEthernet0/0 port link-mode route combo enable copper ip address 10.0.41.1 255.255.255.0 # interface GigabitEthernet0/1 port link-mode route combo enable copper ip address 10.0.12.1 255.255.255.0 # | R2 # sysname R2 # interface LoopBack0 ip address 10.0.2.2 255.255.255.255 # interface GigabitEthernet0/0 port link-mode route combo enable copper ip address 10.0.23.2 255.255.255.0 # interface GigabitEthernet0/1 port link-mode route combo enable copper ip address 10.0.12.2 255.255.255.0 # | R3 # sysname R3 # interface LoopBack0 ip address 10.0.3.3 255.255.255.255 # interface GigabitEthernet0/0 port link-mode route combo enable copper ip address 10.0.23.3 255.255.255.0 # interface GigabitEthernet0/1 port link-mode route combo enable copper ip address 10.0.35.3 255.255.255.0 # |
---|---|---|
R4 # sysname R4 # interface LoopBack0 ip address 10.0.4.4 255.255.255.255 # interface GigabitEthernet0/0 port link-mode route combo enable copper ip address 10.0.41.4 255.255.255.0 # | R5 # sysname R5 # interface LoopBack0 ip address 10.0.5.5 255.255.255.255 # interface GigabitEthernet0/1 port link-mode route combo enable copper ip address 10.0.35.5 255.255.255.0 # |
ospf配置
在as200中配置ospf用作ibgp通信
R1 # ospf 10 area 0.0.0.0 network 10.0.1.1 0.0.0.0 network 10.0.12.1 0.0.0.0 # | R2 # ospf 10 area 0.0.0.0 network 10.0.2.2 0.0.0.0 network 10.0.12.2 0.0.0.0 network 10.0.23.2 0.0.0.0 # | R3 # ospf 10 area 0.0.0.0 network 10.0.3.3 0.0.0.0 network 10.0.23.3 0.0.0.0 # |
---|
bgp配置
ibgp配置
R1 # bgp 200 peer 10.0.2.2 as-number 200 peer 10.0.2.2 connect-interface LoopBack0 peer 10.0.3.3 as-number 200 peer 10.0.3.3 connect-interface LoopBack0 peer 10.0.41.4 as-number 100 # address-family ipv4 unicast peer 10.0.2.2 enable peer 10.0.2.2 next-hop-local peer 10.0.3.3 enable peer 10.0.3.3 next-hop-local peer 10.0.41.4 enable # | R2 # bgp 200 peer 10.0.1.1 as-number 200 peer 10.0.1.1 connect-interface LoopBack0 peer 10.0.3.3 as-number 200 peer 10.0.3.3 connect-interface LoopBack0 # address-family ipv4 unicast peer 10.0.1.1 enable peer 10.0.3.3 enable # | R3 # bgp 200 peer 10.0.1.1 as-number 200 peer 10.0.1.1 connect-interface LoopBack0 peer 10.0.2.2 as-number 200 peer 10.0.2.2 connect-interface LoopBack0 peer 10.0.35.5 as-number 300 # address-family ipv4 unicast peer 10.0.1.1 enable peer 10.0.1.1 next-hop-local peer 10.0.2.2 enable peer 10.0.2.2 next-hop-local peer 10.0.35.5 enable # |
---|
ebgp配置
R4 # bgp 100 peer 10.0.41.1 as-number 200 # address-family ipv4 unicast network 10.0.4.4 255.255.255.255 network 10.0.41.0 255.255.255.0 peer 10.0.41.1 enable # | R5 # bgp 300 peer 10.0.35.3 as-number 200 # address-family ipv4 unicast network 10.0.5.5 255.255.255.255 peer 10.0.35.3 enable # |
---|
路由引入配置
仅在两边界路由做单向引入,将ospf 10 引入到bgp中
R1 # bgp 200 peer 10.0.2.2 as-number 200 peer 10.0.2.2 connect-interface LoopBack0 peer 10.0.3.3 as-number 200 peer 10.0.3.3 connect-interface LoopBack0 peer 10.0.41.4 as-number 100 # address-family ipv4 unicast import-route ospf 10 peer 10.0.2.2 enable peer 10.0.2.2 next-hop-local peer 10.0.3.3 enable peer 10.0.3.3 next-hop-local peer 10.0.41.4 enable # | R3 # bgp 200 peer 10.0.1.1 as-number 200 peer 10.0.1.1 connect-interface LoopBack0 peer 10.0.2.2 as-number 200 peer 10.0.2.2 connect-interface LoopBack0 peer 10.0.35.5 as-number 300 # address-family ipv4 unicast import-route ospf 10 peer 10.0.1.1 enable peer 10.0.1.1 next-hop-local peer 10.0.2.2 enable peer 10.0.2.2 next-hop-local peer 10.0.35.5 enable # |
---|
测试
R4 ping R5
R4 ping R5 loopback地址
实验全网ping通