RIP + GRE 配置笔记

RIP + GRE 配置笔记

拓扑结构

[R5 中心Hub] / | \ \ R1 R2 R3 R4 | | | | PC1 PC3 PC4 PC2

地址规划

设备WAN接口LAN接口Tunnel接口
R115.1.1.1/24192.168.1.1/2410.1.1.1 (P2P)
10.1.2.1 (P2MP)
R225.1.1.2/24192.168.2.1/2410.1.2.2 (P2MP)
R335.1.1.3/24192.168.3.1/2410.1.2.3 (P2MP)
R445.1.1.4/24192.168.4.1/2410.1.1.2 (P2P)
R515.1.1.5 / 25.1.1.5
35.1.1.5 / 45.1.1.5
--

R5 配置(中心Hub)

1. 创建本地用户(用于PPP认证)

原因:R5需要验证分支路由器的PPP连接,所以要创建对应的用户名和密码

aaa local-user r1 password cipher %$%$.&bv77P^L'>6qCG^o!jFCRA]%$%$ local-user r1 service-type ppp local-user r2 password cipher %$%$E\6bJm{^DKT`ps>n:JM=CRYf%$%$ local-user r2 service-type ppp

2. 配置串行接口(连接R2,CHAP认证)

原因:R2使用CHAP认证,所以R5需要开启CHAP认证模式

interface Serial3/0/1 link-protocol ppp ppp authentication-mode chap ip address 25.1.1.5 255.255.255.0

3. 配置串行接口(连接R3,无认证)

原因:R3没有配置PPP认证,所以R5这边也不需要认证

interface Serial4/0/0 link-protocol ppp ip address 35.1.1.5 255.255.255.0

4. 配置串行接口(连接R1,PAP认证)

原因:R1使用PAP认证,R5需要开启PAP认证模式

interface Serial4/0/1 link-protocol ppp ppp authentication-mode pap ip address 15.1.1.5 255.255.255.0

5. 配置千兆接口(连接R4)

原因:R4使用以太网连接,不需要PPP认证

interface GigabitEthernet0/0/0 ip address 45.1.1.5 255.255.255.0
6. 配置LoopBack接口

原因:LoopBack是虚拟接口,常用于测试或作为Router ID

interface LoopBack0 ip address 5.5.5.5 255.255.255.0
7. 配置静态路由(指向各分支LAN)

原因:R5需要知道如何到达各分支的内网,所以要配置指向各Spoke的静态路由

ip route-static 192.168.1.0 255.255.255.0 15.1.1.1 ip route-static 192.168.2.0 255.255.255.0 25.1.1.2 ip route-static 192.168.3.0 255.255.255.0 35.1.1.3 ip route-static 192.168.4.0 255.255.255.0 45.1.1.4


R1 配置(分支Spoke)

1. 添加串行接口板

原因:需要添加2SA模块才能使用Serial接口(需要手动添加)

board add 0/4 2SA
2. 配置串行接口(连接R5,PAP认证)

原因:使用PAP认证连接R5,需要配置用户名和密码

interface Serial4/0/0 link-protocol ppp ppp pap local-user R1 password cipher %$%$$Hc6O(#fBQEV!Z#G[lyO,#3W%$%$ ip address 15.1.1.1 255.255.255.0
3. 配置LAN接口(连接PC1)

原因:给PC1提供网关地址

interface GigabitEthernet0/0/0 ip address 192.168.1.1 255.255.255.0
4. 配置GRE点对点隧道(连接R4)

原因:建立R1到R4的直连隧道,绕过R5直接通信

interface Tunnel0/0/0 description 45.1.1.4 ip address 10.1.1.1 255.255.255.0 tunnel-protocol gre source 15.1.1.1

5. 配置GRE P2MP隧道(连接R5)

原因:建立多点GRE隧道,可以与多个分支通过R5互联

interface Tunnel0/0/1 ip address 10.1.2.1 255.255.255.0 tunnel-protocol gre p2mp source 15.1.1.1
6. 配置RIP路由

原因:宣告LAN网段和Tunnel网段,让其他路由器知道如何到达这些网段

rip 1 undo summary version 2 network 192.168.1.0 network 10.0.0.0

7. 配置静态路由

原因:默认路由指向R5保证底层连通,到R4网段的静态路由保证GRE隧道可达

ip route-static 0.0.0.0 0.0.0.0 15.1.1.5 ip route-static 45.1.1.0 255.255.255.0 15.1.1.5


R2 配置(分支Spoke)

1. 添加串行接口板

原因:需要2SA模块提供串行接口(需要手动添加)

board add 0/4 2SA
2. 配置串行接口(连接R5,CHAP认证)

原因:使用CHAP认证,需要配置用户名和密码(CHAP不传密码)

interface Serial4/0/0 link-protocol ppp ppp chap user R2 ppp chap password cipher %$%$%]5\44O$92GyAwW7G\vL,#X<%$%$ ip address 25.1.1.2 255.255.255.0
3. 配置LAN接口(连接PC3)

原因:给PC3提供网关地址

interface GigabitEthernet0/0/0 ip address 192.168.2.1 255.255.255.0
4. 配置GRE P2MP隧道

原因:加入多点GRE隧道网络,通过R5与其他分支互联

interface Tunnel0/0/0 ip address 10.1.2.2 255.255.255.0 tunnel-protocol gre p2mp source 25.1.1.2
5. 配置RIP路由

原因:宣告LAN网段和Tunnel网段

rip 1 undo summary version 2 network 192.168.2.0 network 10.0.0.0

6. 配置默认路由

原因:所有流量都通过R5转发

ip route-static 0.0.0.0 0.0.0.0 25.1.1.5


R3 配置(分支Spoke)

1. 添加串行接口板

原因:需要2SA模块提供串行接口(需要手动添加)

board add 0/4 2SA
2. 配置串行接口(连接R5,无认证)

原因:简化配置,不使用PPP认证

interface Serial4/0/0 link-protocol ppp ip address 35.1.1.3 255.255.255.0
3. 配置LAN接口(连接PC4)

原因:给PC4提供网关地址

interface GigabitEthernet0/0/0 ip address 192.168.3.1 255.255.255.0
4. 配置GRE P2MP隧道

原因:加入多点GRE隧道网络

interface Tunnel0/0/0 ip address 10.1.2.3 255.255.255.0 tunnel-protocol gre p2mp source 35.1.1.3
5. 配置RIP路由

原因:宣告LAN网段和Tunnel网段

rip 1 undo summary version 2 network 192.168.3.0 network 10.0.0.0

6. 配置默认路由

原因:所有流量都通过R5转发

ip route-static 0.0.0.0 0.0.0.0 35.1.1.5


R4 配置(分支Spoke)

1. 配置千兆接口(连接R5)

原因:R4使用以太网连接R5,不需要串行接口板

interface GigabitEthernet0/0/0 ip address 45.1.1.4 255.255.255.0
2. 配置LAN接口(连接PC2)

原因:给PC2提供网关地址

interface GigabitEthernet0/0/1 ip address 192.168.4.1 255.255.255.0
3. 配置GRE点对点隧道(连接R1)

原因:建立R4到R1的直连隧道,destination指向R1的WAN地址

interface Tunnel0/0/0 ip address 10.1.1.2 255.255.255.0 tunnel-protocol gre source 45.1.1.4 destination 15.1.1.1

4. 配置RIP路由

原因:宣告LAN网段和Tunnel网段

rip 1 undo summary version 2 network 192.168.4.0 network 10.0.0.0

5. 配置静态路由

原因:默认路由指向R5,到R1网段的静态路由保证GRE隧道可达

ip route-static 0.0.0.0 0.0.0.0 45.1.1.5 ip route-static 15.1.1.0 255.255.255.0 45.1.1.5


PC配置

PCIP地址子网掩码网关
PC1192.168.1.10255.255.255.0192.168.1.1
PC2192.168.4.10255.255.255.0192.168.4.1
PC3192.168.2.10255.255.255.0192.168.2.1
PC4192.168.3.10255.255.255.0192.168.3.1


关键点总结

1. 配置顺序
  1. 配置接口IP地址
  2. 配置PPP认证(PAP/CHAP)
  3. 配置静态路由(底层互通)
  4. 配置GRE隧道
  5. 配置RIP宣告网段
2. 三种PPP认证对比
认证方式特点配置位置
PAP明文传输密码被认证方配ppp pap local-user,认证方配ppp authentication-mode pap
CHAP挑战-响应机制,密码加密传输,安全性更高被认证方配ppp chap userppp chap password,认证方配ppp authentication-mode chap
无认证不进行身份验证,直接建立PPP连接双方接口只需配置link-protocol ppp,无需认证相关命令

验证: