首先配置地址:
R1:
<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]ip route-static 0.0.0.0 0 15.0.0.2
R2:
<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]ip route-static 0.0.0.0 0 25.0.0.2
R3:
<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]ip route-static 0.0.0.0 0 35.0.0.2
R4:
[R4]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]ip route-static 0.0.0.0 0 45.0.0.2
R5:
<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]
添加PAP认证:
R1和R5的PAP认证并且R5是主认证方
R1:
<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 ——进入接口开启认证模式
R2:
<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
CHAP认证:
R2与R5的CHAP认证,并且R5为主认证方
在R2上:
<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
在R5上:
<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]
HDLC封装
R3于R5之间使用HDLC封装
在R3上:
[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]
在R5上:
<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所用IP地址为:192.168.5.0/24
在R1上有:
<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和R4同上
查看NHRP信息收集情况:
R1为中心站点;R1,R4间为点到点的GRE
[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][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]
所有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]在R2上:
[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在R3上:
[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在R4上:
<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