因为题目没有规定具体IP规划,所以为了方便路由汇总我将地址规划如下。
公网部分
23.1.1.0 24
34.1.1.0 24
3.3.3.3 24
IPV4/V6部分
IPV4部分
192.168.1.0 25 两个环回
192.168.0.0 30 骨干链路
192.168.2.1 24 AR的环回
IPV6部分
因为题目要求使用6to4tunnel,所以通过ipv4地址换算生成。
23.1.1.1 化成16进制为
0001 0111 0000 0001 0000 0001 0000 0001
1701:0101 最后填上2002和前缀生成ipv6地址
2002:1701:0101::/48
借16位
2002:1701:0101:0000::64——2002:1701:0101:FFFF::64
因为环回有两个所以再借一位分配给环回
2002:1701:0101:0000:0000 0000 0000 0000::/65
2002:1701:0101:1000:0000 0000 0000 0000::/65
化简后为
2002:1701:101::/65
2002:1701:101:0:8000::/65
右边IPV6部分
通过IPV4地址34.1.1.2 进行换算
2002:2201:0102::/48
借一位
2002:2201:0102::/49 AS1
再借16位
2002:2201:0102::/64——2002:2201:0102:7FFF::/64
2002:2201:0102:8000::/49 AS2
再借16位
2002:2201:0102:8000::/64——2002:2201:0102:FFFF::/64
首先需要实现公网全网可达
以AR2为例
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ip address 23.1.1.1 255.255.255.0
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.0.2 30
[r2]int lo0
[r2-LoopBack0]ip address 192.168.2.1 255.255.255.0
使用ospf协议实现全网可达,以AR3为例
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[r1]int lo0
[r1-LoopBack0]ip address 192.168.1.1 25
[r1]int lo1
[r1-LoopBack0]ip address 192.168.1.129 25
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.0.1 30
使用rip协议实现全网可达
[r1]rip 1
[r1-rip-1]undo summary
[r1-rip-1] version 2
[r1-rip-1]network 192.168.1.0
[r1-rip-1]network 192.168.0.0
汇总路由
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]rip summary-address 192.168.1.0 255.255.255.0
设置空接口防环
[r1]ip route-static 192.168.1.0 24 NULL 0
在AR2上对AR1发送一条缺省
[r2]rip 1
[r2-rip-1]default-route originate
使用ACL使AR1能正常上网
[r2]acl 2000
[r2-acl-basic-2000]rule permit source 192.168.0.0 0.0.255.255
[r2-acl-basic-2000]int g0/0/0
[r2-GigabitEthernet0/0/1]nat outbound 2000
[r1]ipv6
[r1]int lo0
[r1-LoopBack0]ipv6 enable
[r1-LoopBack0]ipv6 address 2002:1701:101::1 65
[r1-LoopBack0]int lo1
[r1-LoopBack1]ipv6 enable
[r1-LoopBack1]ipv6 address 2002:1701:101:0:8000::1 65
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ipv6 enable
[r1-GigabitEthernet0/0/0]ipv6 address 2002:1701:0101:1::1 64
使用RIPNG实现全网可达
[r1]ripng 1
[r1-ripng-1]int lo0
[r1-LoopBack0]ripng 1 enable
[r1-LoopBack0]int lo1
[r1-LoopBack1]ripng 1 enable
[r1-LoopBack1]int g0/0/0
[r1-GigabitEthernet0/0/0]ripng 1 enable
配置完后可以通过display ipv6 routing-table protocol ripng
命令查看
汇总路由
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]rip
[r1-GigabitEthernet0/0/0]ripng summary-address 2002:1701:101:: 64
设置空接口防环
[r1]ip route-static 2002:1701:0101:0000::64 NULL 0
在AR2上对AR1发送一条缺省
使用ipv6发送缺省时是在边界路由器连接内网的接口上配置
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ripng default-route only
配置6to4tunnel
[r2]int Tunnel 0/0/0
[r2-Tunnel0/0/0]ipv6 enable
[r2-Tunnel0/0/0]ipv6 address 2002:1701:0101:3::1 64
[r2-Tunnel0/0/0]tunnel-protocol ipv6-ipv4 6to4
[r2-Tunnel0/0/0]source 23.1.1.1
注:配置tunnel时需注意使用转换ipv6地址的ipv4地址
[r2]ipv6 route-static 2002:: 16 Tunnel 0/0/0
设置出口
配置基础部分
AS1中
[r4]ipv6
[r4]int lo0
[r4-LoopBack0]ipv6 address 2002:2201:0102::1 64
[r4]int g0/0/1
[r4-GigabitEthernet0/0/1]ipv6 enable
[r4-GigabitEthernet0/0/1]ipv6 address 2002:2201:0102:1::1 64
AS2中以AR5为例
[r5]ipv6
[r5]int lo0
[r5-LoopBack0]ipv6 address 2002:2201:102:8000::1
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ipv6 enable
[r5-GigabitEthernet0/0/0]ipv6 address 2002:2201:102:1::2
[r5]int g0/0/1
[r5-GigabitEthernet0/0/1]ipv6 enable
[r5-GigabitEthernet0/0/1]ipv6 address 2002:2201:102:8001::1
使用ospfv3实现AS2全网可达
以AR5为例
[r5]ospfv3 1
[r5-ospfv3-1]router-id 5.5.5.5
[r5-ospfv3-1]int lo0
[r5-LoopBack0]ospfv3 1 area 0
[r5-LoopBack0]int g0/0/1
[r5-GigabitEthernet0/0/1]ospfv3 1 area 0
配置所有路由器后可以通过display ospfv3 peer
命令查看邻居关系
AR4与AR5之间配置EBGP邻居关系
[r4]bgp 1
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 2002:2201:102:1::2 as-number 2
[r4-bgp]ipv6-family
[r4-bgp-af-ipv6]peer 2002:2201:102:1::2 enable
[r5]bgp 64512
[r5-bgp]router-id 5.5.5.5
[r5-bgp]confederation id 2
[r5-bgp]peer 2002:2201:102:1::1 as-number 1
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]peer 2002:2201:102:1::1 enable
在配置AR5-AR8路由器bgp邻居时,由于需要使用环回建立邻居,但他们的环回地址比较复杂,为了方便以后管理,我们可以使用私有地址来作为环回地址建立邻居。
[r5]int lo0
[r5-LoopBack0]ipv6 address 5::5 64
[r6]int lo0
[r6-LoopBack0]ipv6 address 6::6 64
[r7]int lo0
[r7-LoopBack0]ipv6 address 7::7 64
[r8]int lo0
[r8-LoopBack0]ipv6 address 8::8 64
建立IBGP邻居
以AR5与AR7为例
[r5]bgp 64512
[r5-bgp]peer 6::6 as-number 64512
[r5-bgp]peer 6::6 connect-interface LoopBack 0 5::5
注:若不在环回接口后不添加建邻的环回地址会以默认第一个环回地址建立邻居
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]peer 6::6 enable
[r7]bgp 64512
[r7-bgp]router-id 7.7.7.7
[r7-bgp]confederation id 2
[r7-bgp]confederation peer-as 64513
[r7-bgp]peer 6::6 as-number 64512
[r7-bgp]peer 6::6 connect-interface LoopBack 0 7::7
[r7-bgp]peer 8::8 as-number 64513
[r7-bgp]peer 8::8 connect-interface LoopBack 0 7::7
[r7-bgp]peer 8::8 ebgp-max-hop 2
[r7-bgp]ipv6-family
[r7-bgp-af-ipv6]peer 6::6 enable
[r7-bgp-af-ipv6]peer 8::8 enable
实现AS1与AS2之间全网可达,并优
[r4]bgp 1
注:在ipv6中,bgp宣告一定要在ipv6家族模式中宣告
[r4-bgp]ipv6-family
[r4-bgp-af-ipv6]network 2002:: 16
汇总AS2的路由
[r5]ipv6 route-static 2002:2201:0102:8000:: 49 NULL 0
[r5]bgp 64512
注:在ipv6中,bgp宣告一定要在ipv6家族模式中宣告
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]network 2002:2201:0102:8000:: 49
[r5]bgp 64512
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]peer 6::6 next-hop-local
修改下一跳
[r6]bgp 64512
[r6-bgp]ipv6-family
[r6-bgp-af-ipv6]peer 7::7 reflect-client
设置反射器
配置6to4tunnel
[r4]int Tunnel 0/0/0
[r4-Tunnel0/0/0]ipv6 enable
[r4-Tunnel0/0/0]ipv6 address 2002:2201:0101:2::1 64
[r4-Tunnel0/0/0]tunnel-protocol ipv6-ipv4 6to4
[r4-Tunnel0/0/0]source 34.1.1.2
注:配置tunnel时需注意使用转换ipv6地址的ipv4地址
[r4]ipv6 route-static 2002:: 16 Tunnel 0/0/0