一.实验拓补
二.实验要求
R2-R7每台路由器均存在一个环回接口用于建立邻居;同时还存在一个环回代表连接用户的接口;最终这些连接用户的接口网络 需要和r1/8的环回通讯
2.AS.网段网址172.16.0.0/16 减少路由条目数
三.ip地址规划
172.16.0.0/16
172.16.0.0/16 借到24位 可用范围网段:0-31
172.16.0.0/24 分6个网段IP借3位
172.16.0.0/27 172.16.0.32/27 172.16.0.64/27 172.16.0.96/27
172.16.0.128/27 172.16.0.160/27 骨干网段
172.16.1.0/24
172.16.1.0/30 172.16.1.4/30 172.16.1.8/30
172.16.1.12/30 172.16.1.16/30 172.16.1.20/30
172.16.2.0/24 172.16.3.0/24 172.16.4.0/24
172.16.5.0/24
ip配置
r1
sys sys r1
interface g0/0/0
IP address12.1.1.1/24
q
interface loopback 0
ip address 1.1.1.1/24
r2
sys sys r2
interface g0/0/0
ip address 172.16.0.1/27 q
interface g0/0/1
ip address 172.16.0.1/27 q
interface g0/0/2
ip address 172.16.0.65/27 q
interface loopback 0
IP address 172.16.2.1/24 q
interface loopbacl 1
ip address 172.16.1.1/30
r3
interface g0/0/0
IP address 172.16.0.2/27
interface g0/0/1
ip address 172.16.0.33/27
interface loopback 0
ip address 172.16.3.1/24
interface loopback 1
IP address 172.16.1.5/30
r4
interface g0/0/0
ip address 172.16.0.34/27
interface g0/0/1
ip address 172.16.0.97/27
interface loopback 0
IP address 172.16.4.1/24
interface loopback 1
ip address 172.16.1.9/30
r5
interface g0/0/0
ip address 172.16.0.66/27
interface g0/0/1
ip address 172.16.0.120/27
interface loopback 0
ip address 172.16.1.13/30
interface loopback 1
ip address 172.16.1.13/30
r6
interface g0/0/1
ip address 172.16.0.130/27
interface g0/0/2
ip address 172.16.0.161/27
interface loopback 0
ip address 172.16.6.1/24
interface loopback 1
ip address 172.16.1.17/30
r7
interface g0/0/0
ip address 172.16.0.98/27
interface g0/0/1
ip address 78.1.1.1/24
interface g0/0/2
ip address 172.16.0.162/27
interface loopback 0
ip address 172.16.7.1/24
interface loopback 1
ip address 172.16.1.21/30
r8
interface g0/0/0
ip address 78.1.1.2/24
interface loopback 0
ip address 8.8.8.8/24
AS2 区域启动 OSPF
r2
ospf 1 router-id 2.2.2.2
area 0
network 172.16.0.0 0.0.255.255
r3
ospf 1 router-id 3.3.3.3
area 0
network 172.16.0.0 0.0.255.255
r4
ospf 1 router-id 4.4.4.4
area 0
network 172.16.0.0 0.0.255.255
r5
ospf 1 router-id 5.5.5.5
area 0
network 172.16.0.0 0.0.255.255
r6
ospf 1 router-id 6.6.6.6
area 0
network 172.16.0.0 0.0.255.255
r7
ospf 1 router-id 7.7.7.7
area 0
network 172.16.0.0 0.0.255.255
将用户网段工作方式改为broadcast
-
[r1]int lo0
-
[r1-LoopBack0]ospf network-type broadcast
其余路由器相同
BGP配置
r1
bgp 1
router-id 1.1.1.1
peer 12.1.1.2 as-number 2
r2
bgp 64512
router-id 2.2.2.2
confederation id 2
confederation peer-as 64513
peer 12.1.1.1 as-number 1
peer 172.16.1.5 as-number 64512
peer 172.16.1.5 connect-interface LoopBack 1
peer 172.16.1.13 as-number 64513
peer 172.16.1.13 connect-interface LoopBack 1
peer 172.16.1.13 ebgp-max-hop 2
r3
bgp 64512
router-id 3.3.3.3
confederation id 2
peer 172.16.1.1 as-number 64512
peer 172.16.1.1 connect-interface LoopBack 1
peer 172.16.1.9 as-number 64512
peer 172.16.1.9 connect-interface LoopBack 1
bgp 64512
router-id 3.3.3.3
confederation id 2
confederation peer-as 64513
peer 172.16.1.1 as-number 64512
peer 172.16.1.1 connect-interface LoopBack 1
peer 172.16.1.9 as-number 64512
peer 172.16.1.9 connect-interface LoopBack 1
r4
bgp 64512
router-id 4.4.4.4
confederation id 2
confederation peer-as 64513
peer 172.16.1.5 as-number 64512
peer 172.16.1.5 connect-interface LoopBack 1
peer 172.16.1.21 as-number 64513
peer 172.16.1.21 connect-interface LoopBack 1
peer 172.16.1.21 ebgp-max-hop 2
r5
bgp 64513
router-id 5.5.5.5
confederation id 2
confederation peer-as 64512
peer 172.16.1.17 as-number 64513
peer 172.16.1.17 connect-interface LoopBack 1
peer 172.16.1.1 as-number 64512
peer 172.16.1.1 connect-interface LoopBack 1
peer 172.16.1.1 ebgp-max-hop 2
r6
bgp 64513
router-id 6.6.6.6
confederation id 2
peer 172.16.1.21 as-number 64513
peer 172.16.1.21 connect-interface LoopBack 1
peer 172.16.1.13 as-number 64513
peer 172.16.1.13 connect-interface LoopBack 1
r7
bgp 64513
router-id 7.7.7.7
confederation id 2
confederation peer-as 64512
peer 172.16.1.17 as-number 64513
peer 172.16.1.17 connect-interface LoopBack 1
peer 172.16.1.9 as-number 64512
peer 172.16.1.9 connect-interface LoopBack 1
peer 172.16.1.9 ebgp-max-hop 2
peer 78.1.1.2 as-number 3
r8
bgp 3
router-id 8.8.8.8
peer 78.1.1.1 as-number 2
BGP宣告
-
bgp 1
-
net
-
network 1.1.1.0 24
-
bgp 3
-
net
-
network 8.8.8.0 24
打破IBGP水平分割
bgp 64512
peer 172.16.1.1 reflect-client
bgp 64513
peer 172.16.1.21 reflect-client
在r2和r7上修改下一跳
r2
peer 172.16.1.13 next-hop-local
peer 172.16.1.5 next-hop-local
r7
peer 172.16.1.9 next-hop-local
peer 172.16.1.17next-hop-local
宣告AS2内部路由条目
-
ip route-static 172.16.0.0 21 NULL 0
-
network 172.16.0.0 21
-
ip route-static 172.16.0.0 21 NULL 0
-
network 172.16.0.0 21