一、認證
1.分類:CHAP認證、PAP認證
2.認證條件:(1)雙方的封裝類型必須一致,封裝類型必須為:PPP
(2)雙方的Password必須相同
3.認證優(yōu)點:安全
4.認證方式:point to point(點到點)
二、實驗
(一)【實驗名稱】CHAP認證
【實驗設備】兩臺CISCO 7200 路由器
【實驗目標】將兩臺CISCO 7200 路由器設置CHAP認證,只有雙方設置一樣的密碼,一
樣的封裝方式,才能夠Ping。
【實驗拓撲】
【實驗步驟】(一)給R1,R2各端口設置IP
1.R1
rack01(config)#int s1/0
rack01(config-if)#ip add 199.99.1.1 255.255.255.0
rack01(config-if)#no shut
rack01(config)#int loop 0
rack01(config-if)#ip add 1.1.1.1 255.255.255.0
2.R2
rack02(config)#int s1/0
rack02(config-if)#ip add 199.99.1.2 255.255.255.0
rack02(config-if)#no shu
rack01(config)#int loop 0
rack01(config-if)#ip add 2.2.2.2 255.255.255.0
(二)設置路由,讓R1,R2各端口都能互相通信
1.R1
rack01(config-if)#router eigrp 100
rack01(config-router)#network 199.99.1.0
2.R2
rack02(config-if)#router eigrp 100
rack02(config-router)#network 199.99.1.0
(三)設置CHAP認證
1.R1
rack01(config)#username rack2 password cisco !設置password為cisco
rack01(config)#int s1/0
rack01(config-if)#encapsulation ppp !設置封裝方式為PPP
rack01(config-if)#ppp authentication chap !設置CHAP認證
注:此時在R2沒有設置CHAP認證,因此現(xiàn)在就不能Ping通R2了
測試結果:
rack01#ping 199.99.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 199.99.1.2, timeout is 2 seconds:
..... 表示沒有Ping通
現(xiàn)在下面給R2設置CHAP認證,查看結果
2.R2
rack02(config)#username rack01 password cisco
rack02(config)#int s1/0
rack02(config-if)#encapsulation ppp
rack02(config-if)#ppp authentication chap
測試結果:
rack01#ping 199.99.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 199.99.1.2, timeout is 2 seconds:
!!!!! 此時就能夠Ping通R2了
(二)【實驗名稱】RIP認證+RIP匯總
【實驗設備】兩臺CISCO 7200 系列路由器
【實驗目標】(1)在R1和R2上設置RIP認證
(2)在R1和R2上設置RIP匯總,以節(jié)省路由表資源
(3)利用ACL功能禁止某些IP訪問
【實驗拓撲】
【實驗步驟】(一)給R1和R2各端口設置IP
1.R1
rack01(config)#int loop 0
rack01(config-if)#ip add 1.1.1.1 255.255.255.0
rack01(config)#int loop 1
rack01(config-if)#ip add 1.1.2.1 255.255.255.0
rack01(config-if)#int loop 2
rack01(config-if)#ip ad 3.3.1.1 255.255.255.0
rack01(config)#int s1/0
rack01(config-if)#ip add 199.99.1.1 255.255.255.0
rack01(config-if)#no shut
2.R2
rack02(config-if)#int loop 0
rack02(config-if)#ip add 2.2.1.1 255.255.255.0
rack02(config-if)#int loop 1
rack02(config-if)#ip add 2.2.2.1 255.255.255.0
rack02(config-if)#int loop 2
rack02(config-if)#ip add 2.2.3.1 255.255.255.0
rack02(config-if)#int loop 3
rack02(config-if)#ip add 2.2.4.1 255.255.255.0
rack02(config-if)#int s1/0
rack02(config-if)#ip add 199.99.1.2 255.255.255.0
rack02(config-if)#no shut
(二)在R1和R2上設置RIP路由
1.R1
rack01(config)#router rip
rack01(config-router)#no auto-summary
rack01(config-router)#ver 2
rack01(config-router)#network 199.99.1.0
rack01(config-router)#network 1.1.1.0
rack01(config-router)#network 1.1.2.0
rack01(config-router)#network 3.3.1.0
2.R2
rack02(config)#router rip
rack02(config-router)#no auto-summary
rack02(config-router)#ver 2
rack02(config-router)#network 199.99.1.0
rack02(config-router)#network 2.2.1.0
rack02(config-router)#network 2.2.2.0
rack02(config-router)#network 2.2.3.0
rack02(config-router)#network 2.2.4.0
測試結果:
rack01#show ip route !查看rack01的路由表
1.0.0.0/24 is subnetted, 2 subnets
C(直連路由) 1.1.1.0 is directly connected, Loopback0
C 1.1.2.0 is directly connected, Loopback2
2.0.0.0/24 is subnetted, 4 subnets
R 2.2.1.0 [120/1] via 199.99.1.2, 00:00:03, Serial1/0
學到了rack02的四條RIP路由 |
R 2.2.2.0 [120/1] via 199.99.1.2, 00:00:03, Serial1/0
R 2.2.3.0 [120/1] via 199.99.1.2, 00:00:03, Serial1/0
R 2.2.4.0 [120/1] via 199.99.1.2, 00:00:03, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.1.0 is directly connected, Loopback1
C 199.99.1.0/24 is directly connected, Serial1/0
查看rack02的路由表
rack02#show ip route !學到了rack01的三條RIP路由
1.0.0.0/24 is subnetted, 2 subnets
R 1.1.1.0 [120/1] via 199.99.1.1, 00:00:02, Serial1/0
R 1.1.2.0 [120/1] via 199.99.1.1, 00:00:02, Serial1/0
2.0.0.0/24 is subnetted, 4 subnets
C 2.2.1.0 is directly connected, Loopback0
C 2.2.2.0 is directly connected, Loopback1
C 2.2.3.0 is directly connected, Loopback2
C 2.2.4.0 is directly connected, Loopback3
3.0.0.0/24 is subnetted, 1 subnets
R 3.3.1.0 [120/1] via 199.99.1.1, 00:00:02, Serial1/0
C 199.99.1.0/24 is directly connected, Serial1/0
(三)在R1和R2上設置RIP認證
1.R1
rack01(config)#key chain cisco !設置名稱為cisco
rack01(config-keychain)#key 1
rack01(config-keychain-key)#key-string 1234 !設置密碼為1234
rack01(config-keychain-key)#int s1/0
rack01(config-if)#ip rip authentication mode text !設置加密方式為text(明文加密)
rack01(config-if)#ip rip authentication key cisco
注:此時只在R1設置了RIP認證,因此現(xiàn)在是不能Ping通R2的
查看測試結果:
rack01#ping
Target IP address: 2.2.2.1 目標地址
Extended commands [n]: y
Source address or interface: 1.1.1.1 源地址
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.1, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
..... 表示Ping不通
下面在R2上設置RIP認證
2.R2
rack02(config)#key chain cisco !設置名稱為cisco
rack02(config-keychain)#key 1
rack02(config-keychain-key)#key-string 1234 !設置密碼為1234
rack02(config-keychain-key)#int s1/0
rack02(config-if)#ip rip authentication mode text !設置加密方式為text(明文加密)
rack02(config-if)#ip rip authentication key cisco
查看測試結果:
rack02#ping
Target IP address: 1.1.1.1 目標地址
Extended commands [n]: y
Source address or interface: 2.2.2.1 源地址
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!! 已經(jīng)可以Ping通了
(四)RIP匯總
1.R1
rack01(config)#int s1/0
rack01(config-if)#ip summary-address rip 1.1.0.0 255.255.252.0
!將LOOP口的所有IP匯總成1.1.0.0這個網(wǎng)段,它表示LOOP口里所有IP
2.R2
rack02(config)#int s1/0
rack02(config-if)#ip summary-address rip 2.2.0.0 255.255.248.0
!將LOOP口的所有IP匯總成2.2.0.0這個網(wǎng)段,它表示LOOP口里所有IP
查看匯總后的R1和R2的路由表有什么變化:
rack01#show ip route
1.0.0.0/24 is subnetted, 2 subnets
C 1.1.1.0 is directly connected, Loopback0
C 1.1.2.0 is directly connected, Loopback2
2.0.0.0/21 is subnetted, 1 subnets
R 2.2.0.0 [120/1] via 199.99.1.2, 00:00:12, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.1.0 is directly connected, Loopback1
C 199.99.1.0/24 is directly connected, Serial1/0
rack02#sho ip route
1.0.0.0/22 is subnetted, 1 subnets
R 1.1.0.0 [120/1] via 199.99.1.1, 00:00:15, Serial1/0
2.0.0.0/24 is subnetted, 4 subnets
C 2.2.1.0 is directly connected, Loopback0
C 2.2.2.0 is directly connected, Loopback1
C 2.2.3.0 is directly connected, Loopback2
C 2.2.4.0 is directly connected, Loopback3
3.0.0.0/24 is subnetted, 1 subnets
R 3.3.1.0 [120/1] via 199.99.1.1, 00:00:15, Serial1/0
C 199.99.1.0/24 is directly connected, Serial1/0
(五)利用標準ACL阻止rack01上的3.3.0.1訪問rack02
1.在R2上設置標準ACL
rack02(config)#access-list 10 deny 3.3.1.0 0.0.0.255
rack02(config)#access-list 10 permit any
現(xiàn)在在rack01上的3.3.1.1 Ping還是可以Ping通rack02里的地址,因為rack02有一個刷新路由表的時間,這個時間是30秒,當超過180秒(RIP的Holdown時間)的時候,路由表就視為3.3.1.0網(wǎng)段不可達了,在過了這180秒以后,3.3.1.1就不能夠Ping通rack02上的地址了。
現(xiàn)在看一下測試結果(180秒以后):
rack01#ping
Target IP address: 2.2.2.1 目標地址
Source address or interface: 3.3.1.1 源地址
Sending 5, 100-byte ICMP Echos to 2.2.2.1, timeout is 2 seconds:
Packet sent with a source address of 3.3.1.1
.....
Success rate is 0 percent (0/5)
現(xiàn)在可以看一下rack02上的路由表:
rack02#show ip route
1.0.0.0/22 is subnetted, 1 subnets
R 1.1.0.0 [120/1] via 199.99.1.1, 00:00:14, Serial1/0 !R1的網(wǎng)段
2.0.0.0/24 is subnetted, 4 subnets
C 2.2.1.0 is directly connected, Loopback0
C 2.2.2.0 is directly connected, Loopback1
C 2.2.3.0 is directly connected, Loopback2
C 2.2.4.0 is directly connected, Loopback3
C 199.99.1.0/24 is directly connected, Serial1/0
總結:從上面路由表中可以看出rack02路由表中已經(jīng)過濾掉了3.3.1.0網(wǎng)段的信息
以上是RIP的認證,下面為OSPF骨干區(qū)域的認證。
(六)OSPF的認證
只將RIP認證的步驟(三)改成OSPF的三條命令就可以了
1.Text(明文加密)
router(config)#router osfp 100
router(config)#area 0 authentication
router(config)#int s1/0 !進入某個端口
router(config-if)#ip ospf authentication-key ******(密碼)
2.MD5(密文加密)
router(config)#router osfp 100
router(config)#area 0 authentication message-digest
router(config)#int s1/0
router(config-if)#ip ospf authentication message-digest
router(config-if)#ip ospf message-digest-key + 號碼 md5 + ***(密碼)
!號碼:可以任意