拓扑:
子网划分
接口地址
172.16.0.0/21
172.16.0.1/30
172.16.0.2/30
172.16.8.0/21
172.16.8.1/30
172.16.8.2/30
172.16.16.0/21
172.16.16.1/30
172.16.16.2/30
172.16.24.0/21
172.16.24.1/30
172.16.24.2/30
172.16.32.0/21
172.16.32.1/30
172.16.32.2/30
172.16.40.0/21
172.16.40.1/30
172.16.40.2/30
建邻地址
172.16.64.0/18
172.16.64.0/21
172.16.72.0/21
172.16.80.0/21
172.16.88.0/21
172.16.96.0/21
172.16.104.0/21
用户回环地址
172.16.128.0/18
172.16.128.0/21
172.16.136.0/21
172.16.144.0/21
172.16.152.0/21
172.16.160.0/21
172.16.168.0/21
思路:
划分3个AS区域,将AS2区域划分为两个AS区域,这样做可减少反射器数量,用ospf协议使AS2区域互通,在AS1和AS8上的边界路由器上写静态路由,和相邻的邻居建立关系,在AR3和AR6上设置反射器,使得传递的路由下一跳地址合理,在两个小的AS之间要互相定义,宣告回环地址,使得AR1和AR8可以和回环互相通信。
以AR1和AS2区域为例
AR1:
interface GigabitEthernet0/0/0
ip address 12.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.0
#
interface LoopBack1
ip address 11.1.1.1 255.255.255.0
#
bgp 1
router-id 1.1.1.1
peer 172.16.65.0 as-number 2
peer 172.16.65.0 ebgp-max-hop 2
peer 172.16.65.0 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
network 11.1.1.0 255.255.255.0
peer 172.16.65.0 enable
#
ip route-static 172.16.64.0 255.255.248.0 12.1.1.2
#
查看AR1的路由
Total Number of Routes: 7
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 11.1.1.0/24 0.0.0.0 0 0 i
*> 172.16.128.0/21 172.16.65.0 0 0 2i
*> 172.16.136.0/21 172.16.65.0 0 2i
*> 172.16.144.0/21 172.16.65.0 0 2i
*> 172.16.152.0/21 172.16.65.0 0 2i
*> 172.16.160.0/21 172.16.65.0 0 2i
*> 172.16.168.0/21 172.16.65.0 0 2i
AR4:
#
interface GigabitEthernet0/0/0
ip address 172.16.8.2 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 172.16.24.1 255.255.255.252
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 172.16.81.0 255.255.255.255
#
interface LoopBack1
ip address 172.16.145.0 255.255.248.0
#
bgp 64512
router-id 4.4.4.4
confederation id 2
confederation peer-as 64513 //小as之间互相定义
peer 172.16.73.0 as-number 64512
peer 172.16.73.0 connect-interface LoopBack0
peer 172.16.105.0 as-number 64513
peer 172.16.105.0 ebgp-max-hop 2
peer 172.16.105.0 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
network 172.16.144.0 255.255.248.0
peer 172.16.73.0 enable
peer 172.16.73.0 next-hop-local
peer 172.16.105.0 enable
#
ospf 1
area 0.0.0.0
network 172.16.0.0 0.0.255.255
#
AR7获取的路由
Routing Tables: Public
Destinations : 36 Routes : 38
Destination/Mask Proto Pre Cost Flags NextHop Interface
11.1.1.0/24 IBGP 255 0 RD 172.16.65.0 GigabitEthernet0/0/0
IBGP 255 0 RD 172.16.65.0 GigabitEthernet0/0/1
78.1.1.0/24 Direct 0 0 D 78.1.1.7 GigabitEthernet0/0/2
78.1.1.7/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2
78.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
172.16.0.0/30 OSPF 10 3 D 172.16.24.1 GigabitEthernet0/0/1
172.16.8.0/30 OSPF 10 2 D 172.16.24.1 GigabitEthernet0/0/1
172.16.16.0/30 OSPF 10 3 D 172.16.40.1 GigabitEthernet0/0/0
172.16.24.0/30 Direct 0 0 D 172.16.24.2 GigabitEthernet0/0/1
172.16.24.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
172.16.24.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
172.16.32.0/30 OSPF 10 2 D 172.16.40.1 GigabitEthernet0/0/0
172.16.40.0/30 Direct 0 0 D 172.16.40.2 GigabitEthernet0/0/0
172.16.40.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
172.16.40.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
172.16.65.0/32 OSPF 10 3 D 172.16.40.1 GigabitEthernet0/0/0
OSPF 10 3 D 172.16.24.1 GigabitEthernet0/0/1
172.16.73.0/32 OSPF 10 2 D 172.16.24.1 GigabitEthernet0/0/1
172.16.81.0/32 OSPF 10 1 D 172.16.24.1 GigabitEthernet0/0/1
172.16.89.0/32 OSPF 10 2 D 172.16.40.1 GigabitEthernet0/0/0
172.16.97.0/32 OSPF 10 1 D 172.16.40.1 GigabitEthernet0/0/0
172.16.105.0/32 Direct 0 0 D 127.0.0.1 LoopBack0
172.16.128.0/21 OSPF 10 3 D 172.16.40.1 GigabitEthernet0/0/0
OSPF 10 3 D 172.16.24.1 GigabitEthernet0/0/1
172.16.136.0/21 IBGP 255 0 RD 172.16.73.0 GigabitEthernet0/0/1
172.16.137.0/32 OSPF 10 2 D 172.16.24.1 GigabitEthernet0/0/1
172.16.144.0/21 IBGP 255 0 RD 172.16.81.0 GigabitEthernet0/0/1
172.16.145.0/32 OSPF 10 1 D 172.16.24.1 GigabitEthernet0/0/1
172.16.152.0/21 IBGP 255 0 RD 172.16.89.0 GigabitEthernet0/0/0
172.16.153.0/32 OSPF 10 2 D 172.16.40.1 GigabitEthernet0/0/0
172.16.160.0/21 IBGP 255 0 RD 172.16.97.0 GigabitEthernet0/0/0
172.16.161.0/32 OSPF 10 1 D 172.16.40.1 GigabitEthernet0/0/0
172.16.168.0/21 Direct 0 0 D 172.16.169.0 LoopBack1
172.16.169.0/32 Direct 0 0 D 127.0.0.1 LoopBack1
172.16.175.255/32 Direct 0 0 D 127.0.0.1 LoopBack1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
测试互通性:
AR7回环pingAR1回环
ping -a 172.16.169.0 11.1.1.1
PING 11.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 11.1.1.1: bytes=56 Sequence=1 ttl=252 time=60 ms
Reply from 11.1.1.1: bytes=56 Sequence=2 ttl=252 time=50 ms
Reply from 11.1.1.1: bytes=56 Sequence=3 ttl=252 time=50 ms
Reply from 11.1.1.1: bytes=56 Sequence=4 ttl=252 time=30 ms
Reply from 11.1.1.1: bytes=56 Sequence=5 ttl=252 time=30 ms
--- 11.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/44/60 ms
ping -a 11.1.1.1 172.16.169.0
PING 172.16.169.0: 56 data bytes, press CTRL_C to break
Reply from 172.16.169.0: bytes=56 Sequence=1 ttl=252 time=60 ms
Reply from 172.16.169.0: bytes=56 Sequence=2 ttl=252 time=40 ms
Reply from 172.16.169.0: bytes=56 Sequence=3 ttl=252 time=30 ms
Reply from 172.16.169.0: bytes=56 Sequence=4 ttl=252 time=40 ms
Reply from 172.16.169.0: bytes=56 Sequence=5 ttl=252 time=30 ms
--- 172.16.169.0 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/40/60 ms
AR5回环pingAR1回环:
ping -a 172.16.153.0 11.1.1.1
PING 11.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 11.1.1.1: bytes=56 Sequence=1 ttl=254 time=30 ms
Reply from 11.1.1.1: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 11.1.1.1: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 11.1.1.1: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 11.1.1.1: bytes=56 Sequence=5 ttl=254 time=20 ms
--- 11.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/26/30 ms