- 拓撲
- 地址表
| Device |
interface |
IP Address |
Subnet mask |
Default Gateway |
| R1 |
F 0/0 |
172.20.1.1 |
/24 |
N/A |
| S0/0/0 |
10.20.1.1 |
/24 |
N/A |
|
| R2 |
S0/0/0 |
10.20.1.2 |
/24 |
N/A |
| S0/0/1 |
10.20.2.2 |
/24 |
N/A |
|
| R3 |
F 0/0 |
172.20.1.1 |
/24 |
N/A |
| S0/0/1 |
10.20.2.1 |
/24 |
N/A |
|
| PC-A |
Fa0 |
172.20.1.2 |
/24 |
172.20.1.1 |
| PC-C |
Fa0 |
172.20.2.2 |
/24 |
172.20.2.1 |
- 接口配置
(1)采用靜態路由將網絡做通(以R1為例)
Router#configure terminal
Router(config)#interface FastEthernet0/0
Router(config-if)#no shutdown
Router(config-if)#ip address 172.20.1.1 255.255.255.0
Router(config-if)#exit
Router(config)#interface Serial0/0/0
Router(config-if)#no shutdown
Router(config-if)#ip address 10.20.1.1 255.255.255.0
Router(config)#hostname R1
R1(config)#ip route 10.20.2.0 255.255.255.0 10.20.1.2
R1(config)#ip route 172.20.2.0 255.255.255.0 10.20.1.2
(2)ping測試
說明:PC-A和PC-C之間能ping通,PC-A和路由器之間也能ping通,全網互通。
- 路由器預配置
(1)啟用密碼
R3(config)# username zhua password zjwa //用戶名和密碼
R3(config)# aaa new-model //console登入本地數據庫使用配置AAA認證
R3(config)# aaa authentication login default local
R3(config)# line console 0
R3(config-line)# login authentication default
驗證用戶EXEC登入使用本地數據庫

說明:用戶登陸成功。
(2)Vty行接入本地AAA認證
R3(config)# aaa authentication login ZTE local
R3(config)# line vty 0 4
R3(config-line)# login authentication ZTE
R3(config-line)# end
驗證Telnet配置

說明:telnet登錄成功
- 阻隔外網流量
(1)在R3配置一個命名IP ACl阻隔所有外網產生的流量。
R3(config)#ip access-list extended OUT-IN
R3(config-ext-nacl)# deny ip any any
R3(config-ext-nacl)# exit
(1)在s0/0/1應用ACl
R3(config)# interface s0/0/1
R3(config-if)# ip access-group OUT-IN in
(2)確保進入s0/0/1接口的流量被阻隔

說明:PC-C ping PC-A被ACL阻隔。
- 創建一個CBAC檢測規則
(1)創建一個檢測規則來檢測ICMP,Telnet,和HTTP流量
R3(config)#ip inspect name IN-OUT-IN icmp
R3(config)#ip inspect name IN-OUT-IN telnet
R3(config)#ip inspect name IN-OUT-IN http
(2)開啟時間戳記記錄和CBAC審計跟蹤信息。
R3(config)#ip inspect audit-trail
R3(config)#service timestamps debug datetime msec
R3(config)#logging host 172.20.2.2
(3)在s0/0/1的出口流量應用檢測規則
R3(config-if)# ip inspect IN-OUT-IN out
(4)驗證審計跟蹤信息正被syslog服務器記錄
在PC-C 成功ping、telnet訪問PC-A來檢測連通性。

在PC-A,ping,Telnet PC-C來檢測連通性
說明:驗證完成,連通性完好。就此基於上下文訪問控制協議實驗配置完成。
