Pnetlab實戰(zhàn)演練:一步步教你通過SSH安全登陸防火墻!
一、實驗介紹
關(guān)于本次實驗
在網(wǎng)絡維護過程中,網(wǎng)絡管理員通常需要登錄許多設備。通過Console口登錄每臺設備既繁瑣又耗時,而且Telnet遠程登錄設備時傳輸?shù)臄?shù)據(jù)是明文,不夠安全。為了提高安全性,可以在設備上配置SSH功能,使遠程管理員能夠通過SSH方式安全地登錄和管理設備。
實驗目的
通過本實驗,可以掌握配置設備SSH遠程登錄功能的基本方法。
實驗組網(wǎng)介紹
二、實驗規(guī)劃
管理PC使用普通網(wǎng)線連接設備的GE1/0/0 口,管理 PC 通過 PuTTY 軟件遠程登錄設備。
設備 | 端口 | 端口類型 | 地址 |
管理PC | 以太網(wǎng)接口 | 以太網(wǎng)接口 | 10.1.2.100/24 |
防火墻 | GE1/0/0 | 以太網(wǎng)接口 | 10.1.2.1/24 |
三、實驗任務配置
1.配置思路
2.配置步驟
步驟1:通過其他方式登錄到設備上,如Console登錄。
步驟2:在設備上開啟SSH功能
[FW]stelnet server enable
Info: Succeeded in starting the Stelnet server.
步驟3:配置登錄接口。
配置 接口的IP地址用于登錄
[FW]int g1/0/0
[FW-GigabitEthernet1/0/0]ip add 10.1.2.1 24
[FW-GigabitEthernet1/0/0]
完成上述配置命令后,通過display this查看當前配置。如下圖:
配置接口訪問控制功能。
[FW-GigabitEthernet1/0/0]service-manage enable
[FW-GigabitEthernet1/0/0]service-manage ssh permit
配置接口加入安全區(qū)域
[FW]firewall zone trust
[FW-zone-trust]add interface GigabitEthernet 1/0/0
配置安全策略,允許管理PC訪問防火墻的G1/0/0
[FW]security-policy
[FW-policy-security]rule name trus-local
[FW-policy-security-rule-trus-local]source-zone trust
[FW-policy-security-rule-trus-local]destination-zone local
[FW-policy-security-rule-trus-local]action permit
完成上述配置命令后,通過display this查看當前配置。如下圖:
步驟4:配置管理員信息
配置VTY管理員認真方式為AAA:
[FW]user-interface vty 0 4
[FW-ui-vty0-4]authentication-mode aaa
[FW-ui-vty0-4]protocol inbound ssh
[FW-ui-vty0-4]user privilege level 3
創(chuàng)建SSH管理員賬號sshuser,指定認證方式為password,并配置密碼為Admin@123,服務方式為 SSH。
[FW]aaa
[FW-aaa]manager-user sshuser
[FW-aaa-manager-user-sshuser]password cipher Admin@123
[FW-aaa-manager-user-sshuser]service-type ssh
[FW-aaa-manager-user-sshuser]level 3
為管理員綁定角色:
[FW-aaa]bind manager-user sshuser role system-admin
配置SSH用戶。
[FW]ssh user ssh
[FW]ssh user sshuser authentication-type password
[FW]ssh user sshuser service-type stelnet
步驟5:生成本地密鑰對。
[FW]rsa local-key-pair create
The key name will be: FW_Host
The range of public key size is (2048 ~ 2048).
NOTES: If the key modulus is greater than 512,
it will take a few minutes.
Input the bits in the modulus[default = 2048]:
Generating keys...
......+++++
........................++
....++++
...........++
步驟6:登錄設備
在管理PC上配置地址為10.1.2.100/24,運行 PuTTY,填寫設備 SSH 參數(shù),登錄設備。# 選擇Session,Connectiontype協(xié)議選擇SSH,Host Name(or IP address)填寫10.1.2.1,其余參數(shù)按照如圖所示配置。
結(jié)果驗證
點擊步驟6的Open連接,按下回車鍵,輸入用戶名 sshuser,密碼 Admin@123,當PuTTY 界面上出現(xiàn)以下信息時,說明 SSH 登錄設備成功。