由上图所得拓扑图为:
一、IP的配置
AR1:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
Jul 10 2022 19:18:15-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R1-GigabitEthernet0/0/0]ip pool p0
Info: It's successful to create an IP address pool.
[R1-ip-pool-p0]netbios-type
[R1-ip-pool-p0]network 192.168.1.0 mask 24
[R1-ip-pool-p0]gateway-list 192.168.1.1
[R1-ip-pool-p0]dns-list 192.168.1.255
[R1-ip-pool-p0]q
[R1]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]dhcp select global
[R1-GigabitEthernet0/0/0]q
[R1]int s4/0/0
[R1-Serial4/0/0]ip add 15.0.0.1 24
[R1-Serial4/0/0]
PC1如下图所示:
AR2:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.2.1 24
Jul 10 2022 19:26:01-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R2-GigabitEthernet0/0/0]q
[R2]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R2]ip policy-based-route
[R2]ip pool p0
Info: It's successful to create an IP address pool.
[R2-ip-pool-p0]netbios-type
[R2-ip-pool-p0]network 192.168.2.0 mask 24
[R2-ip-pool-p0]gateway-list 192.168.2.1
[R2-ip-pool-p0]dns-list 192.168.2.255
[R2-ip-pool-p0]int g0/0/0
[R2-GigabitEthernet0/0/0]dhcp select global
[R2-GigabitEthernet0/0/0]int s4/0/0
[R2-Serial4/0/0]ip add 25.0.0.1 24
[R2-Serial4/0/0]
PC5如下图所示:
AR3:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R3
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.3.1 24
Jul 10 2022 19:29:58-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R3-GigabitEthernet0/0/0]int s4/0/0
[R3-Serial4/0/0]ip add 35.0.0.1 24
[R3-Serial4/0/0]q
[R3]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R3]ip pool po
Info: It's successful to create an IP address pool.
[R3-ip-pool-po]network 192.168.3.0 mask 24
[R3-ip-pool-po]gateway-list 192.168.3.1
[R3-ip-pool-po]dns-list 192.168.3.255
[R3-ip-pool-po]int g0/0/0
[R3-GigabitEthernet0/0/0]dhcp select global
PC4:
AR4:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R4
[R4]dh
[R4]dhcp en
[R4]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R4]ip po
[R4]ip policy-based-route
[R4]ip pool p0
Info: It's successful to create an IP address pool.
[R4-ip-pool-p0]network 192.168.4.0 mask 24
[R4-ip-pool-p0]gateway-list 192.168.4.1
[R4-ip-pool-p0]dns-list 192.168.4.255
[R4-ip-pool-p0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 45.0.0.1 24
[R4-GigabitEthernet0/0/0]
Jul 10 2022 19:36:24-08:00 R4 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 192.168.4.1 24
[R4-GigabitEthernet0/0/1]
Jul 10 2022 19:36:37-08:00 R4 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R4-GigabitEthernet0/0/1]dhcp select global
[R4-GigabitEthernet0/0/1]q
[R4]
PC2:
AR5:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R5
[R5]int s3/0/0
[R5-Serial3/0/0]ip add 15.0.0.2 24
[R5-Serial3/0/0]
Jul 10 2022 19:45:06-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PPP IPCP on the interface Serial3/0/0 has entered the UP state.
[R5-Serial3/0/0]int s3/0/1
[R5-Serial3/0/1]ip add 25.0.0.2 24
[R5-Serial3/0/1]
Jul 10 2022 19:45:25-08:00 R5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol PPP IPCP on the interface Serial3/0/1 has entered the UP state.
[R5-Serial3/0/1]int s4/0/1
[R5-Serial4/0/1]ip add 35.0.0.2 24
[R5-Serial4/0/1]
Jul 10 2022 19:45:40-08:00 R5 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol PPP IPCP on the interface Serial4/0/1 has entered the UP state.
[R5-Serial4/0/1]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 45.0.0.2 24
[R5-GigabitEthernet0/0/0]
Jul 10 2022 19:45:56-08:00 R5 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[R5-GigabitEthernet0/0/0]int l0
[R5-LoopBack0]ip add 5.5.5.1 24
[R5-LoopBack0]
给每个路由器写上缺省路由,使内网都能通信。
[r1]ip route-static 0.0.0.0 0 15.0.0.2
[r2]ip route-static 0.0.0.0 0 25.0.0.2
[r3]ip route-static 0.0.0.0 0 35.0.0.2
[r4]ip route-static 0.0.0.0 0 45.0.0.2
二、完成认证
(1)、因为题目中是R1和R5的PAP认证,并且R5为主认证方,因此:
AR1:
<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]aaa
[R1-aaa]local-user wp password cipher 123456 ——添加用户
Info: Add a new user.
[R1-aaa]local-user wp service-type ppp
[R1-aaa]q
[R1]int s4/0/0
[R1-Serial4/0/0]ppp au
[R1-Serial4/0/0]ppp authentication-mode pap ——进入接口开启认证模式
AR5:
<R5>sys
Enter system view, return user view with Ctrl+Z.
[R5]int s3/0/0
[R5-Serial3/0/0]ppp pap lo
[R5-Serial3/0/0]ppp pap local-user wp pa
[R5-Serial3/0/0]ppp pap local-user wp password ci
[R5-Serial3/0/0]ppp pap local-user wp password cipher 123456
(2)、R2与R5的CHAP认证,并且R5为主认证方,因此:
AR2:
<R2>sys
Enter system view, return user view with Ctrl+Z.
[R2]aaa
[R2-aaa]local-user wp password cipher 123456
Info: Add a new user.
[R2-aaa]local-user wp service-type ppp
[R2-aaa]int s4/0/0
[R2-Serial4/0/0]ppp authentication-mode chap
AR5:
<R5>sys
Enter system view, return user view with Ctrl+Z.
[R5]int s3/0/1
[R5-Serial3/0/1]ppp ch
[R5-Serial3/0/1]ppp chap u
[R5-Serial3/0/1]ppp chap user wp
[R5-Serial3/0/1]ppp cha
[R5-Serial3/0/1]ppp chap pa
[R5-Serial3/0/1]ppp chap password ci
[R5-Serial3/0/1]ppp chap password cipher 123456
[R5-Serial3/0/1]
(3)、R3于R5之间使用HDLC封装,因此:
AR3:
[R3]int s4/0/0
[R3-Serial4/0/0]lin
[R3-Serial4/0/0]link-protocol hd
[R3-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
Jul 10 2022 20:03:22-08:00 R3 %%01IFNET/4/CHANGE_ENCAP(l)[0]:The user performed the configuration that will change the encapsulation protocol of the link and then selected Y.
[R3-Serial4/0/0]
[R3-Serial4/0/0]
Jul 10 2022 20:03:22-08:00 R3 %%01PPP/4/PHYSICALDOWN(l)[1]:On the interface Serial4/0/0, PPP link was closed because the status of the physical layer was Down.
[R3-Serial4/0/0]
Jul 10 2022 20:03:22-08:00 R3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol PPP on the interface Serial4/0/0 has entered the DOWN state.
[R3-Serial4/0/0]
Jul 10 2022 20:03:22-08:00 R3 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol PPP IPCP on the interface Serial4/0/0 has entered the DOWN state.
[R3-Serial4/0/0]
AR5:
<R5>sys
Enter system view, return user view with Ctrl+Z.
[R5]int s4/0/1
[R5-Serial4/0/1]lin
[R5-Serial4/0/1]link-protocol hd
[R5-Serial4/0/1]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
Jul 10 2022 20:07:38-08:00 R5 %%01IFNET/4/CHANGE_ENCAP(l)[0]:The user performed the configuration that will change the encapsulation protocol of the link and then selected Y.
[R5-Serial4/0/11]
[R5-Serial4/0/1]q
RIP:
R1:
[R1]rip
[R1-rip-1]ne
[R1-rip-1]network 192.168.1.0
[R1-rip-1]ne
[R1-rip-1]network 123.0.0.0
[R1-rip-1]
R2:
[R2]rip
[R2-rip-1]ne
[R2-rip-1]network 192.168.2.0
[R2-rip-1]network 123.0.0.0
[R2-rip-1]
R3:
[R3]rip
[R3-rip-1]ne
[R3-rip-1]network 192.168.3.0
[R3-rip-1]ne
[R3-rip-1]network 123.0.0.0
[R3-rip-1]
R4:
[R4]rip
[R4-rip-1]ne
[R4-rip-1]network 192.168.4.0
[R4-rip-1]
三、MGRE环境搭建:
MGRE使用192.168.5.0/24网段
<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]int t0/0/0
[R1-Tunnel0/0/0]ip add 192.168.5.1 24
[R1-Tunnel0/0/0]tu
[R1-Tunnel0/0/0]tunnel-protocol gr
[R1-Tunnel0/0/0]tunnel-protocol gre p2
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]so
[R1-Tunnel0/0/0]source 15.0.0.1
Jul 10 2022 22:20:44-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]ne
[R1-Tunnel0/0/0]nh
[R1-Tunnel0/0/0]nhrp ne
[R1-Tunnel0/0/0]nhrp network-id 100
[R1-Tunnel0/0/0]
R2(分支):
<R2>sys
Enter system view, return user view with Ctrl+Z.
[R2]int t0/0/0
[R2-Tunnel0/0/0]ip add 192.168.5.2 24
[R2-Tunnel0/0/0]tu
[R2-Tunnel0/0/0]tunnel-protocol gr
[R2-Tunnel0/0/0]tunnel-protocol gre p2
[R2-Tunnel0/0/0]so
[R2-Tunnel0/0/0]source s4/0/0
Jul 10 2022 22:23:25-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]nh
[R2-Tunnel0/0/0]nhrp ne
[R2-Tunnel0/0/0]nhrp network-id 100
[R2-Tunnel0/0/0]nh
[R2-Tunnel0/0/0]nhrp en
[R2-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 re
[R2-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register
[R2-Tunnel0/0/0]
R3(与R2同理):
<R3>sys
Enter system view, return user view with Ctrl+Z.
[R3]int t0/0/0
[R3-Tunnel0/0/0]ip add 192.168.5.3 24
[R3-Tunnel0/0/0]tu
[R3-Tunnel0/0/0]tunnel-protocol g
[R3-Tunnel0/0/0]tunnel-protocol gre p2
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]s
[R3-Tunnel0/0/0]set
[R3-Tunnel0/0/0]shutdown
[R3-Tunnel0/0/0]source s4/0/0
Jul 10 2022 22:24:22-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]
[R3-Tunnel0/0/0]nh
[R3-Tunnel0/0/0]nhrp ne
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nh
[R3-Tunnel0/0/0]nhrp en
[R3-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 re
[R3-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register
[R3-Tunnel0/0/0]
查看NHRP信息收集情况
四、R1为中心站点;R1、R4间为点到点的GRE
AR1:
[R1]int t0/0/1
[R1-Tunnel0/0/1]ip add 192.168.6.1 24
[R1-Tunnel0/0/1]tu
[R1-Tunnel0/0/1]tunnel-protocol gr
[R1-Tunnel0/0/1]tunnel-protocol gre
[R1-Tunnel0/0/1]so
[R1-Tunnel0/0/1]source 15.0.0.1
[R1-Tunnel0/0/1]de
[R1-Tunnel0/0/1]description 45.0.0.1
[R1-Tunnel0/0/1]
AR4:
[R4]int t0/0/1
[R4-Tunnel0/0/1]ip add 192.168.6.2 24
[R4-Tunnel0/0/1]tu
[R4-Tunnel0/0/1]tunnel-protocol g
[R4-Tunnel0/0/1]tunnel-protocol gre
[R4-Tunnel0/0/1]so
[R4-Tunnel0/0/1]source 45.0.0.1
[R4-Tunnel0/0/1]de
[R4-Tunnel0/0/1]description 15.0.0.1
[R4-Tunnel0/0/1]
五、整个私有网络基于RIP全网可达
AR1:
[R1]rip
[R1-rip-1]v 2
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 192.168.5.0
[R1-rip-1]network 192.168.6.0
AR2:
<R2>sys
Enter system view, return user view with Ctrl+Z.
[R2]rip
[R2-rip-1]v 2
[R2-rip-1]network 192.168.2.0
[R2-rip-1]network 192.168.5.0
[R2-rip-1]q
AR3:
<R3>sys
Enter system view, return user view with Ctrl+Z.
[R3]rip
[R3-rip-1]v 2
[R3-rip-1]network 192.168.2.0
[R3-rip-1]network 192.168.5.0
[R3-rip-1]network 192.168.3.0
[R3-rip-1]
AR4:
[R4]rip
[R4-rip-1]v 2
[R4-rip-1]ne
[R4-rip-1]network 192.168.4.0
[R4-rip-1]network 192.168.6.0
[R4-rip-1]
[r1-Tunnel0/0/0]nhrp entry multicast dynamic —开启中心站点伪广播
[r1-Tunnel0/0/0]undo rip split-horizon —关闭接口水平分割功能
六、所有Pc设置私有IP为源IP,可以访问R5环回。
给所有的边缘路由器接口做nat转换。
R1:
[R1]acl 2000
[R1-acl-basic-2000]ru
[R1-acl-basic-2000]rule per
[R1-acl-basic-2000]rule permit so
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R1-acl-basic-2000]int s4/0/0
[R1-Serial4/0/0]na
[R1-Serial4/0/0]nat ou
[R1-Serial4/0/0]nat outbound 2000
[R1-Serial4/0/0]
AR2:
[R2]acl 2000
[R2-acl-basic-2000]ru
[R2-acl-basic-2000]rule per
[R2-acl-basic-2000]rule permit so
[R2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[R2-acl-basic-2000]int s4/0/0
[R2-Serial4/0/0]na
[R2-Serial4/0/0]nat ou
[R2-Serial4/0/0]nat outbound 2000
[R2-Serial4/0/0]q
AR3:
[R3]acl 2000
[R3-acl-basic-2000]ru
[R3-acl-basic-2000]rule per
[R3-acl-basic-2000]rule permit s
[R3-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[R3-acl-basic-2000]int s4/0/0
[R3-Serial4/0/0]na
[R3-Serial4/0/0]nat ou
[R3-Serial4/0/0]nat outbound 2000
[R3-Serial4/0/0]q
AR4:
<R4>sys
Enter system view, return user view with Ctrl+Z.
[R4]acl
[R4]acl 2000
[R4-acl-basic-2000]ru
[R4-acl-basic-2000]rule per
[R4-acl-basic-2000]rule permit ?
fragment Check fragment packet
none-first-fragment Check the subsequence fragment packet
source Specify source address
time-range Specify a special time
vpn-instance Specify a VPN-Instance
<cr> Please press ENTER to execute command
[R4-acl-basic-2000]rule permit s
[R4-acl-basic-2000]rule permit source 192.168.4.0 0.0.0.255
[R4-acl-basic-2000]int g0/0/0
[R4-GigabitEthernet0/0/0]na
[R4-GigabitEthernet0/0/0]nat ?
outbound Specify net address translation
server Specify NAT server
static Specify static NAT
[R4-GigabitEthernet0/0/0]nat ou
[R4-GigabitEthernet0/0/0]nat outbound 2000
[R4-GigabitEthernet0/0/0]q
OK!