路由器的基本配置
拓撲結(jié)構(gòu)圖
信息表
設(shè)備 | 端口IP | 網(wǎng)關(guān) |
---|---|---|
R1 | g0/0 10.1.1.254/24 | |
R1 | s0/0/0 20.1.1.1/24 | |
R2 | s0/0/0 20.1.1.2/24 | |
S1 | vlan1 10.1.1.200/24 | 10.1.1.254 |
PC1 | 10.1.1.1 | 10.1.1.254 |
路由器R1的基本配置信息
Router>enable 進入特權(quán)模式
Router#disable 退回用戶模式
Router>enable
Router#configure terminal進入全局配置模式
Router(config)#hostname R1 修改路由器主機名
R1(config)#no ip domain-lookup 關(guān)閉DNS解析
R1(config)#enable password cisco 配置從用戶模式進入特權(quán)模式的密碼
R1(config)#enable secret cisco123 配置從用戶模式進入特權(quán)模式的密碼,配置該命令,上面一條不生效
R1(config)#banner motd #welcome!# 配置當(dāng)日消息
R1(config)#line console 0 進入控制臺
R1(config-line)#logging synchronous 日志同步
R1(config-line)#exec-timeout 0 超時時間為0,不清除線路
R1(config-line)#password cisco 配置從控制臺配置路由器時的密碼
R1(config-line)#login 配置登陸
R1(config-line)#exit exit逐層退出,end直接退到特權(quán)模式
R1(config)#line vty 0 4 配置虛擬終端,使得可以通過telnet或者ssh遠程登錄路由器或者交換機等
R1(config-line)#password cisco 配置telnet或者ssh遠程登陸的密碼
R1(config-line)#login
R1(config-line)#privilege level 15配置登錄設(shè)備后的級別,15級直接進入特權(quán)模式,默認(rèn)是1級,可以通過命令show privilege查看當(dāng)前的特權(quán)級別
R1(config-line)#exit
R1(config)#service password-encryption 配置密碼加密服務(wù),取消后,被加密的密碼不會恢復(fù)到明文,但是后續(xù)配置的密碼將是明文
R1(config)#interface gigabitEthernet 0/0 進入以太網(wǎng)接口
R1(config-if)#ip address 10.1.1.254 255.255.255.0 配置IP地址
R1(config-if)#no shutdown開啟接口,可以通過show interface查看接口信息
R1(config-if)#exit
R1(config)#exit
R1#copy running-config startup-config 保存配置文件到nvram,和write命令一樣。
修改主機名
Router>enable 進入特權(quán)模式
Router#disable 退回用戶模式
Router>enable
Router#configure terminal進入全局配置模式
Router(config)#hostname R1 修改路由器主機名
關(guān)閉DNS解析
R1(config)#no ip domain-lookup 關(guān)閉DNS解析
配置密碼等級級別
R1(config)#enable password cisco 配置從用戶模式進入特權(quán)模式的密碼
R1(config)#enable secret cisco123 配置從用戶模式進入特權(quán)模式的密碼,配置該命令,上面一條不生效
R1(config)#banner motd #welcome!# 配置當(dāng)日消息
R1(config)#line console 0 進入控制臺
R1(config-line)#logging synchronous 日志同步
R1(config-line)#exec-timeout 0 超時時間為0,不清除線路
R1(config-line)#password cisco 配置從控制臺配置路由器時的密碼
R1(config-line)#login 配置登陸
R1(config-line)#exit exit逐層退出,end直接退到特權(quán)模式
R1(config)#line vty 0 4 配置虛擬終端,使得可以通過telnet或者ssh遠程登錄路由器或者交換機等
R1(config-line)#password cisco 配置telnet或者ssh遠程登陸的密碼
R1(config-line)#login
R1(config-line)#privilege level 15配置登錄設(shè)備后的級別,15級直接進入特權(quán)模式,默認(rèn)是1級,可以通過命令show privilege查看當(dāng)前的特權(quán)級別
R1(config-line)#exit
R1(config)#service password-encryption 配置密碼加密服務(wù),取消后,被加密的密碼不會恢復(fù)到明文,但是后續(xù)配置的密碼將是明文
配置以太網(wǎng)接口IP
R1(config)#interface gigabitEthernet 0/0 進入以太網(wǎng)接口
R1(config-if)#ip address 10.1.1.254 255.255.255.0 配置IP地址
R1(config-if)#no shutdown開啟接口,可以通過show interface查看接口信息
R1(config-if)#exit
R1(config)#exit
R1#copy running-config startup-config 保存配置文件到nvram,和write命令一樣。
交換機S1的配置信息
Switch(config)#hostname S1
S1(config)#interface vlan 1 創(chuàng)建SVI接口,默認(rèn)VLAN1對應(yīng)的接口就存在
S1(config-if)#ip address 10.1.1.200 255.255.255.0 配置IP地址,用于遠程管理交換機
S1(config-if)#no shutdown 開啟SVI接口
S1(config)#ip default-gateway 10.1.1.254 配置默認(rèn)網(wǎng)關(guān),用于外網(wǎng)管理該交換機
修改主機名
Switch(config)#hostname S1
配置vlan1的ip和網(wǎng)關(guān)信息
S1(config)#interface vlan 1 創(chuàng)建SVI接口,默認(rèn)VLAN1對應(yīng)的接口就存在
S1(config-if)#ip address 10.1.1.200 255.255.255.0 配置IP地址,用于遠程管理交換機
S1(config-if)#no shutdown 開啟SVI接口
S1(config)#ip default-gateway 10.1.1.254 配置默認(rèn)網(wǎng)關(guān),用于外網(wǎng)管理該交換機
PC機配置及驗證
在PC機配置:IP地址:10.1.1.1,子網(wǎng)掩碼:255.255.255.0
進入PC機命令提示行:
telnet到路由器:telnet 10.1.1.254進行連接
telnet到交換機:telnet 10.1.1.200進行連接(前提是配置交換機vty密碼和特權(quán)模式密碼)
配置IP
telnet
交換機
并未配置交換機的vty密碼和特權(quán)密碼 但pc和交換機是連通的
路由器
串口配置信息
配置R1:
R1(config)#int s0/0/0
R1(config-if)#ip add 20.1.1.1 255.255.255.0
R1(config-if)#no sh
配置R2:
Router>enable
Router#configure terminal
Router(config)#hostname R2
R2(config)#int s0/0/0
R2(config-if)#ip add 20.1.1.2 255.255.255.0
R2(config-if)#clock rate 128000
R2(config-if)#no shutdown
用ping測試連通性。
R1
R1(config)#int s0/0/0
R1(config-if)#ip add 20.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R2
Router>enable
Router#configure terminal
Router(config)#hostname R2
R2(config)#int s0/0/0
R2(config-if)#ip add 20.1.1.2 255.255.255.0
R2(config-if)#clock rate 128000
R2(config-if)#no shutdown
測試連通性
調(diào)試命令
Show startup-config 顯示NVRAM中的啟動配置文件
Show running-config 顯示RAM中的當(dāng)前配置信息
Show version 顯示系統(tǒng)硬件的配置,軟件的版本,
配置文件的名稱和來源及引導(dǎo)映像
Show ip interface brief查看接口的信息摘要
show clock:顯示路由器的時間設(shè)置。
show history:顯示鍵入過的命令歷史列表。
show flash:顯示flash存儲器信息以及存儲器中的IOS映象文件。
show arp:顯示路由器的地址解析協(xié)議列表。
show license feature :查看license信息
文章來源:http://www.zghlxwxcb.cn/news/detail-504914.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-504914.html
到了這里,關(guān)于思科路由器的基本配置的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!