一,配置ip
r1
r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[r1]interface Serial 3/0/0
[r1-Serial3/0/0]ip address 15.1.1.1 24
r2
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.2.1 24
[r2]interface Serial 3/0/0
[r2-Serial3/0/0]ip address 25.1.1.1 24
r3
[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.3.1 24
[r3]interface Serial 3/0/0
[r3-Serial3/0/0]ip address 35.1.1.1 24
r4
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.4.1 24
[r4]interface g0/0/1
[r4-GigabitEthernet0/0/1]ip address 45.1.1.1 24
r5
[r5]interface Serial 3/0/1
[r5-Serial3/0/1]ip address 15.1.1.2 24
[r5]interface Serial 3/0/0
[r5-Serial3/0/0]ip address 25.1.1.2 24
[r5-Serial3/0/1]int s 2/0/0
[r5-Serial2/0/0]ip address 35.1.1.2 24
[r5]interface g0/0/0
[r5-GigabitEthernet0/0/0]ip address 45.1.1.2 24
[r5]interface LoopBack 0
[r5-LoopBack0]ip address 5.5.5.5 24
二,认证
1,r1与r5之间
r5
[r5]aa
[r5-aaa]local-user xx password cipher yy
[r5-aaa]local-user xx service-type ppp
[r5-aaa]int s3/0/1
[r5-Serial3/0/1]link-protocol ppp
[r5-Serial3/0/1]ppp authentication-mode pap
r1
[r1]in s3/0/0
[r1-Serial3/0/0]ppp pap local-user xx password cipher yy
[r1]aaa
[r1-aaa]local-user xx password cipher yy
[r1-aaa]in s3/0/0
[r1-Serial3/0/0]ppp authentication-mode pap
r5
[r5]interface Serial 3/0/1
[r5-Serial3/0/1]ppp pap local-user xx password cipher yy
2,r2与r5之间
r2
[r2]interface Serial 3/0/0
[r2-Serial3/0/0]ppp chap password cipher yy
r5
[r5]interface Serial 3/0/0
[r5-Serial3/0/0]ppp chap password cipher yy
3,对r3和r5
r3
[r3-Serial3/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
三,MGRE
r1
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip address 10.1.1.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]nhrp network-id 200
r2
[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ip address 10.1.1.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]nhrp network-id 200
[r2-Tunnel0/0/0]nhrp entry 15.1.1.1 10.1.1.1 register
r3
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ip address 10.1.1.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]nhrp network-id 200
[r3-Tunnel0/0/0]nhrp entry 15.1.1.1 10.1.1.1 register
gre
r1
[r1]interface Tunnel 0/0/1
[r1-Tunnel0/0/1]ip address 20.1.1.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre
[r1-Tunnel0/0/1]source 15.1.1.1
[r1-Tunnel0/0/1]destination 45.1.1.2
r4
[r4]interface t 0/0/1
[r4-Tunnel0/0/1]ip address 20.1.1.2 24
[r4-Tunnel0/0/1]tunnel-protocol gre
[r4-Tunnel0/0/1]source 45.1.1.1
[r4-Tunnel0/0/1]description 15.1.1.2
四rip
r1
[r1]rip
[r1-rip-1]version 2
[r1-rip-1]undo summary
[r1-rip-1]network 10.0.0.0
[r1-rip-1]network 15.0.0.0
[r1-rip-1]network 192.168.1.0
r2
[r2]rip
[r2-rip-1]version 2
[r2-rip-1]undo summary
[r2-rip-1]network 10.0.0.0
[r2-rip-1]network 15.0.0.0
[r2-rip-1]network 192.168.1.0
r3
[r3]rip
[r3-rip-1]version 2
[r3-rip-1]undo summary
[r3-rip-1]network 10.0.0.0
[r3-rip-1]network 15.0.0.0
[r3-rip-1]network 192.168.1.0
r4
[r4]rip
[r4-rip-1]version 2
[r4-rip-1]undo summary
[r4-rip-1]network 10.0.0.0
[r4-rip-1]network 15.0.0.0
[r4-rip-1]network 192.168.1.0
r1水平切割
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]undo rip split-horizon
五,访问r5
r1
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r1]interface Serial 3/0/0
[r1-Serial3/0/0]nat outbound 2000
r2
[r2]acl 2000
[r2-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r2]interface Serial 3/0/0
[r2-Serial3/0/0]nat outbound 2000
r3
[r3]acl 2000
[r3-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r3]interface Serial 3/0/0
[r3-Serial3/0/0]nat outbound 2000
r4
[r4]acl 2000
[r4-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r4]interface g0/0/1
[r4-GigabitEthernet0/0/1]nat outbound 2000
六,pc
r1
[r1]dhcp enable
[r1]ip policy-based-route
[r1]ip pool 1
[r1-ip-pool-1]network 192.168.1.0 mask 24
[r1-ip-pool-1]gateway-list 192.168.1.1
[r1-ip-pool-1]dns 8.8.8.8
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]dhcp select global
pc
PC>ping 5.5.5.5
Ping 5.5.5.5: 32 data bytes, Press Ctrl_C to break
From 5.5.5.5: bytes=32 seq=1 ttl=254 time=16 ms
From 5.5.5.5: bytes=32 seq=2 ttl=254 time=15 ms
From 5.5.5.5: bytes=32 seq=3 ttl=254 time=16 ms
From 5.5.5.5: bytes=32 seq=4 ttl=254 time=15 ms
From 5.5.5.5: bytes=32 seq=5 ttl=254 time=16 ms
--- 5.5.5.5 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/15/16 ms