一、如图所示配置IP地址
二、为R1-R2配置HDLC封装
HDLC 高级链路控制协议
--- 属于点到点网络类型
--- 没有二层单播(唯一)地址;
物理网线为串线链路;
--- 各家厂商该技术均为私有;华为默认串线链路不是HDLC;
[r4-Serial4/0/1]int s 3/0/0
[r4-Serial3/0/0]link-protocol hdlc 选择连接协议为hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
****此时R1的串口的协议状态会显示down,需要在对应的R1接口上启用hdlc
[r1]int s 4/0/0
[r1-Serial4/0/0]link-pro
[r1-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
二、配置R2-R4的ppp封装使用pap认证
PPP -- 点到点协议 -- 属于点到点网络类型 --- 华为设备默认串口封装技术;
HDLC的升级版;
升级点:拨号
1、直连间,ip地址不在同一网段也可正常通讯;在PPP协商初期,相互共享接口ip地址,生成直连的32位主机路由
2、认证 -- 身份核实
3、建立虚连接,分配ip地址
[r4-aaa]local-user mansonai privilege level 15 password cipher 123456
Info: Add a new user.
****创建一个用户
[r4-aaa]local-user mansonai service-type ppp
****将该用户定义用于ppp封装
[r4-aaa]int s 4/0/0
[r4-Serial4/0/0]ppp authentication-mode pap
****指定这个接口做ppp封装的pap认证
[r2]interface s 4/0/0
[r2-Serial4/0/0]ppp pap local-user mansonai password cipher 123456
****被认证的R2使用主认证服务器用于ppp封装的pap认证的用户进行认证
三、配置R4-R3的ppp封装使用chap认证
挑战握手认证协议(CHAP,Challenge-Handshake Authentication Protocol)是在网络物理连接后进行连接安全性验证的协议。它比另一种协议密码验证程序(PAP)更加可靠。
主认证:
[r4-aaa]local-user mansonai0 privilege level 15 password cipher 654321
Info: Add a new user.
****创建一个新用户用于认证
[r4-aaa]local-user mansonai0 service-type ppp
****将该用户指定用于ppp
[r4-aaa]int s4/0/1
[r4-Serial4/0/1]ppp authentication-mode chap
****指定该接口用于ppp封装的chap认证
被认证:
[r3]int s 4/0/1
[r3-Serial4/0/1]ppp chap password cipher 654321
****定义该接口用于chap的密码
[r3-Serial4/0/1]ppp chap user mansonai0
****定义该接口用于chap的用户名
四、构建MRGE
R1
[r1]interface Tunnel 0/0/0
****创建tunnel口
[r1-Tunnel0/0/0]ip address 10.1.1.1 24
****为tunnel口配置ip地址
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
****修改接口模式为多点gre
[r1-Tunnel0/0/0]source 14.1.1.1
****再定义公有的源IP地址
Jul 20 2022 00:59:14-08:00 r1 %%01IFNET/4/LINK_STATE(l)[8]:The line protocol IP on the interface Tunnel0/0/0 has entered the UP state.
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
****本地成为NHRP中心,同时可以进行伪广播
[r1-Tunnel0/0/0]nhrp network-id 100
****默认为0号,该网段内所有节点tunnel接口必须为相同域
伪广播
当目标IP地址为组播或广播地址时,将流量基于每个用户进行一次单播;
外层报头为单播报头,内层报头为组播或广播报头;
该功能不开启,正常基于组播和广播工作的动态路由协议将无法正常使用
R2/R3
此处列举R2的配置
[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ip ad 10.1.1.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]source Serial 4/0/0
****因为该ip地址不是固定的 所以指定这个接口作为源
Jul 20 2022 01:11:05-08:00 r2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP on the interface Tunnel0/0/0 has entered the UP state.
[r2-Tunnel0/0/0]nhrp network-id 100
[r2-Tunnel0/0/0]nhrp entry 10.1.1.1 14.1.1.1 register
****分支需要到中心站点注册
五、配置路由
R1
[r1]ip route-static 0.0.0.0 0 14.1.1.2
[r1]rip 1
[r1-rip-1]version 2
[r1-rip-1]network 192.168.1.0
[r1-rip-1]network 10.0.0.0
****宣告tunnel口,此处并不宣告连接ISP的串口,学习的是tunnel口的路由
[r1]rip 1
[r1-rip-1]default-route originate
****若所有tunnel对应的公有ip均为固定ip地址,可以让每台路由器均成为中心站点,两两间均进行手工注册;
****可以形成全连网状结构拓扑;
****---rip这种存在水平分割机制的协议能够正常收敛;
****当拓扑结构为中心到站点(轴辐状、星型)
****---不是所有网点均为固定的公有ip,没法所有tunnel设备相互注册;
****只能通过关闭水平分割来实现路由的全网正常收敛;
R2
[r2]ip route-static 0.0.0.0 0 24.1.1.2
[r2]rip 1
[r2-rip-1]version 2
[r2-rip-1]network 192.168.2.0
[r2-rip-1]network 10.0.0.0
R3
[r3]ip route-static 0.0.0.0 0 34.1.1.2
[r3]rip 1
[r3-rip-1]version 2
[r3-rip-1]network 192.168.3.0
[r3-rip-1]network 10.0.0.0
六、配置NAT
要求需要pc访问4.4.4.4
此处列举R1的配置
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r1-acl-basic-2000]int s 4/0/0
[r1-Serial4/0/0]nat o
[r1-Serial4/0/0]nat outbound 2000
七、测试
1、pc3访问4.4.4.4
2、pc3访问pc1 pc2
3、MGRE
[r1]ping -a 10.1.1.1 10.1.1.2
PING 10.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.2: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 10.1.1.2: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 10.1.1.2: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 10.1.1.2: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 10.1.1.2: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 10.1.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/24/30 ms
[r1]ping -a 10.1.1.1 10.1.1.3
PING 10.1.1.3: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.3: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 10.1.1.3: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 10.1.1.3: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 10.1.1.3: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 10.1.1.3: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 10.1.1.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/28/30 ms
完成