OSPF综合实验-三、实验过程

时间:2024-04-17 07:00:07
配置IP地址

[R1]int g0/0/0

[R1-GigabitEthernet0/0/0]ip add 172.16.33.1 24

[R1-GigabitEthernet0/0/0]int lo0

[R1-LoopBack0]ip add 172.16.34.1 24

[R1-LoopBack0]

[R2]int g0/0/0

[R2-GigabitEthernet0/0/0]ip add 172.16.33.2 24

[R2-GigabitEthernet0/0/0]int lo0

[R2-LoopBack0]ip add 172.16.35.2 24

[R2-LoopBack0]

[R3]int g0/0/0

[R3-GigabitEthernet0/0/0]ip add 172.16.33.3 24

[R3-GigabitEthernet0/0/0]int lo0

[R3-LoopBack0]ip add 172.16.36.3 24

[R3-LoopBack0]int se4/0/0

[R3-Serial4/0/0]ip add 34.0.0.3 24

[R3-Serial4/0/0]

[R4]int se4/0/0

[R4-Serial4/0/0]ip add 34.0.0.4 24

[R4-Serial4/0/0]int se4/0/1

[R4-Serial4/0/1]ip add 45.0.0.4 24

[R4-Serial4/0/1]int se3/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-GigabitEthernet0/0/0]int lo0

[R4-LoopBack0]ip add 172.16.2.4 24

[R4-LoopBack0]

[R5]int ser4/0/0

[R5-Serial4/0/0]ip add 45.0.0.5 24

[R5-Serial4/0/0]int lo0

[R5-LoopBack0]

[R5-LoopBack0]ip add 172.16.3.5 24

[R5-LoopBack0]

[R6]int se4/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]int lo0

[R6-LoopBack0]ip add 172.16.4.6 24

[R6-LoopBack0]int g0/0/0

[R6-GigabitEthernet0/0/0]ip add 172.16.65.1 30

[R7]int g0/0/0

[R7-GigabitEthernet0/0/0]ip add 47.0.0.7 24

[R7-GigabitEthernet0/0/0]int lo0

[R7-LoopBack0]ip add 172.16.5.7 24

[R7-LoopBack0]int g0/0/1

[R7-GigabitEthernet0/0/1]ip add 172.16.97.1 30

[R8]int g0/0/0

[R8-GigabitEthernet0/0/0]ip add 172.16.97.2 30

[R8-GigabitEthernet0/0/0]int g0/0/1

[R8-GigabitEthernet0/0/1]ip add 172.16.97.5 30

[R8-GigabitEthernet0/0/1]int lo0

[R8-LoopBack0]ip add 172.16.98.8 24

[R8-LoopBack0]

[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 lo0

[R9-LoopBack0]ip add 172.16.130.9 24

[R9-LoopBack0]

[R10]int g0/0/0

[R10-GigabitEthernet0/0/0]ip add 172.16.129.2 30

[R10-GigabitEthernet0/0/0]int lo0

[R10-LoopBack0]ip add 172.16.131.10 24

[R10-LoopBack0]

[R11]int g0/0/0

[R11-GigabitEthernet0/0/0]ip add 172.16.65.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 lo0

[R11-LoopBack0]ip add 172.16.66.11 24

[R11-LoopBack0]

[R12]int g0/0/0

[R12-GigabitEthernet0/0/0]ip add 172.16.65.6 30

[R12-GigabitEthernet0/0/0]int lo0

[R12-LoopBack0]ip add 172.16.160.12 24

[R12-LoopBack0]int lo1

[R12-LoopBack1]ip add 172.16.161.12 24

[R12-LoopBack1]

配公网通

[R3]ip rou 0.0.0.0 0 34.0.0.4

[R3]

[R5]ip rou 0.0.0.0 0 45.0.0.4

[R5]

[R6]ip rou 0.0.0.0 0 46.0.0.4

[R6]

[R7]ip rou 0.0.0.0 0 47.0.0.4

[R7]

配私网通

使各个区域内相通

[R1]ospf 1 rou 1.1.1.1

[R1-ospf-1]area 1

[R1-ospf-1-area-0.0.0.1]net 172.16.0.0 0.0.255.255

[R1-ospf-1-area-0.0.0.1]

[R2]ospf 1 rou 2.2.2.2

[R2-ospf-1]a 1

[R2-ospf-1-area-0.0.0.1]net 172.16.0.0 0.0.255.255

[R2-ospf-1-area-0.0.0.1]

[R3]os 1 rou 3.3.3.3

[R3-ospf-1]a 1

[R3-ospf-1-area-0.0.0.1]net 172.16.33.0 0.0.0.255

[R3-ospf-1-area-0.0.0.1]net 172.16.36.0 0.0.0.255

[R3-ospf-1-area-0.0.0.1]

[R5]o 1 rou 5.5.5.5

[R5-ospf-1-area-0.0.0.1]a 0

[R5-ospf-1-area-0.0.0.0]net 172.16.3.0 0.0.0.255

[R5-ospf-1-area-0.0.0.0]

[R6]o 1 rou 6.6.6.6

[R6-ospf-1]a 0

[R6-ospf-1-area-0.0.0.0]net 172.16.4.0 0.0.0.255

[R6-ospf-1-area-0.0.0.0]a 2

[R6-ospf-1-area-0.0.0.2]net 172.16.65.1 0.0.0.0

[R6-ospf-1-area-0.0.0.2]

[R7]o 1 rou 7.7.7.7

[R7-ospf-1]a 0

[R7-ospf-1-area-0.0.0.0]net 172.16.5.0 0.0.0.255

[R7-ospf-1-area-0.0.0.0]

[R7]ospf 1

[R7-ospf-1]a 3

[R7-ospf-1-area-0.0.0.3]net 172.16.97.1 0.0.0.0

[R8]os 1 rou 8.8.8.8

[R8-ospf-1]a 3

[R8-ospf-1-area-0.0.0.3]net 172.16.97.2 0.0.0.0

[R8-ospf-1-area-0.0.0.3]net 172.16.97.5 0.0.0.0

[R8-ospf-1-area-0.0.0.3]net 172.16.98.0 0.0.0.255

[R9]osp 1 rou 9.9.9.9

[R9-ospf-1]a 3

[R9-ospf-1-area-0.0.0.3]net 172.16.97.6 0.0.0.0

[R9]ospf 2

[R9-ospf-2]ospf 2 rou 9.9.9.9

[R9-ospf-2]a 4

[R9-ospf-2-area-0.0.0.4]net 172.16.129.1 0.0.0.0

[R9-ospf-2-area-0.0.0.4]net 172.16.130.0 0.0.0.255

[R9-ospf-2-area-0.0.0.4]

[R10]ospf 2 rou 10.10.10.10

[R10-ospf-2]a 4

[R10-ospf-2-area-0.0.0.4]net 172.16.129.2 0.0.0.0

[R10-ospf-2-area-0.0.0.4]net 172.16.131.0 0.0.0.255

[R11]ospf 1 rou 11.11.11.11

[R11-ospf-1]a 2

[R11-ospf-1-area-0.0.0.2]net 172.16.65.2 0.0.0.0

[R11-ospf-1-area-0.0.0.2]net 172.16.65.5 0.0.0.0

[R11-ospf-1-area-0.0.0.2]net 172.16.66.11 0.0.0.0

[R11-ospf-1-area-0.0.0.2]

[R12]o 1 rou 12.12.12.12

[R12-ospf-1]a 2

[R12-ospf-1-area-0.0.0.2]net 172.16.65.6 0.0.0.0

[R12-ospf-1-area-0.0.0.2]

[R12]rip 1

[R12-rip-1]v 2

[R12-rip-1]undo sum

[R12-rip-1]net 172.16.0.0

[R12-rip-1]q

[R12]ospf 1

[R12-ospf-1]im rip--------路由引入

[R12-ospf-1]

R3-R5、R6、R7为MGRE环境,R3为中心站点(使每个区域互通)

[R3]int tun 0/0/0

[R3-Tunnel0/0/0]ip add 172.16.6.3 24

[R3-Tunnel0/0/0]tu gre p2mp

[R3-Tunnel0/0/0]sou s4/0/0

[R3-Tunnel0/0/0]nhrp net 100

[R3-Tunnel0/0/0]nhrp en mu dy

[R3-Tunnel0/0/0]

[R5]int tun 0/0/0

[R5-Tunnel0/0/0]ip add 172.16.6.5 24

[R5-Tunnel0/0/0]tun gre p2mp

[R5-Tunnel0/0/0]sou se4/0/0

[R5-Tunnel0/0/0]nhrp net 100

[R5-Tunnel0/0/0]nh en 172.16.6.3 34.0.0.3 re

[R5-Tunnel0/0/0]

[R6]int tu0/0/0

[R6-Tunnel0/0/0]ip add 172.16.6.6 24

[R6-Tunnel0/0/0]tun gre p2mp

[R6-Tunnel0/0/0]sou s4/0/0

[R6-Tunnel0/0/0]nh net 100

[R6-Tunnel0/0/0]nh en 172.16.6.3 34.0.0.3 re

[R6-Tunnel0/0/0]

[R7]int tu0/0/0

[R7-Tunnel0/0/0]ip add 172.16.6.7 24

[R7-Tunnel0/0/0]tun gre p2mp

[R7-Tunnel0/0/0]sou g0/0/0

[R7-Tunnel0/0/0]nh net 100

[R7-Tunnel0/0/0]nh en 172.16.6.3 34.0.0.3 re

[R7-Tunnel0/0/0]

启动ospf协议

[R3]ospf 1

[R3-ospf-1]a 0

[R3-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255

[R3-ospf-1-area-0.0.0.0]

[R5]ospf 1

[R5-ospf-1]a 0

[R5-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255

[R5-ospf-1-area-0.0.0.0]

[R6]ospf 1

[R6-ospf-1]a 0

[R6-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255

[R6-ospf-1-area-0.0.0.0]

[R7]ospf 1

[R7-ospf-1]a 0

[R7-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255

[R7-ospf-1-area-0.0.0.0]

解决建邻问题

[R3]int t0/0/0

[R3-Tunnel0/0/0]ospf network-type  broadcast

[R5]int t0/0/0

[R5-Tunnel0/0/0]ospf network-type  broadcast

[R6]int t0/0/0

[R6-Tunnel0/0/0]ospf network-type  broadcast

[R7]int t0/0/0

[R7-Tunnel0/0/0]ospf network-type  broadcast

[R5]int t0/0/0]

[R5-Tunnel0/0/0]ospf dr-priority 0

[R5-Tunnel0/0/0]

[R6]int t0/0/0

[R6-Tunnel0/0/0]ospf dr-p 0

[R6-Tunnel0/0/0]

[R7]int t0/0/0

[R7-Tunnel0/0/0]ospf dr-p 0

[R9]ospf 1

[R9-ospf-1]im

[R9-ospf-1]import-route ospf 2

[R9-ospf-1]ospf 2

[R9-ospf-2]import-route ospf 1

[R9-ospf-2]

所有设备均可访问R4的环回:

做easy IP

[R3]acl 2000

[R3-acl-basic-2000]rule per sou 172.16.0.0 0.0.255.255

[R3-acl-basic-2000]int s4/0/0

[R3-Serial4/0/0]nat out 2000

[R3-Serial4/0/0]

[R5]acl 2000

[R5-acl-basic-2000]rule per sou 172.16.0.0 0.0.255.255

[R5-acl-basic-2000]int s4/0/0

[R5-Serial4/0/0]nat out 2000

[R5-Serial4/0/0]

[R6]acl 2000

[R6-acl-basic-2000]rule per sou 172.16.0.0 0.0.255.255

[R6-acl-basic-2000]int s4/0/0

[R6-Serial4/0/0]nat out 2000

[R6-Serial4/0/0]

[R7]acl 2000

[R7-acl-basic-2000]rule per sou 172.16.0.0 0.0.255.255

[R7-acl-basic-2000]int g0/0/0

[R7-GigabitEthernet0/0/0]nat out 2000

[R7-GigabitEthernet0/0/0]

[R9]ospf 2

[R9-ospf-2]default-route-advertise

[R9-ospf-2]

减少LSA的更新量

[R3]ospf 1

[R3-ospf-1]a 1

[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0

[R3-ospf-1-area-0.0.0.1]stub no-summary

[R2]ospf 1

[R2-ospf-1]a 1

[R2-ospf-1-area-0.0.0.1]stu no

[R1]ospf 1

[R1-ospf-1]a 1

[R1-ospf-1-area-0.0.0.1]stu no

[R6]ospf 1

[R6-ospf-1] a 2

[R6-ospf-1-area-0.0.0.2]nssa no-summary

[R7]ospf 1

[R7-ospf-1]a 3

[R7-ospf-1-area-0.0.0.3]ab

[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.255.0

[R7-ospf-1-area-0.0.0.3]nssa no-s

[R8]ospf 1

[R8-ospf-1]a 3

[R8-ospf-1-area-0.0.0.3]nssa no-s

[R9]ospf 1

[R9-ospf-1]a 3

[R9-ospf-1-area-0.0.0.3]nssa no-s

[R11]ospf 1

[R11-ospf-1]a 2

[R11-ospf-1-area-0.0.0.2]nssa no-s

[R12]ospf 1

[R12-ospf-1]a 2

[R12-ospf-1-area-0.0.0.2]nssa no-s

加快收敛

[R1]int g0/0/0

[R1-GigabitEthernet0/0/0]ospf timer hello 5

[R1-GigabitEthernet0/0/0]

[R2]int g0/0/0

[R2-GigabitEthernet0/0/0]ospf timer hello 5

[R2-GigabitEthernet0/0/0]

[R3]int g0/0/0

[R3-GigabitEthernet0/0/0]ospf timer hello 5

[R3-GigabitEthernet0/0/0]

[R3]int t0/0/0

[R3-Tunnel0/0/0]ospf timer hello 5

[R3-Tunnel0/0/0]

[R4]int s4/0/0

[R4-Serial4/0/0]ospf timer hello 5

[R4-Serial4/0/0]int s4/0/1

[R4-Serial4/0/1]ospf timer hello 5

[R4-Serial4/0/1]int s3/0/0

[R4-Serial3/0/0]ospf timer hello 5

[R4-Serial3/0/0]int g0/0/0

[R4-GigabitEthernet0/0/0]ospf timer hello 5

[R4-GigabitEthernet0/0/0]

[R5]int s4/0/0

[R5-Serial4/0/0]ospf timer hello 5

[R5-Serial4/0/0]

[R5]int t0/0/0

[R5-Tunnel0/0/0]ospf timer hello 5

[R5-Tunnel0/0/0]

[R6]int s4/0/0

[R6-Serial4/0/0]ospf timer hello 5

[R6-Serial4/0/0]int g0/0/0

[R6-GigabitEthernet0/0/0]ospf timer hello 5

[R6-GigabitEthernet0/0/0]

[R6]int t0/0/0

[R6-Tunnel0/0/0]ospf timer hello 5

[R6-Tunnel0/0/0]

[R7]int g0/0/0

[R7-GigabitEthernet0/0/0]ospf timer hello 5

[R7-GigabitEthernet0/0/0]int g0/0/1

[R7-GigabitEthernet0/0/1]ospf timer hello 5

[R7-GigabitEthernet0/0/1]

[R7]int t0/0/0

[R7-Tunnel0/0/0]ospf timer hello 5

[R7-Tunnel0/0/0]

[R8]int g0/0/0

[R8-GigabitEthernet0/0/0]ospf timer hello 5

[R8-GigabitEthernet0/0/0]int g0/0/1

[R8-GigabitEthernet0/0/1]ospf timer hello 5

[R8-GigabitEthernet0/0/1]

[R9]int g0/0/0

[R9-GigabitEthernet0/0/0]ospf timer hello 5

[R9-GigabitEthernet0/0/0]int g0/0/1

[R9-GigabitEthernet0/0/1]ospf timer hello 5

[R9-GigabitEthernet0/0/1]

[R10]int g0/0/0

[R10-GigabitEthernet0/0/0]ospf timer hello 5

[R10-GigabitEthernet0/0/0]

[R11]int g0/0/0

[R11-GigabitEthernet0/0/0]ospf timer hello 5

[R11]int g0/0/0

[R11-GigabitEthernet0/0/0]ospf timer hello 5

[R11-GigabitEthernet0/0/1]ospf timer hello 5

[R11-GigabitEthernet0/0/1]

[R12]int g0/0/0

[R12-GigabitEthernet0/0/0]ospf timer hello 5

[R12-GigabitEthernet0/0/0]

保障更新安全

[R1]ospf 1

[R1-ospf-1]a 1

[R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 1234

[R1-ospf-1-area-0.0.0.1]

[R2]ospf 1

[R2-ospf-1]a 1

[R2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 1234

[R2-ospf-1-area-0.0.0.1]

[R3]ospf 1

[R3-ospf-1]a 1

[R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 1234

[R3-ospf-1-area-0.0.0.1]a 0

[R3-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 1234

[R3-ospf-1-area-0.0.0.0]

[R4]ospf 1

[R4-ospf-1]a 0

[R4-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 1234

[R4-ospf-1-area-0.0.0.0]

[R5]ospf 1

[R5-ospf-1]a 0

[R5-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 1234

[R5-ospf-1-area-0.0.0.0]

[R6]ospf 1

[R6-ospf-1]a 0

[R6-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 1234

[R6-ospf-1-area-0.0.0.0]a 2

[R6-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 1234

[R6-ospf-1-area-0.0.0.2]

[R7]ospf 1

[R7-ospf-1]a 0

[R7-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 1234

[R7-ospf-1-area-0.0.0.0]a 3

[R7-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 1234

[R7-ospf-1-area-0.0.0.3]

[R8]ospf 1

[R8-ospf-1]a 3

[R8-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 1234

[R8-ospf-1-area-0.0.0.3]

[R9]ospf 1

[R9-ospf-1]a 3

[R9-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 1234

[R9-ospf-1-area-0.0.0.3]ospf 2

[R9-ospf-2]a 4

[R9-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher 1234

[R9-ospf-2-area-0.0.0.4]

[R10]ospf 2

[R10-ospf-2]a 4

[R10-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher 1234

[R10-ospf-2-area-0.0.0.4]

[R11]ospf 1

[R11-ospf-1]a 2

[R11-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 1234

[R11-ospf-1-area-0.0.0.2]

[R12]ospf 1

[R12-ospf-1]a 2

[R12-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 1234

[R12-ospf-1-area-0.0.0.2]