实验步骤:
第一步
给PC1和PC2和PC3配地址
第二步给R1到R5配置接口IP地址
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip ad 192.168.1.254 24
R1:[R1-GigabitEthernet0/0/0]int s4/0/0
[R1-Serial4/0/0]ip ad 15.1.1.1 24
[R1-Serial4/0/0]dis ip int b
[R1-Serial4/0/0]q
[R1]dis ip int b
[R1]dis ip int brief
R2:[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip ad 192.168.2.254 24
[R2-GigabitEthernet0/0/0]int s4/0/0
[R2-Serial4/0/0]ip ad 25.1.1.2 24
[R2-Serial4/0/0]q
[R2]dis ip int b
[R2]dis ip int brief
R3:[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip ad 192.168.3.254 24
[R3-GigabitEthernet0/0/0]int s4/0/0
[R3-Serial4/0/0]ip ad 34.1.1.3 24
[R3-Serial4/0/0]q
[R3]dis ip int b
[R3]dis ip int brief
R4:[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip ad 192.168.4.254 24
[R4-GigabitEthernet0/0/0]int s4/0/0
[R4-Serial4/0/0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip ad 45.1.1.4 24
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip ad 192.168.4.254 24
[R5]int s4/0/1
[R5-Serial4/0/1]ip ad 15.1.1.5 24
[R5-Serial4/0/1]int s3/0/1
[R5-Serial3/0/1]ip ad 25.1.1.5 24
R5:[R5-Serial3/0/1]int s4/0/0
[R5-Serial4/0/0]ip ad 35.1.1.5 24
[R5-Serial4/0/0]int g0/0/0
[R5-GigabitEthernet0/0/0]ip ad 45.1.1.5 24
[R5-GigabitEthernet0/0/0]int l0
[R5-LoopBack0]ip ad 5.5.5.5 24
第三步:把私网和公网弄通 私网都是直连就不需要 就只弄公网就可以
配静态缺省:[R1]ip rou
[R1]ip route-s
[R1]ip route-static 0.0.0.0 0 15.1.1.5
[R2]ip rou
[R2]ip route-s
[R2]ip route-static 0.0.0.0 0 25.1.1.5
R3]ip rou
[R3]ip route-s
[R3]ip route-static 0.0.0.0 0 35.1.1.5
[R4]ip rou
[R4]ip route-s
[R4]ip route-static 0.0.0.0 0 45.1.1.5
第四步:PPP的认证
R5为主认证方
R5:[R5]aa
[R5-aaa]lo
[R5-aaa]local-user wangdaye pa
[R5-aaa]local-user wangdaye password c
[R5-aaa]local-user wangdaye password cipher wdy12345
Info: Add a new user.
[R5-aaa]lo
[R5-aaa]local-user wangdaye se
[R5-aaa]local-user wangdaye service-type ppp
[R5-aaa]q
[R5]int s4/0/1
[R5-Serial4/0/1]ppp au
[R5-Serial4/0/1]ppp authentication-mode pap
R1:[R1]int s4/0/0
[R1-Serial4/0/0]ppp pap lp
[R1-Serial4/0/0]ppp pap lo
[R1-Serial4/0/0]ppp pap local-user wangdaye pa
[R1-Serial4/0/0]ppp pap local-user wangdaye password ch
[R1-Serial4/0/0]ppp pap local-user wangdaye password ci
[R1-Serial4/0/0]ppp pap local-user wangdaye password cipher wdy12345
第五步:R2和R5之间使用ppp的chap认证
R5为主认证方
[R5]aaa
[R5-aaa]lo
[R5-aaa]local-user zhangdaye pass
[R5-aaa]local-user zhangdaye password ci
[R5-aaa]local-user zhangdaye password cipher zdy12345
Info: Add a new user.
[R5-aaa]lo
[R5-aaa]local-user zhangdaye se
[R5-aaa]local-user zhangdaye service-type ppp
[R5-aaa]q
[R5]int s3/0/1
[R5-Serial3/0/1]ppp au
[R5-Serial3/0/1]ppp authentication-mode chap
[R2]int s4/0/0
[R2-Serial4/0/0]chap u
[R2-Serial4/0/0]ppp chap u
[R2-Serial4/0/0]ppp chap user zhangdaye
[R2-Serial4/0/0]ppp chap pa
[R2-Serial4/0/0]ppp chap password ci
[R2-Serial4/0/0]ppp chap password cipher zdy12345
[R2-Serial4/0/0]shutdown
第六步 R3和R5使用HDLC封装
[R3]int s4/0/0
[R3-Serial4/0/0]link
[R3-Serial4/0/0]link-protocol ?
fr Select FR as line protocol
hdlc Enable HDLC protocol
lapb LAPB(X.25 level 2 protocol)
ppp Point-to-Point protocol
sdlc SDLC(Synchronous Data Line Control) protocol
x25 X.25 protocol
[R3-Serial4/0/0]link-protocol hdlc
[R5-Serial3/0/1]int s4/0/0
[R5-Serial4/0/0]link
[R5-Serial4/0/0]link-protocol hdlc
第七步:给R1、R2、R3构建一个MGRE环境
先进入隧道接口
定义隧道类型
将R1、R2、R3三个加入到一个nhrp域中
[R1]int t
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip ad 10.1.2.1 24
[R1-Tunnel0/0/0]tu
[R1-Tunnel0/0/0]tunnel-protocol gre
[R1-Tunnel0/0/0]tunnel-protocol gre p
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]sou
[R1-Tunnel0/0/0]source 15.1.1.1
Mar 30 2024 14:49:28-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R1-Tunnel0/0/0]
[R1-Tunnel0/0/0]nhrp n
[R1-Tunnel0/0/0]nhrp network-id 100
[R2]int t
[R2]int Tunnel 0/0/0
[R2-Tunnel0/0/0]ip ad 10.1.1.2 24
[R2-Tunnel0/0/0]tu
[R2-Tunnel0/0/0]tunnel-protocol gre
[R2-Tunnel0/0/0]tunnel-protocol gre p
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp
[R2-Tunnel0/0/0]sou
[R2-Tunnel0/0/0]source s
[R2-Tunnel0/0/0]source Serial 4/0/0
Mar 30 2024 14:51:40-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R2-Tunnel0/0/0]
[R2-Tunnel0/0/0]n
[R2-Tunnel0/0/0]nh
[R2-Tunnel0/0/0]nhrp nt
[R2-Tunnel0/0/0]nhrp ne
[R2-Tunnel0/0/0]nhrp network-id 100
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip ad 10.1.2.3 24
[R3-Tunnel0/0/0]t
[R3-Tunnel0/0/0]tu
[R3-Tunnel0/0/0]tunnel-protocol gre
[R3-Tunnel0/0/0]tunnel-protocol gre p
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]sou
[R3-Tunnel0/0/0]source z
[R3-Tunnel0/0/0]source s
[R3-Tunnel0/0/0]source Serial 4/0/0
Mar 30 2024 14:52:27-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R3-Tunnel0/0/0]nhrp b
[R3-Tunnel0/0/0]nhrp n
[R3-Tunnel0/0/0]nhrp network-id 100
R1和R4随后建立gre隧道
[R1]int t0/0/1
[R1-Tunnel0/0/1]ip ad 10.1.1.1 24
[R1-Tunnel0/0/1]tu
[R1-Tunnel0/0/1]tunnel-protocol gre
[R1-Tunnel0/0/1]sou
[R1-Tunnel0/0/1]source 15.1.1.1
[R1-Tunnel0/0/1]dest
[R1-Tunnel0/0/1]destination 45.1.1.4
[R4]int t
[R4]int Tunnel 0/0/1
[R4-Tunnel0/0/1]ip ad 10.1.1.4 24
[R4-Tunnel0/0/1]tu
[R4-Tunnel0/0/1]tunnel-protocol gre
[R4-Tunnel0/0/1]sou
[R4-Tunnel0/0/1]source 45.1.1.4
[R4-Tunnel0/0/1]dest
[R4-Tunnel0/0/1]destination 15.1.1.1
第八步:RIP使私网全网可达
RIP的宣告是按照主类宣告
比如说10.0.0.0 就把10.1.2.0和10.1.1.0都宣告了
开启隧道口的广播功能
关闭R1的水平分割机制
[R1-rip-1]v 2
[R1-rip-1]undo s
[R1-rip-1]undo su
[R1-rip-1]undo summary
[R1-rip-1]netw 192.168.1.0
[R1-rip-1]netw 10.0.0.0
[R1-rip-1]q
[R1]int t
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]nhrp en
[R1-Tunnel0/0/0]nhrp entry mu
[R1-Tunnel0/0/0]nhrp entry multicast dy
[R1-Tunnel0/0/0]nhrp entry multicast dynamic
[R2]rip 1
[R2-rip-1]v 2
[R2-rip-1]undo su
[R2-rip-1]undo summary
[R2-rip-1]netw 192.168.2.0
[R2-rip-1]netw 10.0.0.0
[R2-rip-1]q
[R2]int t
[R2]int Tunnel 0/0/0
[R2-Tunnel0/0/0]nhrp en
[R2-Tunnel0/0/0]nhrp entry mu
[R2-Tunnel0/0/0]nhrp entry 10.1.2.1 15.1.1.1 re
[R2-Tunnel0/0/0]nhrp entry 10.1.2.1 15.1.1.1 register
[R3]rip 1
[R3-rip-1]v 2
[R3-rip-1]undo su
[R3-rip-1]undo summary
[R3-rip-1]netw 192.168.3.0
[R3-rip-1]netw 10.0.0.0
[R3-rip-1]q
[R3]int t
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]nhrp entry 10.1.2.1 15.1.1.1 register
[R3-Tunnel0/0/0]undo rip split-horizon
[R4]rip 1
[R4-rip-1]v 2
[R4-rip-1]undo su
[R4-rip-1]undo summary
[R4-rip-1]netw 192.168.4.0
[R4-rip-1]netw 10.0.0.0
最后一步做nat server
[R1]acl 2000
[R1-acl-basic-2000]per
[R1-acl-basic-2000]ru
[R1-acl-basic-2000]rule per
[R1-acl-basic-2000]rule permit sou
[R1-acl-basic-2000]rule permit source 192.168.1.0 0 0.0.0.255
^
Error:Too many parameters found at '^' position.
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R1-acl-basic-2000]q
[R1]int s
[R1]int Serial 4/0/0
[R1-Serial4/0/0]nat o
[R1-Serial4/0/0]nat outbound 2000
[R2]acl 2000
[R2-acl-basic-2000]rule pe
[R2-acl-basic-2000]rule permit sou
[R2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[R2-acl-basic-2000]int s
[R2-acl-basic-2000]q
[R2]int s
[R2]int Serial 4/0/0
[R2-Serial4/0/0]nat o
[R2-Serial4/0/0]nat outbound 2000
[R3]acl 2000
[R3-acl-basic-2000]rule per
[R3-acl-basic-2000]rule permit sou
[R3-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[R3-acl-basic-2000]q
[R3]int s
[R3]int Serial 4/0/0
[R3-Serial4/0/0]nat 0
[R3-Serial4/0/0]nat o
[R3-Serial4/0/0]nat outbound 2000
[R4]acl 2000
[R4-acl-basic-2000]rule pe
[R4-acl-basic-2000]rule permit sou
[R4-acl-basic-2000]rule permit source 192.168.4.0 0.0.0.255
[R4-acl-basic-2000]q
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]nat o
[R4-GigabitEthernet0/0/0]nat outbound 2000
[R4-GigabitEthernet0/0/0]
最后达到全网通