一:IP地址规划
172.16.0.0/16
骨干
172.16.0.0/24
172.16.0.0/30
172.16.0.4/30
172.16.0.8/30
172.16.0.12/30
172.16.0.16/30
172.16.0.20/30
建邻环回
172.16.1.0/24
172.16.1.2/32
172.16.1.3/32
172.16.1.4/32
172.16.1.5/32
172.16.1.6/32
172.16.1.7/32
实验要求:
- R2-7每台路由器均存在一个环回接口用于建立邻居,同时还存在一个环回来代表连接用户的接口;最终这些连接用户的接口网络需要可以和R1/8的环回通讯
- AS2网段地址172.16.0.0/16 减路由条目数量
实验思路:
根据已给地址网段,配置ip;配置完成后,先配通IGP(ospf),配置完成后,再配置BGP。
二:用OSPF跑通AS2区域
Destination/Mask Proto Pre Cost Flags NextHop Interface
172.16.0.4/30 OSPF 10 5 D 172.16.0.10 GigabitEthernet
0/0/2
172.16.0.12/30 OSPF 10 2 D 172.16.0.10 GigabitEthernet
0/0/2
172.16.0.16/30 OSPF 10 3 D 172.16.0.10 GigabitEthernet
0/0/2
172.16.0.20/30 OSPF 10 4 D 172.16.0.10 GigabitEthernet
0/0/2
172.16.1.3/32 OSPF 10 1 D 172.16.0.2 GigabitEthernet
0/0/0
172.16.1.4/32 OSPF 10 4 D 172.16.0.10 GigabitEthernet
0/0/2
172.16.1.5/32 OSPF 10 1 D 172.16.0.10 GigabitEthernet
0/0/2
172.16.1.6/32 OSPF 10 2 D 172.16.0.10 GigabitEthernet
0/0/2
172.16.1.7/32 OSPF 10 3 D 172.16.0.10 GigabitEthernet
0/0/2
测试:用R2环回ping R7环回
三:BGP建邻
R1:
[r1]bgp 1
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.1.1.2 as-number 2
[r1-bgp]network 1.1.1.1 24
r2:
[r2]bgp 64512
[r2-bgp]router-id 2.2.2.2
申明本地的大AS号:
[r2-bgp]confederation id 2
告知本地直连的其他小AS号:
[r2-bgp]confederation peer-as 64513
[r2-bgp]peer 12.1.1.1 as-number 1
[r2-bgp]peer 172.16.1.3 as-number 64512
必须将源地址也修改为环回接口:
[r2-bgp]peer 172.16.1.3 connect-interface LoopBack 0
将BGP路由传递给本地的邻居时修改下一跳地址为本地建立邻居关系的源ip地址:
[r2-bgp]peer 172.16.1.3 next-hop-local
[r2-bgp]peer 172.16.1.5 as-number 64513
[r2-bgp]peer 172.16.1.5 connect-interface LoopBack 0
[r2-bgp]peer 172.16.1.5 next-hop-local
修改ttl值:
[r2-bgp]peer 172.16.1.5 ebgp-max-hop 2
r3:
[r3]bgp 64512
[r3-bgp]router-id 3.3.3.3
[r3-bgp]confederation id 2
[r3-bgp]peer 172.16.1.2 as-number 64512
[r3-bgp]peer 172.16.1.2 connect-interface LoopBack 0
[r3-bgp]peer 172.16.1.4 as-number 64512
[r3-bgp]peer 172.16.1.4 connect-interface LoopBack 0
邻居172.16.1.2成为本地的客户端,同时本地成为RR:
[r3-bgp]peer 172.16.1.2 reflect-client
r4:
[r4]bgp 64512
[r4-bgp]router-id 4.4.4.4
[r4-bgp]confederation id 2
[r4-bgp]confederation peer-as 64513
[r4-bgp]peer 172.16.1.3 as-number 64512
[r4-bgp]peer 172.16.1.3 connect-interface LoopBack 0
[r4-bgp]peer 172.16.1.7 as-number 64513
[r4-bgp]peer 172.16.1.7 connect-interface LoopBack
[r4-bgp]peer 172.16.1.7 connect-interface LoopBack 0
[r4-bgp]peer 172.16.1.7 ebgp-max-hop 2
r5:
[r5]bgp 64513
[r5-bgp]router-id 5.5.5.5
[r5-bgp]confederation id 2
[r5-bgp]confederation peer-as 64512
[r5-bgp]peer 172.16.1.2 as-number 64512
[r5-bgp]peer 172.16.1.2 connect-interface LoopBack 0
[r5-bgp]peer 172.16.1.2 ebgp-max-hop 2
[r5-bgp]peer 172.16.1.6 as-number 65413
[r5-bgp]peer 172.16.1.6 connect-interface LoopBack 0
r6:
[r6]bgp 64513
[r6-bgp]router-id 6.6.6.6
[r6-bgp]confederation id 2
[r6-bgp]peer 172.16.1.5 as-number 64513
[r6-bgp]peer 172.16.1.5 connect-interface LoopBack 0
[r6-bgp]peer 172.16.1.7 as-number 64513
[r6-bgp]peer 172.16.1.7 connect-interface LoopBack 0
[r6-bgp]peer 172.16.1.5 reflect-client
r7:
[r7]bgp 64513
[r7-bgp]router-id 7.7.7.7
[r7-bgp]confederation id 2
[r7-bgp]confederation peer-as 64512
[r7-bgp]peer 172.16.1.4 as-number 64512
[r7-bgp]peer 172.16.1.4 connect-interface LoopBack 0
[r7-bgp]peer 172.16.1.4 next-hop-local
[r7-bgp]peer 172.16.1.4 ebgp-max-hop 2
[r7-bgp]peer 172.16.1.6 as-number 64513
[r7-bgp]peer 172.16.1.6 connect-interface LoopBack 0
[r7-bgp]peer 172.16.1.6 next-hop-local
[r7-bgp]peer 78.1.1.2 as-number 3
r8:
[r8]bgp 3
[r8-bgp]router-id 8.8.8.8
[r8-bgp]peer 78.1.1.1 as-number 2
【2】BGP宣告
r1:
[r1-bgp]network 1.1.1.0 24
r2:
此处宣告使用汇总网段:
[r2]ip route-static 172.16.0.0 21 NULL 0
[r2]bgp 64512
[r2-bgp]network 172.16.0.0 21
r7:
[r7]ip route-static 172.16.0.0 21 NULL 0
[r7]bgp 64513
[r7-bgp]network 172.16.0.0 21
r8:
[r8-bgp]network 8.8.8.0 24
R8
R7
R2
R1环回PING R8环回