📜  保护路由协议

📅  最后修改于: 2022-05-13 01:57:02.361000             🧑  作者: Mango

保护路由协议

先决条件 - 路由信息协议 (RIP)、EIGRP 基础知识、OSPF 协议基础知识
路由是第 3 层设备(路由器或第 3 层交换机)在源网络和目标网络之间找到最佳路径的过程。动态路由协议用于减少管理员开销,即管理员必须配置更少,但默认情况下,所有相关方都可以看到所有路由信息,因为它没有加密,因此容易受到攻击。

我们可以通过创建密钥链对其进行身份验证并将其应用于我们发布路由的接口来保护 RIP、EIGRP 和 OSPF 等路由协议。在这里,我们将不讨论协议,而是将身份验证放在 RIP、EIGRP 和 OSPF 上。

1. 路由信息协议 (RIP) –
RIP 是一种距离矢量路由协议,使用端口号 520,管理距离为 120。它是一种应用层协议,有 3 个版本,其中只有一个版本支持身份验证。

配置 -

有 3 个路由器,分别命名为 router1(以太网 0/0 上的 IP 地址 192.168.1.1)、router2(ethernet0/0 上的 IP 地址 192.168.1.2 和 ethernet0/1 上的 192.168.2.1)、router3(IP 地址 192.168.2.2在 ethernet0/0 上)。 router1 将无法 ping router3,因为它没有到 192.168.2.0 网络的路由。为此,我们将在所有路由器上执行 RIP 路由,然后对其进行身份验证。

首先为 RIP 配置 router1:

router1(config)#router rip
router1(config-router)#network 192.168.1.0
router1(config-router)#no auto-summary
router1(config-router)#version 2

现在,为 router2 配置 RIP:

router2(config)#router rip
router2(config-router)#network 192.168.1.0
router2(config-router)#network 192.168.2.0
router2(config-router)#no auto-summary
router2(config-router)#version 2

现在,为 router3 配置 RIP:

router3(config)#router rip
router3(config-router)#network 192.168.2.0
router3(config-router)#no auto-summary 
router3(config-router)#version 2

在这里,我们启用了 RIP 版本 2,因为它支持身份验证。现在,可以从router1(192.168.1.1)Ping router3(192.168.2.2),在所有路由器上一一设置Authentication。首先,制作一个钥匙链并将其应用到界面上:

router1(config)#key chain cisco
router1(config-keychain)#key 1
router1(config-keychain-key)#key-string cisco1
router1(config-keychain-key)#exit
router1(config-keychain)#exit
router1(config)#int ethernet0/0
router1(config-if)#ip rip authentication mode md5
router1(config-if)#ip rip authentication key-chain cisco

在这里,我们创建了一个名为 cisco 的密钥链,其密钥 Id 1 和密钥字符串 cisco1 并将其应用于接口 ethernet0/0(我们在该接口上发布了 RIP)。
现在在 router2 上创建相同的密钥链:

router2(config)#key chain cisco
router2(config-keychain)#key 1
router2(config-keychain-key)#key-string cisco1
router2(config-keychain-key)#exit
router2(config-keychain)#exit
router2(config)#int ethernet0/0
router2(config-if)#ip rip authentication mode md5
router2(config-if)#ip rip authentication key-chain cisco

注意 -密钥链的配置,它的 I'd 和 key-string 在两个路由器上应该是相同的。

2. 增强的内部网关路由协议——
EIGRP 是一种高级距离路由协议,使用协议号 88,管理距离为 90。它是一种支持明文和 md5 身份验证的网络层协议。

配置 -

采用相同的拓扑结构,有 3 个路由器命名为 router1(ethernet0/0 上的 IP 地址 192.168.1.1)、router2(ethernet0/0 上的 IP 地址 192.168.1.2 和 ethernet0/1 上的 192.168.2.1)、router3(IP 地址-192.168.2.2 在 ethernet0/0 上)。在这里,路由器 1 也无法 ping 路由器 3,因为它没有到 192.168.2.0 网络的路由。为此,我们将在所有路由器上执行 EIGRP 路由,然后对其进行身份验证。

在路由器 1 上配置 EIGRP:

router1(config)#router eigrp 100
router1(config-router)#network 192.168.1.0
router1(config-router)#no auto-summary

这里使用了自治系统编号 100。
在 router2 上配置 EIGRP:

router2(config)#router EIGRP 100
router2(config-router)#network 192.168.1.0
router2(config-router)#network 192.168.2.0
router2(config-router)#no auto-summary

在 router3 上配置 EIGRP:

router3(config)#router eigrp 100
router3(config-router)#network 192.168.2.0
router3(config-router)#no auto-summary

现在,使用 eigrp 对路由器进行身份验证。

router1(config)#key chain cisco
router1(config-keychain)#key 1
router1(config-keychain-key)#key-string cisco1
router1(config-keychain-key)#exit
router1(config-keychain)#exit
router1(config)#int ethernet0/0
router1(config-if)#ip authentication mode eigrp 100 md5
router1(config-if)#ip authentication key-chain eigrp 100 cisco

在router2上配置相同:

router2(config)#key chain cisco
router2(config-keychain)#key 1
router2(config-keychain-key)#key-string cisco1
router2(config-keychain-key)#exit
router2(config-keychain)#exit
router2(config)#int ethernet0/0
router2(config-if)#ip authentication mode eigrp 100 md5
router2(config-if)#ip authentication key-chain eigrp 100 cisco

注意 -密钥链的配置,它的 Id 和密钥字符串在两个路由器上应该是相同的。

3. 开放最短路径优先 (OSPF) –
OSPF 是一种链路状态路由协议,使用协议号 89 和管理距离 110。它是一种支持明文和 md5 身份验证的网络层协议。

配置 -

采用相同的拓扑结构,有 3 个路由器,分别命名为 router1(ethernet0/0 上的 IP 地址为 192.168.1.1)、router2(ethernet0/0 上的 IP 地址为 192.168.1.2 和 ethernet0/1 上的 192.168.2.1)、router3(IP 地址-192.168.2.2 在 ethernet0/0 上)。为此,我们将在所有路由器上执行 OSPF 路由,然后对其进行身份验证。
在 router1 上配置 OSPF:

router1(config)#router ospf 1
router1(config-router)#network 192.168.1.0 0.0.0.255 area 0

在 router2 上配置 OSPF:

router2(config)#router ospf 1
router2(config-router)#network 192.168.1.0 0.0.0.255 area 0
router2(config-router)#network 192.168.2.0 0.0.0.255 area 0

在 router3 上配置 ospf:

router3(config)#router OSPF 1
router2(config-router)#network 192.168.2.0 0.0.0.255 area 0

在 router1 上配置身份验证:

router1(config)#key chain cisco
router1(config-keychain)#key 1
router1(config-keychain-key)#key-string cisco1
router1(config-keychain-key)#exit
router1(config-keychain)#exit
router1(config)#int ethernet0/0
router1(config-if)#ip ospf Authentication message-digest
router1(config-if)#ip ospf authentication-key cisco1

在 router2 上配置身份验证:

router2(config)#key chain cisco
router2(config-keychain)#key 1
router2(config-keychain-key)#key-string cisco1
router2(config-keychain-key)#exit
router2(config-keychain)#exit
router2(config)#int ethernet0/0
router2(config-if)#ip ospf authentication message-digest
router2(config-if)#ip ospf authentication-key cisco1

笔记 -

  • 密钥链的配置,它的 Id 和 key-string 在两个路由器上应该是相同的。
  • Md5 容易受到暴力攻击,因此建议使用包含数字或特殊字符的密码,且密码应较长。