整体思路:
- 子网划分、IP地址网段规划;配置ip地址(所有节点有有合法ip)
- 缺省路由
- 完成链路要求:R1-R2之间为 HDLC 封装 ;R2-R3之间为 PPP 封装,pap 认证:R2为主认证方;R2-R4之间为 PPP封装,chap 认证,R2为主认证方
- 构建MGRE环境
- RIP动态路由
- NAT
一、 子网划分、IP地址网段规划;配置ip地址(所有节点有有合法ip)
[R1]int s 4/0/0
[R1-Serial4/0/0]ip add 12.0.0.1 24
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[R2]int s 4/0/0
[R2-Serial4/0/0]ip add 12.0.0.2 24
[R2-Serial4/0/0]int s 4/0/1
[R2-Serial4/0/1]ip add 23.0.0.1 24
[R2-Serial4/0/1]int s 3/0/0
[R2-Serial3/0/0]ip add 24.0.0.1 24
[R2]int LoopBack 1
[R2-LoopBack1]ip add 1.1.1.1 24
[R3]int g 0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.2.1 24
[R3-GigabitEthernet0/0/1]int s 4/0/0
[R3-Serial4/0/0]ip add 23.0.0.2 24
[R4]int s 4/0/0
[R4-Serial4/0/0]ip add 24.0.0.2 24
二、缺省路由(保证公网联通)
[R1]ip route-static 0.0.0.0 0 12.0.0.1
[R3]ip route-static 0.0.0.0 0 23.0.0.1
[R4]ip route-static 0.0.0.0 0 24.0.0.1
三、完成链路要求
1.R1-R2之间为 HDLC 封装
二层封装模式是一样的,只有相同的封装模式才可互相通信
[R1]int s 4/0/0
[R1-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
[R2]int s 4/0/0
[R2-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
2.R2-R3之间为 PPP 封装,pap 认证,R2为主认证方
华为设备串口默认为PPP封装类型,故直接做认证即可
R2为主认证方
[R2]aaa
[R2-aaa]local-user admin password cipher 123456
[R2-aaa]local-user admin service-type ppp
[R2-aaa]q
[R2]interface s 4/0/0 连接客户端的接口
[R2-Serial4/0/0]ppp authentication-mode pap
R3为被认证方
[R3]int s 4/0/0
[R3-Serial4/0/0]ppp pap local-user admin password cipher 123456
[R3-Serial4/0/0]shutdown
[R3-Serial4/0/0]undo shutdown
接口重启,会话重新建立
3. R2-R4之间为 PPP封装,chap 认证,R2为主认证
R2主认证方开启ppp认证
[R2]int s 3/0/0
[R2-Serial3/0/0]ppp a
[R2-Serial3/0/0]ppp authentication-mode chap
[R4] int s 4/0/0
[R4-Serial4/0/0]ppp chap user admin
[R4-Serial4/0/0]ppp chap password cipher 123456
[R4-Serial4/0/0]q
[R4-Serial4/0/0]shutdown
[R4-Serial4/0/0]undo shutdown
chap认证与pap认证区别:
区别在于认证过程, PAP 是简单认证明文传送客户端直接发送包含用户名、密码的认证请求服务器处理并回应。而 CHAP 是加密认证,先由服务器端给客户端发送个随机码challenge 客户端根据 challenge 对口令进行加密。然后把这个结果发送给服务器,服务器从数据库中取出口令password2,同样进行加密处理。最后比较加密的结果是否相同.如相同,则认证通过,向客户端发送认可消息。
四、 构建MGRE环境
[R1]int Tunnel 0/0/0 创建隧道接口(tunnel口)
[R1-Tunnel0/0/0]ip add 192.168.4.1 24 配置接口IP地址
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp 定义封装类型——修改接口模式为多点GRE
[R1-Tunnel0/0/0]source 12.0.0.1 定义出接口源ip地址
[R1-Tunnel0/0/0]nhrp network-id 100 创建nhrp域
[R1-Tunnel0/0/0]nhrp entry multicast dynamic 成为NHRP中心,开启伪广播
[R3]int Tunnel 0/0/0 创建隧道接口
[R3-Tunnel0/0/0]ip add 192.168.4.2 24 配置接口IP地址
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp 修改接口模式为多点GRE
[R3-Tunnel0/0/0]source s 4/0/0
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp entry 192.168.4.1 12.0.0.1 register 分支到中心站点注册
[R3-Tunnel0/0/0]q
R4同R3
[R4]int Tunnel 0/0/0
[R4-Tunnel0/0/0]ip add 192.168.4.3 24
[R4-Tunnel0/0/0]tunnel-protocol gre p2mp
[R4-Tunnel0/0/0]source s 4/0/0
[R4-Tunnel0/0/0]nhrp network-id 100
[R4-Tunnel0/0/0]nhrp entry 192.168.4.1 12.0.0.1 register
[R4-Tunnel0/0/0]q
五、RIP动态路由
[R1]rip
[R1-rip-1]version 2
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 192.168.4.0
[R3]rip
[R3-rip-1]version 2
[R3-rip-1]network 192.168.2.0
[R3-rip-1]network 192.168.4.0
[R4]rip
[R4-rip-1]version 2
[R4-rip-1]network 192.168.3.0
[R4-rip-1]network 192.168.4.0
当拓扑结构为中心到站点(轴辐状)---不是所有网点均为固定的公有ip,没法所有tunnel设备相互注册;只能通过关闭水平分割来实现路由的全网正常收敛
[R1]int t 0/0/0
[R1-Tunnel0/0/0]undo rip split-horizon
六、NAT
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R1-acl-basic-2000]q
[R1]int s 4/0/0
[R1-Serial4/0/0]nat outbound 2000
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[R3-acl-basic-2000]q
[R3]int s 4/0/0
[R3-Serial4/0/0]nat outbound 2000
[R4]acl 2000
[R4-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[R4-acl-basic-2000]q
[R4]int s 4/0/0
[R4-Serial4/0/0]nat outbound 2000
最终实验结果如下: