一、实验拓扑图
二、实验要求
1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP;
2、R3-R5、R6、R7为MGRE环境,R3为中心站点;
3、整个OSPF环境IP基于172.16.0.0/16划分;除了R12有两个环回,其他路由器均有一个环回IP
4、所有设备均可访问R4的环回;
5、减少LSA的更新量,加快收敛,保障更新安全;
6、全网可达;
三、实验步骤及思路
1,配IP地址
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 172.16.32.1 19
[R1-GigabitEthernet0/0/0]int l0
[R1-LoopBack0]ip add 172.168.34.1 19
[R1-LoopBack0]quit
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 172.16.32.2 19
[R2-GigabitEthernet0/0/0]int l0
[R2-LoopBack0]ip add 172.168.35.2 24
[R2-LoopBack0]quit
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 172.168.32.3 19
[R3-GigabitEthernet0/0/0]int l0
[R3-LoopBack0]ip add 172.16.36.3 24
[R3-LoopBack0]int s4/0/0
[R3-Serial4/0/0]ip add 34.0.0.3 24
[R3-Serial4/0/0]quit
R4]int s4/0/0
[R4-Serial4/0/0]ip add 34.0.0.4 24
[R4-Serial4/0/0]int s4/0/1
[R4-Serial4/0/1]ip add 45.0.0.4 24
[R4-Serial4/0/1]int s3/0/0
[R4-Serial3/0/0]ip add 46.0.0.4 24
[R4-Serial3/0/0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 47.0.0.4 24
[R4-LoopBack0]ip add 172.16.2.4 24
[R4-LoopBack0]quit
[R5]int s4/0/0
[R5-Serial4/0/0]ip add 45.0.0.5 24
[R5-Serial4/0/0]int l0
[R5-LoopBack0]ip add 172.168.3.5 24
[R5-LoopBack0]quit
[R6]int s4/0/0
[R6-Serial4/0/0]ip add 46.0.0.6 24
[R6-Serial4/0/0]int g0/0/0
[R6-GigabitEthernet0/0/0]ip add 172.16.65.6 30
[R6-GigabitEthernet0/0/0]int l0
[R6-LoopBack0]ip add 172.16.4.6 24
[R6-LoopBack0]quit
[R7]int g0/0/1
[R7-GigabitEthernet0/0/1]ip add 172.16.97.119
[R7-GigabitEthernet0/0/1]int g0/0/0
[R7-GigabitEthernet0/0/0]ip add 47.0.0.7 24
[R7-GigabitEthernet0/0/0]int l0
[R7-LoopBack0]ip add 172.16.5.7 24
[R7-LoopBack0]quit
[R8]int g0/0/0
[R8-GigabitEthernet0/0/0]ip add 172.168.97.2 30
[R8-GigabitEthernet0/0/0]int g0/0/1
[R8-GigabitEthernet0/0/1]ip add 172.168.97.5 30
[R8-GigabitEthernet0/0/1]int l0
[R8-LoopBack0]ip add 172.16.98.8 24
[R8-LoopBack0]quit
[R9]int g0/0/0
[R9-GigabitEthernet0/0/0]ip add 172.16.97.6 30
[R9-GigabitEthernet0/0/0]int g0/0/1
[R9-GigabitEthernet0/0/1]ip add 172.16.129.1 30
[R9-GigabitEthernet0/0/1]int l0
[R9-LoopBack0]ip add 172.16.130.9 24
[R9-LoopBack0]quit
[R10]int l0
[R10-LoopBack0]ip add 172.16.131.10 24
[R10-LoopBack0]int g0/0/0
[R10-GigabitEthernet0/0/0]ip add 172.16.129.2 30
[R11-GigabitEthernet0/0/0]int g0/0/1
[R11-GigabitEthernet0/0/1]ip add 172.16.65.5 30
[R11-GigabitEthernet0/0/1]int g0/0/0
[R11-GigabitEthernet0/0/0]ip add 172.16.65.2 30
[R11]int l0
[R11-LoopBack0]ip add 172.16.66.11 24
[R11-LoopBack0]quit
[R12]int g0/0/0
[R12-GigabitEthernet0/0/0]ip add 172.16.65.6 30
[R12-GigabitEthernet0/0/0]int l0
[R12-LoopBack0]iip add 172.16.160.12 24
R12-LoopBack0]int l1
[R12-LoopBack1]ip add 172.16.161.12 24
[R12-LoopBack1]quit
2,用静态缺省配置公网通
[R3]ip route-static 0.0.0.0 0 34.0.0.4
[R5]ip route-static 0.0.0.0 0 45.0.0.4
R6]ip route-static 0.0.0.0 0 46.0.0.4
[R7]ip route-static 0.0.0.0 0 47.0.0.4
测试:
3、用ospf协议配置私网通
R1]ospf 1 ro
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1-area-0.0.0.1]network 0.0.0.0 255.255.255.255
[R1-ospf-1-area-0.0.0.1]quit
R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]ne
[R2-ospf-1-area-0.0.0.1]network 0.0.0.0 255.255.255.255
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1]network 172.16.36.0 0.0.0.255
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]network 172.16.4.0 0.0.0.255
[R6-ospf-1-area-0.0.0.0]
[R6-ospf-1-area-0.0.0.0]a 2
[R6-ospf-1-area-0.0.0.2]network 172.16.64.1 0.0.0.0
R11]ospf 1 router-id 11.11.11.11
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]ne
[R11-ospf-1-area-0.0.0.2]network 0.0.0.0 255.255.255.255
[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]net
[R12-ospf-1-area-0.0.0.2]network 172.16.65.6 0.0.0.0
在R12上起rip的进程
R12]rip 1
[R12-rip-1]v 2
[R12-rip-1]undo su
[R12-rip-1]undo summary
[R12-rip-1]net
[R12-rip-1]network 172.16.0.0
[R12-rip-1]quit
R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]net
[R7-ospf-1-area-0.0.0.0]network 172.16.5.0 0.0.0.255
[R7-ospf-1-area-0.0.0.0]a 3
[R7-ospf-1-area-0.0.0.3]network 172.16.97.1 0.0.0.0
[R7-ospf-1-area-0.0.0.3]quit
R7]ospf 1 router-id 7.7.7.7
R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]ne
[R8-ospf-1-area-0.0.0.3]network 0.0.0.0 255.255.255.255.255
[R8-ospf-1-area-0.0.0.3]quit
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]ne
[R9-ospf-1-area-0.0.0.3]network 172.16.96.0 0.0.31.255
[R9-ospf-2]a 4
[R9-ospf-2-area-0.0.0.4]network 172.16.130.9 0.0.0.0
[R9-ospf-2-area-0.0.0.4]quit
[R10]ospf 2 router-id 10.10.10.10
[R10-ospf-2]a 4
[R10-ospf-2-area-0.0.0.4]ne
[R10-ospf-2-area-0.0.0.4]network 172.16.128.0.0.31.255
[R5lospf 1 router-id 5.5.5
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]ne 172.16.3.0 0.0.0.255
四、配置MG2E隧道,
R3为中心站点
[R3lint Tunnel 0/0/0
[R3-Tunnel0/0/0]ip add 172.16.6.3 24
[R3-Tunne10/0/0]tunnel-protocol gre p2mp
[R3-Tunne10/0/0]source 34.0.0.3
[R3-Tunne10/0/0]nhrp network-id 100
[R3-Tunne10/0/0]nhrp entry multicast dynamic
R3-Tunne10/0/01
R5,6,7为分支站点
R5]int runnel 0/0/0
[R5-Tunne1l0/0/0]ip add 172.16.6.5 24
[R5-Tunne10/0/0]tunnel-protocol gre p2mp
IR5-Tunne10/0/0]source sR5-Tunne10/0/0]source serial 4/0/0
-Tunne10/0/0]nhrp entry 172.16.6.3 34.0.0.3 register
IR5-Tunne10/0/0]nhrp network-id 100
R6jint runne1 0/0/0
[R6-Tunne10/0/0]tunnel-protocol gre p2mp
[R6-Tunne10/0/0]source serial 4/0/0
IR6-Tunne10/0/0]nhrp network-id 100
[R6-Tunne10/0/0]nhrp entry 172.16.6.3 34.0.0.3 register
IR7]int Tunnel 0/0/0
[R7-Tunne10/0/0]ip add 172.16.6.7 24
[R7-Tunne10/0/0]tunnel-protocol gre p2mp
[R7-Tunne10/0/0]source GigabitEthernet 0/0/0
[R7-Tunne10/0/0]nhrp network-id 100
[R7-Tunne10/0/0]entry 172.16.6.3 34.0.0.3 register
五、配置路由协议,转递极端私网路由
[R3]ospf 1
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
R6]ospf 1
R6-ospf-1]a 0
R6-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
R6-ospf-1-area-0.0.0.0]ne 172.16.4.0 0.0.0.255
[R7lospf 1 router-id 7.7.7.7
[R7-0spf-1]a 0
[R7-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
进到隧道接口, 更改接口类型
[R3lint Tunnel 0/0/0
[R3-Tunne10/0/0]ospf network-type broadcast
R6]int Tunne1 0/0/0
R6-Tunne10/0/0]ospf network-type broadcast
R7]int Tunnel 0/0/0
R7-Tunne10/0/0]ospf network-type broadcast
六、将R5,6,7的DR选取权关闭,只留一个DR选取
[R5lint Tunnel 0/0/0
[R5-Tunne10/0/0]ospf dr-priority 0
[R6]int t 0/0/0
[R6-Tunne10/0/0]ospf dr-priority 0
[R7]lint Tunnel 0/0/0
[R7-Tunne10/0/0]ospf dr-priority 0
七、访问R4环回 ,做NAT
[R3]acl 2000
R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
R3-acl-basic-2000]quit
[R3]int s4/0/0
[R3-Seria14/0/0]nat outbound 2000
[R3-seria14/0/0]quit
R61ac1 2000
[R6-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
R6]int s4/0/0
R6-seria14/0/0]nat outbound 2000
R6-seria14/0/0]quit
[R7]int go/0/0
[R7-GigabitEthernet0/0/0]nat outbound 2000
[R7-GigabitEthernet0/0/0]quit
八、减少LSA的更新量 ,先配汇总路由聚合
区域间聚合:
[R3]ospf 1
IR3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]ab
[R3-ospf-1-area-0.0.0.1labr-summary 172.16.32.0 255.255.224.0
[R3-ospf-1-area-0.0.0.1lquit
[R6]ospf 1
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0
[R6-ospf-1-area-0.0.0.2]quit
(R7]0spf 1
[R7-0spf-1]a 3
[R7-ospf-1-area-0.0.0.3]quit
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
[R7-ospf-1-area-0.0.0.3]quit
[R12]ospf 1
[R12-0spf-1]as
[R12-ospf-1lasbr-summary 172.16.160.0 255.255.224.0
[R12-ospf-1]quit
[R9]ospf 1
[R9-ospf-1lasbr-summary 172.16.128.0 255.255.224.0
[R9-ospf-1lquit
然后做防滑
[R3]ip route-static 172.16.32.0 19 NULL O
[R6]ip route-static 172.16.64.0 19 NULL O
IR7]ip route-static 172.16.96.0 19 NULL O
R12]ip route-$tatic 172.16.160.0 19 NULL O
[R9]ip route-static 172.16.128.0 19 NULL O
九、配置特殊区域
[Rl]ospf 1
[R1-ospf-1]a 1
[R1-ospf-1-ara-0.0.0.1]stub no-summary
[R1-ospf-1-ara-0.0.0.1]quit
[R2]ospf 1
[R2-ospf-1]a 1
[R2-ospf-1-ara-0.0.0.1]stub no-summary
[R2-ospf-1-ara-0.0.0.1]quit
[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-ara-0.0.0.1]stub no-summary
[R3-ospf-1-ara-0.0.0.1]quit
[R2]ospf 1
[R2-ospf-1]a 2
[R2-ospf-1-ara-0.0.0.1]stub no-summary
[R2-ospf-1-ara-0.0.0.1]quit
[R6]ospf 1
[R6-ospf-1-area-0.0.0.2]nssa no-summary
[R11l0spf 1
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]nssa no-summary
IR12]ospf 1
[R12-ospf-1]a 2
R12-0spf-1-area-0.0.0.2]nssa no-sumnary
[R7]ospf 1
[R7-ospf-1]a 3
R7-0spf-1-area-0.0.0.3lnssa no-sumary
[R8]ospf 1
[R8-ospf-1][R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]nssa no-sumary
[R9]ospf 1
[R9-ospf-1][R8-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]nssa no-sumary
R9]ospf 2
[R9-ospf-2]default
[R9-ospf-2]default-route-advertise
[R9-ospf-2]quit
十、进入物理接口修改hello时间
[Rl]int g0/0/0
[R1-GigabitEthernet0/0/0lospf timer hel1o 5
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0lospf timer hel1o 5
十一、保障更新安全,进入隧道区二临建 区域认证
[R6lospf 1
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]ospf au
[R6-ospf-1-area-0.0.0.2]au
[R6-ospf-1-area-0.0.0.2]authentication-mode md5 1 ci
[R6-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher wdy12345
[R11]ospf 1
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher wdy12345
[R12]ospf 1
[R12-ospt-l]a 2
[R12-0spf-1-area-0.0.0.2lauthentication-mode md5 1 cipher wdy12345
[R12-0spf-1-area-0.0.0.2]quit