要求:
1.搭建toop
2.地址规划
R1 | G 0/0/0 192.168.1.1 24 G0/0/1 14.0.0.2 24 G0/0/2 41.0.0.2 24 tunn0/0/0 10.0.0.1 24源 g1 tunn 0/0/1 10.0.1.1 24 源 g2 |
R2 | G 0/0/0 192.168.2.1 24 G0/0/2 24.0.0.2 24 tunn0/0/0 10.0.0.2 24 源 g2 |
R3 | G 0/0/0 192.168.3.1 24 G0/0/2 34.0.0.2 24 tunn0/0/0 10.0.0.3 24 |
R4 | G2/0/0 14.0.0.1 24 源 g1 G 0/0/0 41.0.0.1 24 G0/0/1 24.0.0.1 24 G 0/0/2 34.0.0.1 24 G 2/0/1 54.0.0.1 24 G2/0/2 64.0.0.1 24 loop0 8.8.8.8 24 |
R5 | G0/0/2 54.0.0.2 24 G0/0/0 192.168.4.1 24 tunn 0/0/1 10.0.1.5 24源 g2 |
R6 | G0/0/2 64.0.0.2 24 G0/0/0 192.168.5.1 24 tunn 0/0/1 10.0.1.6 24源 g2 |
PC1 | 192.168.1.2 |
PC2 | 192.168.2.2 |
PC3 | 192.168.3.2 |
PC4 | 192.168.4.2 |
PC5 | 192.168.5.2 |
3.ip地址配置
R1
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[R1]interface GigabitEthernet 0/0/2
[R1-GigabitEthernet0/0/2]ip address 41.0.0.2 24
[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]ip address 14.0.0.2 24
R2
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 192.168.2.1 24
[R2]interface GigabitEthernet 0/0/2
[R2-GigabitEthernet0/0/2]ip address 24.0.0.2 24
R3
[R3]int GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ip address 192.168.3.1 24
[R3]int GigabitEthernet 0/0/2
[R3-GigabitEthernet0/0/2]ip address 34.0.0.2 24
R4
[R4]int GigabitEthernet 2/0/0
[R4-GigabitEthernet2/0/0]ip address 14.0.0.1 24
[R4]int GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0]ip address 41.0.0.1 24
[R4]int GigabitEthernet 0/0/1
[R4-GigabitEthernet0/0/1]ip address 24.0.0.1 24
[R4]int GigabitEthernet 0/0/2
[R4-GigabitEthernet0/0/2]ip add
[R4-GigabitEthernet0/0/2]ip address 34.0.0.1 24
[R4]int GigabitEthernet 2/0/2
[R4-GigabitEthernet2/0/2]ip address 64.0.0.1 24
[R4]interface GigabitEthernet 2/0/1
[R4-GigabitEthernet2/0/1]ip address 54.0.0.1 24
[R4]int LoopBack 0
[R4-LoopBack0]ip address 8.8.8.8 24
R5
[R5]int GigabitEthernet 0/0/0
[R5-GigabitEthernet0/0/0]ip address 192.168.4.1 24
[R5]int GigabitEthernet 0/0/2
[R5-GigabitEthernet0/0/2]ip address 54.0.0.2 24
R6
[R6]interface GigabitEthernet 0/0/0
[R6-GigabitEthernet0/0/0]ip address 192.168.5.1 24
[R6]int GigabitEthernet 0/0/2
[R6-GigabitEthernet0/0/2]ip address 64.0.0.2 24
PC
其他相同
4.nat及缺省
R1
[R1]acl 2000
[R1-acl-basic-2000]rule permit source any
[R1]int g 0/0/2
[R1-GigabitEthernet0/0/2]nat outbound 2000
[R1]int g 0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2000
[R1]ip route-static 0.0.0.0 0 14.0.0.1
[R1]ip route-static 0.0.0.0 0 41.0.0.1
R2
[R2]acl 2000
[R2-acl-basic-2000]rule permit source any
[R2]int g 0/0/2
[R2-GigabitEthernet0/0/2]nat outbound 2000
[R2]ip route-static 0.0.0.0 0 24.0.0.1
R3
[R3]acl 2000
[R3-acl-basic-2000]rule permit source any
[R3]int g 0/0/2
[R3-GigabitEthernet0/0/2]nat outbound 2000
[R3]ip route-static 0.0.0.0 0 34.0.0.1
R5
[R5]acl 2000
[R2-acl-basic-2000]rule permit source any
[R5]int g 0/0/2
[R5-GigabitEthernet0/0/2]nat outbound 2000
[R5]ip route-static 0.0.0.0 0 54.0.0.1
R6
[R6]acl 2000
[R6-acl-basic-2000]rule permit source any
[R6]int g 0/0/2
[R6-GigabitEthernet0/0/2]nat outbound 2000
[R6]ip route-static 0.0.0.0 0 64.0.0.1
5.mgre搭建
1.R1-2-3 构建一个星型,R1为中心
R1
[R1]interface Tunnel 0/0/0
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]ip address 10.0.0.1 24
[R1-Tunnel0/0/0]source 14.0.0.2
[R1-Tunnel0/0/0]nhrp network-id 10
R2
[R2]interface Tunnel 0/0/0
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp
[R2-Tunnel0/0/0]ip address 10.0.0.2 24
[R2-Tunnel0/0/0]source GigabitEthernet 0/0/2
[R2-Tunnel0/0/0]nhrp network-id 10
[R2-Tunnel0/0/0]nhrp entry 10.0.0.1 14.0.0.2 register
R3
[R3]interface Tunnel 0/0/0
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]ip address 10.0.0.3 24
[R3-Tunnel0/0/0]source GigabitEthernet 0/0/2
[R3-Tunnel0/0/0]nhrp network-id 10
[R3-Tunnel0/0/0]nhrp entry 10.0.0.1 14.0.0.2 register
R1-5-6构建另一个至连网状的NGRE网络,其中R1/5均为中心区域;
R1
[R1]interface Tunnel 0/0/1
[R1-Tunnel0/0/1]tunnel-protocol gre p2mp
[R1-Tunnel0/0/1]ip add 10.0.1.1 24
[R1-Tunnel0/0/1]source 41.0.0.2
[R1-Tunnel0/0/1]nhrp network-id 20
[R1-Tunnel0/0/1]nhrp entry 10.0.1.5 54.0.0.2 register
R5
[R5]interface Tunnel 0/0/1
[R5-Tunnel0/0/1]tunnel-protocol gre p2mp
[R5-Tunnel0/0/1]ip address 10.0.1.5 24
[R5-Tunnel0/0/1]source GigabitEthernet 0/0/2
[R5-Tunnel0/0/1]nhrp network-id 20
[R5-Tunnel0/0/1]nhrp entry 10.0.1.1 41.0.0.2 register
R6
[R6]interface Tunnel 0/0/1
[R6-Tunnel0/0/1]tunnel-protocol gre p2mp
[R6-Tunnel0/0/1]ip address 10.0.1.6 24
[R6-Tunnel0/0/1]source GigabitEthernet 0/0/2
[R6-Tunnel0/0/1]nhrp network-id 20
[R6-Tunnel0/0/1]nhrp entry 10.0.1.1 41.0.0.2 register
[R6-Tunnel0/0/1]nhrp entry 10.0.1.5 54.0.0.2 register
6.ospf搭建
R1
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 10.0.0.0 0.0.0.255
network 10.0.1.0 0.0.0.255
network 192.168.1.0 0.0.0.255
interface Tunnel0/0/0
ospf network-type broadcast
ospf dr-priority 2
nhrp entry multicast dynamic
interface Tunnel0/0/1
ospf network-type broadcast
nhrp entry multicast dynamic
R2
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 10.0.0.0 0.0.0.255
network 192.168.2.0 0.0.0.255
interface Tunnel0/0/0
ospf network-type broadcast
nhrp entry multicast dynamic
R3
interface Tunnel0/0/0
ospf network-type broadcast
nhrp entry multicast dynamic
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 10.0.0.0 0.0.0.255
network 192.168.3.0 0.0.0.255
R5
[R5]interface Tunnel 0/0/1
[R5-Tunnel0/0/1]nhrp entry multicast dynamic
[R5-Tunnel0/0/1]ospf network-type broadcast
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 10.0.1.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]
R6
[R6]interface Tunnel 0/0/1
[R6-Tunnel0/0/1]ospf network-type broadcast
[R6-Tunnel0/0/1]nhrp entry multicast dynamic
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 10.0.1.0 0.0.0.255
[R6-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
7.测试