Pnetlab實(shí)戰(zhàn)演練:一步步教你通過(guò)SSH安全登陸防火墻!
一、實(shí)驗(yàn)介紹
關(guān)于本次實(shí)驗(yàn)
在網(wǎng)絡(luò)維護(hù)過(guò)程中,網(wǎng)絡(luò)管理員通常需要登錄許多設(shè)備。通過(guò)Console口登錄每臺(tái)設(shè)備既繁瑣又耗時(shí),而且Telnet遠(yuǎn)程登錄設(shè)備時(shí)傳輸?shù)臄?shù)據(jù)是明文,不夠安全。為了提高安全性,可以在設(shè)備上配置SSH功能,使遠(yuǎn)程管理員能夠通過(guò)SSH方式安全地登錄和管理設(shè)備。
實(shí)驗(yàn)?zāi)康?/h4>
通過(guò)本實(shí)驗(yàn),可以掌握配置設(shè)備SSH遠(yuǎn)程登錄功能的基本方法。
實(shí)驗(yàn)組網(wǎng)介紹
二、實(shí)驗(yàn)規(guī)劃
管理PC使用普通網(wǎng)線(xiàn)連接設(shè)備的GE1/0/0 口,管理 PC 通過(guò) PuTTY 軟件遠(yuǎn)程登錄設(shè)備。
設(shè)備 | 端口 | 端口類(lèi)型 | 地址 |
管理PC | 以太網(wǎng)接口 | 以太網(wǎng)接口 | 10.1.2.100/24 |
防火墻 | GE1/0/0 | 以太網(wǎng)接口 | 10.1.2.1/24 |
三、實(shí)驗(yàn)任務(wù)配置
1.配置思路
2.配置步驟
步驟1:通過(guò)其他方式登錄到設(shè)備上,如Console登錄。
步驟2:在設(shè)備上開(kāi)啟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]
完成上述配置命令后,通過(guò)display this查看當(dāng)前配置。如下圖:
配置接口訪(fǎng)問(wèn)控制功能。
[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訪(fǎng)問(wèn)防火墻的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
完成上述配置命令后,通過(guò)display this查看當(dāng)前配置。如下圖:
步驟4:配置管理員信息
配置VTY管理員認(rèn)真方式為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管理員賬號(hào)sshuser,指定認(rèn)證方式為password,并配置密碼為Admin@123,服務(wù)方式為 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用戶(hù)。
[FW]ssh user ssh
[FW]ssh user sshuser authentication-type password
[FW]ssh user sshuser service-type stelnet
步驟5:生成本地密鑰對(duì)。
[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:登錄設(shè)備
在管理PC上配置地址為10.1.2.100/24,運(yùn)行 PuTTY,填寫(xiě)設(shè)備 SSH 參數(shù),登錄設(shè)備。# 選擇Session,Connectiontype協(xié)議選擇SSH,Host Name(or IP address)填寫(xiě)10.1.2.1,其余參數(shù)按照如圖所示配置。
結(jié)果驗(yàn)證
點(diǎn)擊步驟6的Open連接,按下回車(chē)鍵,輸入用戶(hù)名 sshuser,密碼 Admin@123,當(dāng)PuTTY 界面上出現(xiàn)以下信息時(shí),說(shuō)明 SSH 登錄設(shè)備成功。