一、首先将地址进行划分和配置
R1
[r1-GigabitEthernet0/0/0] ip address 192.168.1.1 255.255.255.0
[r1-Serial4/0/0]ip address 15.0.0.1 255.255.255.0
缺省路由:ip route-static 0.0.0.0 0.0.0.0 15.0.0.2
隧道接口ip :
[r1-Tunnel0/0/0] ip address 192.168.6.1 255.255.255.0
[r1-Tunnel0/0/1]ip address 192.168.5.1 255.255.255.0R2
[r1-GigabitEthernet0/0/0] ip address 192.168.2.1 255.255.255.0
[r1-Serial4/0/0]ip address 25.0.0.1 255.255.255.0
缺省路由:ip route-static 0.0.0.0 0.0.0.0 25.0.0.2
隧道接口ip :
[r1-Tunnel0/0/1]ip address 192.168.5.2 255.255.255.0R3
[r1-GigabitEthernet0/0/0] ip address 192.168.3.1 255.255.255.0
[r1-Serial4/0/0]ip address 35.0.0.1 255.255.255.0
缺省路由:ip route-static 0.0.0.0 0.0.0.0 35.0.0.2
隧道接口ip :
[r1-Tunnel0/0/1]ip address 192.168.5.3 255.255.255.0R4
[r1-GigabitEthernet0/0/0] ip address 192.168.4.1 255.255.255.0
[r1-GigabitEthernet4/0/0]ip address 45.0.0.1 255.255.255.0
缺省路由:ip route-static 0.0.0.0 0.0.0.0 45.0.0.2
隧道接口ip :
[r1-Tunnel0/0/0] ip address 192.168.6.2 255.255.255.0
R5
[isp-Serial3/0/0]ip address 15.0.0.2 255.255.255.0
[isp-Serial3/0/1]ip address 25.0.0.2 255.255.255.0
[isp-Serial4/0/0]ip address 35.0.0.2 255.255.255.0
[isp-GigabitEthernet0/0/0]ip address 45.0.0.2 255.255.255.0
环回:
LoopBack0 100.0.0.1/24
二、PAP、CHAP认证和HDLC封装
(PAP、CHAP认证)
PAP:[Huawei]aaa --进入aaa空间[Huawei-aaa]local-user FF password cipher 123 --创建账号和密码[Huawei-aaa]local-user FF service-type ppp ----账号和密码服务[Huawei-Serial4/0/0]ppp authentication-mode pap --选择认证模被认证方 ppp pap local-user FF password cipher 123CHAP:[Huawei]aaa --进入aaa空间[Huawei-aaa]local-user KFC password cipher 321 --创建账号和密码[Huawei-aaa]local-user KFC service-type ppp ----账号和密码服务[Huawei-Serial4/0/0]ppp authentication-mode chap --选择认证模 式被认证方 [Huawei-Serial4/0/0]ppp chap user KFC[Huawei-Serial4/0/0]ppp chap password simple 321HDLC封装代码为: [Huawei-Serial4/0/0]link-protocol hdlc
三、构建GRE、MGRE环境
GRE:R1
interface Tunnel0/0/0
ip address 192.168.6.1 255.255.255.0
tunnel-protocol gre
source 15.0.0.1
destination 45.0.0.1R4:
interface Tunnel0/0/0
ip address 192.168.6.2 255.255.255.0
tunnel-protocol gre
source 45.0.0.1
destination 15.0.0.1
MGRE:中心配置interface Tunnel0/0/1
ip address 192.168.5.1 255.255.255.0
undo rip split-horizon
tunnel-protocol gre p2mp
source 15.0.0.1
nhrp entry multicast dynamic
nhrp network-id 100分支配置代码为:
interface Tunnel0/0/1
ip address 192.168.5.2 255.255.255.0
tunnel-protocol gre p2mp
source 25.0.0.1
nhrp network-id 100
nhrp entry 192.168.5.1 15.0.0.1 register
四、基于RIP全网可达
代码如下:
[r2]rip
[r2-rip-1]version 2
[r2-rip-1]n
[r2-rip-1]network 192.168.2.0
[r2-rip-1]n
[r2-rip-1]network 192.168.5.0因为使用RIP会使分支之间路由信息获取不全(原因使RIP的水平分割),所以我们需要手动关闭RIP 的水平分割。
代码为:[r1-Tunnel0/0/0]undo rip split-horizon
五、验证