lsw2改成路由器 1.使用三种解决ospf不规则区域的方法2.5678加上换的路由器使用mgre3.使用各种优化4.全网可达5.保证更新安全 6.使用地址为172.16.0.0/16合理划分
R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[R1]int LoopBack 0
[R1-LoopBack0]ip add 1.1.1.1 32
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.1.2 24
[R2]int LoopBack 0
[R2-LoopBack0]ip add 2.2.2.2 32
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
R3
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.1.3 24.
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 34.1.1.1 24
[R3]int LoopBack 0
[R3-LoopBack0]ip add 3.3.3.3 32
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 192.168.1.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R3]ip route-static 0.0.0.0 0 34.1.1.2 //书写一条缺省路由指向ISP
[R3]ospf 1
[R3-ospf-1]default-route-advertise //下放缺省,保证内网其他路由器有缺省
[R3]acl 2000
[R3-acl-basic-2000]rule permit source any
[R3-acl-basic-2000]int g0/0/1
[R3-GigabitEthernet0/0/1]nat outbound 2000
R4
[ISP]int g0/0/0
[ISP-GigabitEthernet0/0/0]ip add 34.1.1.2 24
[ISP-GigabitEthernet0/0/0]int g0/0/1
[ISP-GigabitEthernet0/0/1]ip add 45.1.1.1 24
[ISP]int LoopBack 0
[ISP-LoopBack0]ip add 4.4.4.4 32
R5
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 45.1.1.2 24
[R5-GigabitEthernet0/0/0]int g0/0/1
[R5-GigabitEthernet0/0/1]ip add 172.16.0.1 21
[R5]int LoopBack 0
[R5-LoopBack0]ip add 5.5.5.5 32
[R5]ospf 2 router-id 5.5.5.5
[R5-ospf-2]area 0
[R5-ospf-2-area-0.0.0.0]network 172.16.0.1 0.0.0.0
[R5-ospf-2-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[R5]interface Tunnel 0/0/0
[R5-Tunnel0/0/0]tunnel-protocol gre
[R5-Tunnel0/0/0]source 45.1.1.2
[R5-Tunnel0/0/0]destination 34.1.1.1
[R5-Tunnel0/0/0]ip add 11.1.1.2 24
[R5]interface Tunnel 0/0/1
[R5-Tunnel0/0/1]tunnel-protocol gre p2mp
[R5-Tunnel0/0/1]source 172.16.0.1
[R5-Tunnel0/0/1]nhrp entry multicast dynamic
[R5-Tunnel0/0/1]nhrp network-id 100
[R5-Tunnel0/0/1]ip add 10.1.1.1 24
[R5-Tunnel0/0/1]quit
[R5]ip route-static 172.16.8.0 21 172.16.0.2
[R5]ip route-static 172.16.16.0 21 172.16.0.2
[R5]ip route-static 172.16.24.0 21 172.16.0.2
[R5]interface Tunnel 0/0/0
[R5-Tunnel0/0/0]ospf network-type broadcast
[R5-Tunnel0/0/0]interface Tunnel 0/0/1
[R5-Tunnel0/0/1]ospf network-type broadcast
[R5]ip route-static 0.0.0.0 0 45.1.1.1 //访问外网
[R5-ospf-2]default-route-advertise
[R5]acl 2000
[R5-acl-basic-2000]rule permit source any
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]nat outbound 2000
R6
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ip add 172.16.8.1 21
[R6-GigabitEthernet0/0/0]int g0/0/1
[R6-GigabitEthernet0/0/1]ip add 172.16.64.1 21
[R6]int LoopBack 0
[R6-LoopBack0]ip add 6.6.6.6 32
[R6]interface Tunnel 0/0/1
[R6-Tunnel0/0/1]tunnel-protocol gre p2mp
[R6-Tunnel0/0/1]source g0/0/0
[R6-Tunnel0/0/1]nhrp entry 10.1.1.1 172.16.0.1 register
[R6-Tunnel0/0/1]nhrp network-id 100
[R6-Tunnel0/0/1]ip add 10.1.1.2 24
[R6-Tunnel0/0/1]
[R6-Tunnel0/0/1]quit
[R6]ip route-static 172.16.0.0 21 172.16.8.2
[R6]ip route-static 172.16.16.0 21 172.16.8.2
[R6]ip route-static 172.16.24.0 21 172.16.8.2
R6]ospf 2
[R6-ospf-2]area 0
[R6-ospf-2-area-0.0.0.0]network 10.1.1.2 0.0.0.0
[R6-ospf-2-area-0.0.0.0]quit
[R6]interface Tunnel 0/0/1
[R6-Tunnel0/0/1]ospf network-type broadcast
R7
[R7-GigabitEthernet0/0/1]int g0/0/0
[R7-GigabitEthernet0/0/0]ip add 172.16.16.1 21
[R7-GigabitEthernet0/0/0]int g0/0/1
[R7-GigabitEthernet0/0/1]ip add 172.16.128.1 21
[R7]int LoopBack 0
[R7-LoopBack0]ip add 7.7.7.7 32
[R7]ospf 2 router-id 7.7.7.7
[R7-ospf-2]area 0
[R7-ospf-2-area-0.0.0.0]network 172.16.16.1 0.0.0.0
[R7-ospf-2-area-0.0.0.0]network 7.7.7.7 0.0.0.0
[R7-ospf-2-area-0.0.0.0]area 4
[R7-ospf-2-area-0.0.0.4]network 172.16.128.1 0.0.0.0
[R7]ospf 2
[R7-ospf-2]area 4
[R7-ospf-2-area-0.0.0.4]vlink-peer 13.13.13.13
[R7]interface Tunnel 0/0/1
[R7-Tunnel0/0/1]tunnel-protocol gre p2
[R7-Tunnel0/0/1]tunnel-protocol gre p2mp
[R7-Tunnel0/0/1]source g0/0/0
[R7-Tunnel0/0/1]nhrp network-id 100
[R7-Tunnel0/0/1]nhrp entry 10.1.1.1 172.16.0.1 register
[R7-Tunnel0/0/1]ip add 10.1.1.3 24
[R7-Tunnel0/0/1]quit
[R7]ip route-static 172.16.0.0 21 172.16.16.2
[R7]ip route-static 172.16.8.0 21 172.16.16.2
[R7]ip route-static 172.16.24.0 21 172.16.16.2
[R7]ospf 2
[R7-ospf-2]area 0
[R7-ospf-2-area-0.0.0.0]network 10.1.1.3 0.0.0.0
[R7-ospf-2-area-0.0.0.0]qui
[R7-ospf-2]qui
[R7]interface Tunnel 0/0/1
[R7-Tunnel0/0/1]ospf network-type broadcast
R8
[R8]int g0/0/0
[R8-GigabitEthernet0/0/0]ip add 172.16.24.1 21
[R8-GigabitEthernet0/0/0]int g0/0/1
[R8-GigabitEthernet0/0/1]ip add 172.16.32.1 21
[R8]int LoopBack 0
[R8-LoopBack0]ip add 8.8.8.8 32
[R8]ospf 2 router-id 8.8.8.8
[R8-ospf-2]area 0
[R8-ospf-2-area-0.0.0.0]network 172.16.24.1 0.0.0.0
[R8-ospf-2-area-0.0.0.0]network 8.8.8.8 0.0.0.0
[R8-ospf-2-area-0.0.0.0]area 1
[R8-ospf-2-area-0.0.0.1]network 172.16.32.1 0.0.0.0
[R8]interface Tunnel 0/0/1
[R8-Tunnel0/0/1]tunnel-protocol gre p2mp
[R8-Tunnel0/0/1]source g0/0/0
[R8-Tunnel0/0/1]nhrp network-id 100
[R8-Tunnel0/0/1]nhrp entry 10.1.1.1 172.16.0.1 register
[R8-Tunnel0/0/1]ip add 10.1.1.4 24
[R8-Tunnel0/0/1]quit
[R8]ip route-static 172.16.0.0 21 172.16.24.2
[R8]ip route-static 172.16.8.0 21 172.16.24.2
[R8]ip route-static 172.16.16.0 21 172.16.24.2
[R8]ospf 2
[R8-ospf-2]area 0
[R8-ospf-2-area-0.0.0.0]network 10.1.1.4 0.0.0.0
[R8-ospf-2-area-0.0.0.0]qui
[R8-ospf-2]qui
[R8]interface Tunnel 0/0/1
[R8-Tunnel0/0/1]ospf network-type broadcast
R9
[R9]int g0/0/0
[R9-GigabitEthernet0/0/0]ip add 172.16.32.2 21
[R9-GigabitEthernet0/0/0]int g0/0/1
[R9-GigabitEthernet0/0/1]ip add 172.16.40.1 21
[R9]int LoopBack 0
[R9-LoopBack0]ip add 9.9.9.9 32
[R9]ospf 2 router-id 9.9.9.9
[R9-ospf-2]area 1
[R9-ospf-2-area-0.0.0.1]network 0.0.0.0 255.255.255.255
[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ip add 172.16.40.2 21
[R10]int LoopBack 0
[R10-LoopBack0]ip add 10.10.10.10 32
R10
[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ip add 172.16.40.2 21
[R10]int LoopBack 0
[R10-LoopBack0]ip add 10.10.10.10 32
[R10]ospf 2 router-id 10.10.10.10
[R10-ospf-2]area 1
[R10-ospf-2-area-0.0.0.1]network 0.0.0.0 255.255.255.255
R11
[R11]int g0/0/0
[R11-GigabitEthernet0/0/0]ip add 172.16.64.2 21
[R11-GigabitEthernet0/0/0]int g0/0/1
[R11-GigabitEthernet0/0/1]ip add 172.16.72.1 21
[R11]int LoopBack 0
[R11-LoopBack0]ip add 11.11.11.11 32
[R11]ospf 2 router-id 11.11.11.11
[R11-ospf-2]area 2
[R11-ospf-2-area-0.0.0.2]network 0.0.0.0 255.255.255.255
R12
[R12]int g0/0/0
[R12-GigabitEthernet0/0/0]ip add 172.16.72.2 21
[R12]int LoopBack 0
[R12-LoopBack0]ip add 172.16.96.1 21
[R12]int LoopBack 1
[R12-LoopBack1]ip add 172.16.104.1 21R12]ospf 2 router-id 12.12.12.12
[R12-ospf-2]area 2
[R12-ospf-2-area-0.0.0.2]network 172.16.72.2 0.0.0.0
[R12]ospf 1 router-id 12.12.12.13
[R12-ospf-1]area 3
[R12-ospf-1-area-0.0.0.3]network 172.16.96.1 0.0.0.0
[R12-ospf-1-area-0.0.0.3]network 172.16.104.1 0.0.0.0[R12]ospf 2
[R12-ospf-2]import-route ospf 1
[R12]ospf 1
[R12-ospf-1]import-route ospf 2
R13
[R13]int g0/0/0
[R13-GigabitEthernet0/0/0]ip add 172.16.128.2 21
[R13-GigabitEthernet0/0/0]int g0/0/1
[R13-GigabitEthernet0/0/1]ip add 172.16.160.1 21
[R13]int LoopBack 0
[R13-LoopBack0]ip add 13.13.13.13 32
[R13]ospf 2 router-id 13.13.13.13
[R13-ospf-2]area 4
[R13-ospf-2-area-0.0.0.4]network 172.16.128.2 0.0.0.0
[R13-ospf-2-area-0.0.0.4]network 13.13.13.13 0.0.0.0
[R13-ospf-2-area-0.0.0.4]area 5
[R13-ospf-2-area-0.0.0.5]network 172.16.160.1 0.0.0.0
[R13]ospf 2
[R13-ospf-2]area 4
[R13-ospf-2-area-0.0.0.4]vlink-peer 7.7.7.7
R14
[R14]int g0/0/0
[R14-GigabitEthernet0/0/0]ip add 172.16.160.2 21
[R14]int LoopBack 0
[R14-LoopBack0]ip add 172.16.168.1 21
[R14]ospf 2 router-id 14.14.14.14
[R14-ospf-2]area 5
[R14-ospf-2-area-0.0.0.5]network 0.0.0.0 255.255.255.255
[R14]ospf 1
[R14-ospf-1]import-route ospf 2
[R14]ospf 2
[R14-ospf-2]import-route ospf 1
R15
[R15]int g0/0/0
[R15-GigabitEthernet0/0/0]ip add 172.16.0.2 21
[R15-GigabitEthernet0/0/0]int g0/0/1
[R15-GigabitEthernet0/0/1]ip add 172.16.8.2 21
[R15-GigabitEthernet0/0/1]int g0/0/2
[R15-GigabitEthernet0/0/2]ip add 172.16.16.2 21
[R15-GigabitEthernet0/0/2]int e4/0/0
[R15-Ethernet4/0/0]ip add 172.16.24.2 21