目录
1、企业分部网络
配置二层VLAN通讯
SW4配置VLAN
测试设备连通性
开启OSPF进程200
R9\R10配置OSPF
测试设备连通性
2、企业内网总部网络
配置内网OSPF100
R1配置--宣告环回以便IBGP建立对等体
R2配置--宣告环回以便IBGP建立对等体
R3
R4
检查设备连通性
3、骨干网络的配置
骨干网使用OSPF 10打通
R5宣告
R6宣告
R8宣告
检查设备是否建邻
检查设备连通性
4、建立BGP
R1与R2建立IBGP对等体关系
AS 200与AS 100建立EBGP对等体关系
AS200内部使用全连接建立IBGP对等体
R5配置
R6配置
R7配置
R8配置
检查设备连通性
R8/R9建立EBGP对等体
5、发布路由
企业内网总部使用network宣告
企业分部使用network宣告
检查路由是否发布编辑
使用import将BGP的路由引入企业总部与企业分部
AS-BY-AS
使用allow-as-loop 命令可将bgp的路由放通
查看BGP路由表
测试路由的连通性
四个网段IP : 192.168.100.0 30\192.168.1.0 24\192.168.2.0 24\10.10.10.0 30
interface GigabitEthernet0/0/1
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
interface GigabitEthernet0/0/3
port link-type access
port default vlan 10
interface GigabitEthernet0/0/1.1
dot1q termination vid 10
ip address 192.168.3.254 255.255.255.0
arp broadcast enable
interface GigabitEthernet0/0/1.2
dot1q termination vid 20
ip address 192.168.4.254 255.255.255.0
arp broadcast enable
R9
ospf 200 router-id 9.9.9.9
area 0.0.0.0
network 192.168.200.2 0.0.0.0
R10
ospf 200 router-id 10.10.10.10
area 0.0.0.0
network 192.168.3.0 0.0.0.255
network 192.168.4.0 0.0.0.255
network 192.168.200.1 0.0.0.0
ospf 100 router-id 1.1.1.1
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 192.168.100.9 0.0.0.0
network 192.168.100.17 0.0.0.0
ospf 100 router-id 2.2.2.2
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 192.168.100.5 0.0.0.0
network 192.168.100.13 0.0.0.0
ospf 100 router-id 3.3.3.3
area 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.168.100.1 0.0.0.0
network 192.168.100.6 0.0.0.0
network 192.168.100.10 0.0.0.0
ospf 100 router-id 4.4.4.4
area 0.0.0.0
network 192.168.2.0 0.0.0.255
network 192.168.100.2 0.0.0.0
network 192.168.100.14 0.0.0.0
network 192.168.100.18 0.0.0.0
ospf 10 router-id 5.5.5.5
area 0.0.0.0
network 10.10.10.17 0.0.0.0
network 10.10.10.21 0.0.0.0
network 5.5.5.5 0.0.0.0
ospf 10 router-id 6.6.6.6
area 0.0.0.0
network 6.6.6.6 0.0.0.0
network 10.10.10.18 0.0.0.0
network 10.10.10.25 0.0.0.0
R7宣告
ospf 10 router-id 7.7.7.7
area 0.0.0.0
network 7.7.7.7 0.0.0.0
network 10.10.10.22 0.0.0.0
network 10.10.10.26 0.0.0.0
network 10.10.10.29 0.0.0.0
network 10.10.10.33 0.0.0.0
ospf 10 router-id 8.8.8.8
area 0.0.0.0
network 8.8.8.8 0.0.0.0
network 10.10.10.30 0.0.0.0
network 10.10.10.34 0.0.0.0
[R1]bgp 100
[R1-bgp]peer 2.2.2.2 as-number 100
[R1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R2]bgp 100
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 1.1.1.1 as-number 100
[R2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R5]bgp 200
[R5]router-id 5.5.5.5
[R5-bgp]peer 10.10.10.1 as-number 100
[R5-bgp]peer 10.10.10.9 as-number 100
[R6]bgp 200
[R6]router-id 6.6.6.6
[R6-bgp]peer 10.10.10.13 as-number 100
[R6-bgp]peer 10.10.10.5 as-number 100
[R1]bgp 100
[R1]router-id 1.1.1.1
[R1-bgp]peer 10.10.10.2 as-number 200
[R1-bgp]peer 10.10.10.6 as-number 200
[R2]bgp 100
[R2]router-id 2.2.2.2
[R2-bgp]peer 10.10.10.14 as-number 200
[R2-bgp]peer 10.10.10.10 as-number 200
[R5-bgp]peer 6.6.6.6 as-number 200
[R5-bgp]peer 8.8.8.8 as-number 200
[R5-bgp]peer 7.7.7.7 as-number 200
[R5-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[R5-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[R5-bgp]peer 8.8.8.8 connect-interface LoopBack 0
[R5-bgp]peer 7.7.7.7 next-hop-local
[R5-bgp]peer 8.8.8.8 next-hop-local
[R6-bgp]peer 5.5.5.5 as-number 200
[R6-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R6-bgp]peer 7.7.7.7 as-number 200
[R6-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[R6-bgp]peer 8.8.8.8 as-number 200
[R6-bgp]peer 8.8.8.8 connect-interface LoopBack 0
[R6-bgp]peer 7.7.7.7 next-hop-local
[R6-bgp]peer 8.8.8.8 next-hop-local
[R7-bgp]peer 5.5.5.5 as-number 200
[R7-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R7-bgp]peer 6.6.6.6 as-number 200
[R7-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[R7-bgp]peer 8.8.8.8 as-number 200
[R7-bgp]peer 8.8.8.8 connect-interface LoopBack 0
[R8-bgp]peer 7.7.7.7 as-number 200
[R8-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[R8-bgp]peer 7.7.7.7 next-hop-local
[R8-bgp]peer 5.5.5.5 as-number 200
[R8-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R8-bgp]peer 5.5.5.5 next-hop-local
[R8-bgp]peer 6.6.6.6 as-number 200
[R8-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[R8-bgp]peer 6.6.6.6 next-hop-local
[R9-bgp]peer 10.10.10.37 as-number 200
[R8-bgp]peer 10.10.10.38 as-number 100
[R1-bgp]network 192.168.1.0
[R1-bgp]network 192.168.2.0
[R2-bgp]network 192.168.1.0
[R2-bgp]network 192.168.2.0
[R9-bgp]network 192.168.3.0
[R9-bgp]network 192.168.4.0
[R1-ospf-100]import-route bgp type 1
[R2-ospf-100]import-route bgp type 1
[R9-ospf-200]import-route bgp type 1
这个时候路由是不通的,因为AS-by-AS AS号相同了无法将路由传递给相同的AS
[R1-bgp]peer 10.10.10.2 allow-as-loop
[R1-bgp]peer 10.10.10.6 allow-as-loop
[R2-bgp]peer 10.10.10.10 allow-as-loop
[R2-bgp]peer 10.10.10.14 allow-as-loop
[R9-bgp]peer 10.10.10.37 allow-as-loop
优化选路:
由于在BGP学来的路由的优先级为255,在OSPF学到的BGP路由优先级为150,防止选路不佳,