题目
- 分配IP地址
[r1]dis ip interface brief
r2
r3
r4
r5
r6
r7
(1)搭建MGRE,前提是公网得通,使用缺省路由
[r1]ip route-static 0.0.0.0 0 17.1.1.2
[r2]ip route-static 0.0.0.0 0 27.1.1.2
[r3]ip route-static 0.0.0.0 0 37.1.1.2
r1,r2,r3之间能ping通
[r1]int Tunnel 0/0/0
[r1-Tunnel0/0/0]ip add 10.1.1.1 24
(2)搭建MGRE
[r1]int Tunnel 0/0/0
[r1-Tunnel0/0/0]ip add 10.1.1.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 17.1.1.1
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]nhrp entry 10.1.1.2 27.1.1.1 register
[r1-Tunnel0/0/0]nhrp entry 10.1.1.3 37.1.1.1 register
[r2]int Tunnel 0/0/0
[r2-Tunnel0/0/0]ip add 10.1.1.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]source 27.1.1.1
[r2-Tunnel0/0/0]nhrp entry multicast dynamic
[r2-Tunnel0/0/0]nhrp network-id 100
[r2-Tunnel0/0/0]nhrp entry 10.1.1.1 17.1.1.1 register
(防止配漏了。所以都配)
[r2-Tunnel0/0/0]nhrp entry 10.1.1.3 37.1.1.1 register
[r3]int Tunnel 0/0/0
[r3-Tunnel0/0/0]ip add 10.1.1.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source 37.1.1.1
[r3-Tunnel0/0/0]nhrp entry multicast dynamic
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp entry 10.1.1.1 17.1.1.1 register
[r3-Tunnel0/0/0]nhrp entry 10.1.1.2 27.1.1.1 register
测试
(3)私有网段
私有网段逻辑图
启动ospf服务
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 10.1.1.1 0.0.0.0
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.2.1 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 10.1.1.2 0.0.0.0
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 10.1.1.3 0.0.0.0
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]network 192.168.3.1 0.0.0.0
[r3-ospf-1-area-0.0.0.1]network 192.168.0.1 0.0.0.0
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 1
[r4-ospf-1-area-0.0.0.1]network 192.168.0.0 0.0.0.255
[r4-ospf-1-area-0.0.0.1]network 192.168.4.1 0.0.0.0
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 1
[r5-ospf-1-area-0.0.0.1]network 192.168.0.6 0.0.0.0
[r5-ospf-1-area-0.0.0.1]network 192.168.5.1 0.0.0.0
[r5-ospf-1]area 2
[r5-ospf-1-area-0.0.0.2]network 192.168.0.9 0.0.0.0
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 2
[r6-ospf-1-area-0.0.0.2]network 192.168.0.0 0.0.255.255
[r1-Tunnel0/0/0]ospf network-type broadcast
[r2-Tunnel0/0/0]ospf network-type broadcast
[r3-Tunnel0/0/0]ospf network-type broadcast
r5重发布
[r5]ospf 1
[r5-ospf-1]area 2
[r5-ospf-1-area-0.0.0.2]undo network 192.168.0.9 0.0.0.0
[r5]ospf 2(重启一个新的进程)
[r5-ospf-2]area 2
[r5-ospf-2-area-0.0.0.2]network 192.168.0.9 0.0.0.0
(r5,r6重新建立邻居关系)
[r5]ospf 1
[r5-ospf-1]import-route ospf 2
[r5]ospf 2
[r5-ospf-2]import-route ospf 1
此时私网通了
r4,r5.r6访问不了r7的环回
1)r4,r5,r6没有缺省路由
2)r4,r5,r6私有IP,需要nat
[r3]ospf 1(r3的静态缺省发布)
[r3-ospf-1]default-route-advertise
[r5]ospf 2
[r5-ospf-2]default-route-advertise
[r3]acl 2000
[r3-acl-basic-2000]rule permit source 192.168.0.0 0.0.255.255
[r3-acl-basic-2000]q
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]nat outbound 2000
[r3-GigabitEthernet0/0/0]q
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]nat server protocol tcp global current-interface 23 inside 192.168.6.1 23
[r6]aaa
[r6-aaa]local-user xixi privilege level 15 password cipher 123456
Info: Add a new user.
[r6-aaa]local-user xixi service-type telnet
[r6-aaa]q
[r6]user-interface vty 0 4
[r6-ui-vty0-4]authentication-mode aaa
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]nat server protocol tcp global current-interface 23 inside 192.168.6.1 23
Warning:The port 23 is well-known port. If you continue it may cause function failure.
Are you sure to continue?[Y/N]:y