配置IP:
r1
[r1]int s 4/0/0
[r1-Serial4/0/0]ip ad 15.0.0.1 24
[r1-Serial4/0/0]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip ad 192.168.1.1 24
r2
[r2]int s 4/0/0
[r2-Serial4/0/0]ip ad 25.0.0.1 24
[r2-Serial4/0/0]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip ad 192.168.2.1 24
r3
[r3]int s 4/0/0
[r3-Serial4/0/0]ip ad 35.0.0.1 24
[r3-Serial4/0/0]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip ad 192.168.3.1 24
r4
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip ad 45.0.0.1 24
Jan 11 2022 11:19:54-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]int g 0/0/1
[r4-GigabitEthernet0/0/1]ip ad 192.168.4.1 24
ISP
[isp]int s 3/0/0
[isp-Serial3/0/0]ip ad 15.0.0.2 24
[isp-Serial3/0/0]int s 3/0/1
[isp-Serial3/0/1]ip ad 25.0.0.2 24
[isp-Serial3/0/1]int g 0/0/0
[isp-GigabitEthernet0/0/0]ip ad 45.0.0.2 24
[isp-GigabitEthernet0/0/0]int s 4/0/0
[isp-Serial4/0/0]ip ad 35.0.0.2 24
[isp-Serial4/0/0]int l0
[isp-LoopBack0]ip ad 5.5.5.5 24
每个路由器配置指向isp的缺省路由
[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
r1和r5pap认证:
[isp-aaa]local-user r1 password cipher 123456
Info: Add a new user.
[isp-aaa]local-user r1 service-type ppp
[isp-aaa]int s 3/0/0
[isp-Serial3/0/0]ppp authentication-mode p
[isp-Serial3/0/0]ppp authentication-mode pap
[r1-Serial4/0/0]ppp pap local-user r1 password cipher 123456
r2和r5之间使用chap认证:
[isp-aaa]local-user r2 password cipher 123456
Info: Add a new user.
[isp-aaa]local-user r1 service-type ppp
[isp-aaa]int s 3/0/1
[isp-Serial3/0/1]ppp authentication-mode chap
[r2-Serial4/0/0]ppp chap user r2
[r2-Serial4/0/0]ppp chap password cipher 123456
r3和r5之间使用HDLC封装:
因为华为设备默认使用ppp封装,所以要到对应的接口更改为HDLC封装
两边对端接口都要进行配置,配置完成后接口双up
[r3-Serial4/0/0]link-protocol hdlc
[isp-Serial4/0/0]link-protocol hdlc
r1,r2和r3构建MGRE:
[r1]int t 0/0/0 ----------创建隧道接口
[r1-Tunnel0/0/0]ip address 192.168.5.1 24 -----------创建IP地址
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp ------选择封装方式
[r1-Tunnel0/0/0]source 15.0.0.1 ---------定义ip源
Jan 11 2022 12:31:09-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]nhrp network-id 100 -----------通过NHRP获取目标iIP
[r1-Tunnel0/0/0]nhrp entry multicast dynamic -------------开启沩广播
[r2]int t 0/0/0
[r2-Tunnel0/0/0]ip ad 192.168.5.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]source s 4/0/0
Jan 11 2022 12:36:14-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]nhrp entry 192.168.5.1 15.0.0.1 register
[r3-Tunnel0/0/0]t
[r3-Tunnel0/0/0]ip ad 192.168.5.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source s
[r3-Tunnel0/0/0]source Serial 4/0/0
Jan 11 2022 12:38:23-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 network-id 100
[r3-Tunnel0/0/0]nh
[r3-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register
r1和r4点到点gre:
[r1]int t 0/0/1
[r1-Tunnel0/0/1]ip ad 192.168.6.1 24
[r1-Tunnel0/0/1]source 15.0.0.1
[r1-Tunnel0/0/1]destination 45.0.0.1
[r4-Tunnel0/0/1]ip ad 192.168.6.2 24
[r4-Tunnel0/0/1]tunnel-protocol gre
[r4-Tunnel0/0/1]source 45.0.0.1
[r4-Tunnel0/0/1]destination 15.0.0.1
整个私有网络基于rip全网可达
要在整个私有路由器上都要运行rip
由于mgre环境下,虽然做了沩广播,由于rip水平分割机制的存在,导致r1发送给r2和r3发送的内容不全所以----------去中心r1的对应的int t 0/0/0接口关闭对应的水平分割
[r1-Tunnel0/0/0]undo rip split-horizon
所有pc设置私有ip
可以访问r5环回:
私网访问公网网段,每个 边界路由器的出接口都要进行配置,因为每个路由器已经有指向r5的缺省就不能再写缺省指向r1(中心),
[r1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255--抓取1.0网段的ip
[r1-Serial4/0/0]nat outbound 2000
[r2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[r2-acl-basic-2000]int s 4/0/0
[r2-Serial4/0/0]n
[r2-Serial4/0/0]nat o
[r2-Serial4/0/0]nat outbound 2000