『壹』 思科路由器配置命令一覽表
思科路由器常用配置命令一覽表:
1、Exec commands:
<1-99> 恢復一個會話
bfe 手工應急模式設置
clear 復位功能
clock 管理系統時鍾
configure 進入設置模式
connect 打開一個終端
從tftp伺服器拷貝設置文件或把設置文件拷貝到tftp伺服器上
debug 調試功能
disable 退出優先命令狀態
disconnect 斷開一個網路連接
enable 進入優先命令狀態
erase 擦除快閃內存
exit 退出exce模式
help 交互幫助系統的描述
lat 打開一個本地傳輸連接
lock 鎖定終端
login 以一個用戶名登錄
logout 退出終端
mbranch 向樹形下端分支跟蹤多路由廣播
mrbranch 向樹形上端分支跟蹤反向多路由廣播
name-connection 給一個存在的網路連接命名
no 關閉調試功能
pad 打開X.29 PAD連接
ping 發送回顯信息
ppp 開始點到點的連接協議
reload 停機並執行冷啟動
resume 恢復一個活動的網路連接
rlogin 打開遠程注冊連接
rsh 執行一個遠端命令
send 發送信息到另外的終端行
setup 運行setup命令
show 顯示正在運行系統信息
slip 開始SLIP協議
start-chat 在命令行上執行對話描述
systat 顯示終端行的信息
telnet 遠程登錄
terminal 終端行參數
test 測試子系統內存和埠
tn3270 打開一個tin3270連接
trace 跟蹤路由到目的地
undebug 退出調試功能
verify 驗證檢查閃爍文件的總數
where 顯示活動的連接
which-route 執行OSI路由表查找並顯示結果
write 把正在運行的設置寫入內存、網路、或終端
x3 在PAD上設置X.3參數
xremote 進入xremote模式
2、#show ?
access-expression 顯示訪問控製表達式
access-lists 顯示訪問控製表
apollo Apollo 網路信息
appletalk Apple Talk 信息
arap 顯示Appletalk 遠端通道統計
arp 地址解析協議表
async 訪問路由介面的終端行上的信息
bridge 前向網路資料庫
buffers 緩沖池統計
clns CLNS網路信息
clock 顯示系統時鍾
cmns 連接模式網路服務信息
compress 顯示壓縮狀態
configuration 非易失性內存的內容
controllers 埠控制狀態
debugging 調試選項狀態
decnet DEC網路信息
dialer 撥號參數和統計
dnsix 顯示Dnsix/DMPP信息
entry 排隊終端入口
extended 擴展埠信息
flash 系統閃爍信息
flh-log 閃爍裝載幫助日誌緩沖區
frame-relay 幀中繼信息
history 顯示對話層歷史命令
hosts IP域名,查找方式,名字服務,主機表
interfaces 埠狀態和設置
ip IP信息
ipx Novell IPX信息
isis IS-IS路由信息
keymap 終端鍵盤映射
lat DEC LAT信息
line 終端行信息
llc2 IBM LLC2 環路信息
lnm IBM 局網管理
local-ack 本地認知虛環路
memory 內存統計
netbios-cache NetBios命名緩沖存貯器內存
node 顯示已知LAT節點
ntp 網路時間協議
processes 活動進程統計
protocols 活動網路路由協議
queue 顯示隊列內容
queueing 顯示隊列設置
registry 功能注冊信息
rhosts 遠程主機文件
rif RIF存貯器入口
route-map 路由器信息
sdlle 顯示sdlc-llc2轉換信息
services 已知LAT服務
sessions 遠程連接信息
smds SMDS信息
source-bridge 源網橋參數和統計
spanning-tree 跨越樹形拓樸
stacks 進程堆棧應用
standby 熱支持協議信息
stun STUN狀態和設置
subsystem 顯示子系統
tcp TCP連接狀態
terminal 顯示終端設置
tn3270 TN3270 設置
translate 協議轉換信息
ttycap 終端容易表
users 顯示終端行的信息
version 系統硬、軟體狀態
vines VINES信息
whoami 當前終端行信息
x25 X.25信息
xns XNS信息
xermote Xremote統計
3、#config ?
Memory 從非易失性內存設置
Network 從TFTP網路主機設置
Overwrite-network 從TFTP網路主機設置覆蓋非易失性內存
Terminal 從終端設置
4、Configure commads:
Access-list 增加一個訪問控制域
Apollo Apollo全局設置命令
appletalk Appletalk 全局設置命令
arap Appletalk遠程進出協議
arp 設置一個靜態ARP入口
async-bootp 修改系統啟動參數
autonomous-system 本地所擁有的特殊自治系統成員
banner 定義注冊顯示信息
boot 修改系統啟動時參數
bridge 透明網橋
buffers 調整系統緩沖池參數
busy-message 定義當連接主機失敗時顯示信息
chat-script 定義一個數據機對話文本
clns 全局CLNS設置子命令
clock 設置時間時鍾
config-register 定義設置寄存器
decnet 全局DEC網路設置子命令
default-value 預設字元位值
dialer-list 創建一個撥號清單入口
dnsix-nat 為審計提供DMDM服務
enable 修改優先命令口令
end 從設置模式退出
exit 從設置模式退出
frame-relay 全局幀中繼設置命令
help 交互幫助系統的描述
hostname 設置系統網路名
iterface 選擇設置的埠
ip 全局地址設置子命令
ipx Novell/IPX全局設置命令
keymap 定義一個新的鍵盤映射
lat DEC本地傳輸協議
line 設置終端行
lnm IBM局網管理
locaddr-priority-list 在LU地址上建立優先隊列
logging 修改注冊(設備)信息
login-string 定義主機指定的注冊字元串
map-class 設置靜態表類
map-list 設置靜態表清單
menu 定義用戶介面菜單
mop 設置DEC MOP伺服器
netbios NETBIOS通道控制過濾
no 否定一個命令或改為預設設置
ntp 設置NTP
priority-list 建立特權列表
prompt 設置系統提示符
queue-list 建立常規隊列列表
rcmd 遠程命令設置命令
rcp-enable 打開Rep服務
rif 源路由進程
router-map 建立路由表或進入路由表命令模式
router 打開一個路由進程
rsh-enable 打開一個RSH服務
sap-priority-list 在SAP或MAC地址上建立一個優先隊列
service 修改網路基本服務
snmp-server 修改SNMP參數
state-machine 定義一個TCP分配狀態的機器
stun STUN全局設置命令
tacacs-server 修改TACACS隊列參數
terminal-queue 終端隊列命令
tftp-server 為網路裝載請求提供TFTP服務
tn3270 tn3270設置命令
translate 解釋全局設置命令
username 建立一個用戶名及其許可權
vines VINES全局設置命令
x25 X.25 的第三級
x29 X.29 命令
xns XNS 全局設置命令
xremote 設置Xremote
5、(config)#ip
Global IP configuration subcommands:
Accounting-list 選擇保存IP記帳信息的主機
Accounting-threshold 設置記帳入口的最大數
accounting-transits 設置通過入口的最大數
alias TCP埠的IP地址取別名
as-path BGP自治系統路徑過濾
cache-invalidate-delay 延遲IP路由存貯池的無效
classless 跟隨無類前向路由規則
default-network 標志網路作為預設網關候選
default-gateway 指定預設網(如果沒有路由IP)
domain-list 完成無資格主機的域名
domain-lookup 打開IP域名服務系統主機轉換
domain-name 定義預設域名
forward-protocol 控制前向的、物理的、直接的IP廣播
host 為IP主機表增加一個入口
host-routing 打開基於主機的路由(代理ARP和再定向)
hp-host 打開HP代理探測服務
mobile-host 移動主機資料庫
multicast-routing 打開前向IP
name-server 指定所用名字伺服器的地址
ospf-name-lookup 把OSPF路由作為DNS名顯示
pim PIM 全局命令
route 建立靜態路由
routing 打開IP路由
security 指定系統安全信息
source-route 根據源路由頭的選擇處理包
subnet-zero 允許子網0子網
tcp 全局TCP參數
『貳』 Cisco交換機VLAN與TRUNK鏈路配置命令
你還在為Cisco交換機VLAN與TRUNK鏈路配置命令而煩惱么?不用擔心,接下來是我為大家收集的Cisco交換機VLAN與TRUNK鏈路配置命令,歡迎大家閱讀:
Cisco交換機VLAN與TRUNK鏈路配置命令的方法
在2950系列交換機上配置VLAN
(1)使用vlan database命令進入VLAN配置模式
C2950A#vlan database
(2)創建VLAN
C2950A(vlan)#vlan 2
(3)劃分VLAN(將交換機的2-14,23埠劃入VLAN 2)
C2950(config)#interface range f0/2-14
C2950(config-if-range)#switchport mode access
C2950(config-if-range)#switchport access vlan 2
C2950(config)#interface f0/3
C2950(config-if)#switchport mode access
C2950(config-if)#switchport access vlan 2
(4)查看vlan信息
C2950#show vlan
(5) 刪除配置(刪除VLAN 100下的埠)
C2950(config)#interface range f0/2-14
C2950(config-if-range)#no switchport access vlan 2
配置Trunk的過程:
(1) 選擇需要的介面,進入介面配置模式
Switch(config)# interface f0/24
(2) 在介面配置模式下直接配置中繼
Switch (config-if)#switchport mode trunk
(3) 添加VLAN(VID)
Switch (config-if)#switchport trunk allowed vlan all
看了“Cisco交換機VLAN與TRUNK鏈路配置命令”還想看:
1. 思科交換機配置命令教程
2. 2015年網路工程師學習筆記:交換機及其配置
3. cisco交換機怎麼配置vlan與trunk
4. 思科交換機配置教程詳解
5. 交換機如何配置vlan及turnk口
6. h3c交換機配置命令詳細解釋
7. 華為交換機配置的命令有哪些
『叄』 cisco基本配置命令
Cisco 的交換機產品以「Catalyst 」為商標,包含1900 、2800 、2900 、3500 、4000 、5000 、5500 、6000 、8500 等十多個系列。
基本配置命令如下:
1、Switch>enable 進入特權模式
2、Switch #config terminal 進入全局配置模式
3、Switch(config)#hostname 設置交換機的主機名
4、Switch(config)#enable password 進入特權模式的密碼(明文形式保存)
5、Switch(config)#enablesecret 加密密碼(加密形式保存) (優先)
6、Switch(config)#ipdefault-gateway 配置交換機網關
7、Switch(config)#showmac-address-table 查看MAC地址
8、Switch(config)loggingsynchronous 阻止控制台信息覆蓋命令行上的輸入
9、Switch(config)no ipdomain-lookup 關閉DNS查找功能
10、Switch(config)exec-timeout 00 阻止會話退出
(3)cisco交換機路由配置命令擴展閱讀:
cisco常用配置命令:
一、使用Telnet遠程式管理
1、Switch(config)#line vty 0 4 進入虛擬終端
2、Switch (config-line)# password 設置登錄口令
3、Switch(config-line)# login 要求口令驗證
二、控制台口令
1、switch(config)#lineconsole 0 進入控制台口
2、switch(config-line)# password xx
3、switch(config-line)#設置登錄口令login 允許登錄
三、恢復出廠配置
Switch(config)#erasestartup-config
Switch(config)delete vlan.dat
『肆』 思科路由器查看配置的命令是什麼
思科路由器查看配置的命令是router#show run。
路由器顯示命令:
router#show interface ;顯示介面信息
router#show ip route ;顯示路由信息
router#show cdp nei ;顯示鄰居信息
router#reload ;重新起動
路由器口令設置:
router>enable ;進入特權模式
router#config terminal ;進入全局配置模式
router(config)#hostname ;設置交換機的主機名
router(config)#enable secret xxx ;設置特權加密口令
router(config)#enable password xxb ;設置特權非密口令
router(config)#line console 0 ;進入控制台口
router(config-line)#line vty 0 4 ;進入虛擬終端
router(config-line)#login ;要求口令驗證
router(config-line)#password xx ;設置登錄口令xx
router(config)#(Ctrl+z) ; 返回特權模式
router#exit ;返回命令
(4)cisco交換機路由配置命令擴展閱讀:
路由器配置:
router(config)#int s0/0 ;進入Serail介面
router(config-if)#no shutdown ;激活當前介面
router(config-if)#clock rate 64000 ;設置同步時鍾
router(config-if)#ip address ;設置IP地址
router(config-if)#ip address second ;設置第二個IP
router(config-if)#int f0/0.1 ;進入子介面
router(config-subif.1)#ip address ;設置子介面IP
router(config-subif.1)#encapsulation dot1q ;綁定vlan中繼協議
router(config)#config-register 0x2142 ;跳過配置文件
router(config)#config-register 0x2102 ;正常使用配置文件
router#reload ;重新引導
參考資料來源:Cisco-思科路由器
『伍』 cisco 三層交換機開啟路由功能的命令。
三層交換機開啟路由功能的命令是:
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#no ip domain-loo
Switch(config)#ip routing
Switch(config)#int vlan
Switch(config)#int vlan 10
Switch(config-if)#ip add A.B.C.D
Switch(config-if)#int vlan 20
Switch(config-if)#ip add A.B.C.D
如果不寫這些,介面都是access介面,沒有ip地址,開了也沒有用,因為找不到網關,整個3層交換上也沒有個ip,所以不可能會出現路由。
原理
工作在數據鏈路層。交換機擁有一條很高帶寬的背部匯流排和內部交換矩陣。交換機的所有的埠都掛接在這條背部匯流排上,控制電路收到數據包以後,處理埠會查找內存中的地址對照表以確定目的MAC(網卡的硬體地址)的NIC(網卡)掛接在哪個埠上;
通過內部交換矩陣迅速將數據包傳送到目的埠,目的MAC若不存在,廣播到所有的埠,接收埠回應後交換機會「學習」新的地址,並把它添加入內部MAC地址表中。
以上內容參考:網路-cisco交換機
『陸』 思科配置命令詳細介紹
思科配置命令詳細介紹
對於剛想學計算機網路技術的朋友,首先接觸的就是思科路由器,下面是我給大家帶來的最詳細的CISCO路由器配置命令及方法:
目 錄 :
第一章 路由器配置基礎
一、基本設置方式
二、命令狀態
三、設置對話過程
四、常用命令
五、配置IP定址
六、配置靜態路由
第二章 廣域網協議設置
一、HDLC
二、PPP
三、X.25
四、Frame Relay
五、ISDN
六、PSTN
第三章 路由協議設置
一、RIP協議
二、IGRP協議
三、OSPF協議
四、重新分配路由
五、IPX協議設置
第四章 服務質量及訪問控制
一、協議優先順序設置
二、隊列定製
三、訪問控制
第五章 虛擬區域網(VLAN)路由
一、虛擬區域網(VLAN)
二、交換機間鏈路(ISL)協議
三、虛擬區域網(VLAN)路由實例
第一章:路由器配置基礎
一、基本設置方式
一般來說,可以用5種方式來設置路由器:
1.Console口接終端或運行終端模擬軟體的微機;
2.AUX口接MODEM,通過電話線與遠方的終端或運行終端模擬軟體的微機相連;
3.通過Ethernet上的TFTP伺服器;
4.通過Ethernet上的TELNET程序;
5.通過Ethernet上的SNMP網管工作站。
但路由器的第一次設置必須通過第一種方式進行,此時終端的硬體設置如下:
波特率 :9600
數據位 :8
停止位 :1
奇偶校驗: 無
二、命令狀態
1. router>
路由器處於用戶命令狀態,這時用戶可以看路由器的連接狀態,訪問其它網路和主機,但不能看到和更改路由器的設置內容。
2. router#
在router>提示符下鍵入enable,路由器進入特權命令狀態router#,這時不但可以執行所有的用戶命令,還可以看到和更改路由器的設置內容。
3. router(config)#
在router#提示符下鍵入configure terminal,出現提示符router(config)#,此時路由器處於全局設置狀態,這時可以設置路由器的全局參數。
4. router(config-if)#; router(config-line)#; router(config-router)#;…
路由器處於局部設置狀態,這時可以設置路由器某個局部的參數。
5. >
路由器處於RXBOOT狀態,在開機後60秒內按ctrl-break可進入此狀態,這時路由器不能完成正常的功能,只能進行軟體升級和手工引導。
設置對話狀態
這是一台新路由器開機時自動進入的狀態,在特權命令狀態使用SETUP命令也可進入此狀態,這時可通過對話方式對路由器進行設置。
三、設置對話過程
顯示提示信息
全局參數的設置
介面參數的設置
顯示結果
利用設置對話過程可以避免手工輸入命令的煩瑣,但它還不能完全代替手工設置,一些特殊的設置還必須通過手工輸入的方式完成。
進入設置對話過程後,路由器首先會顯示一些提示信息:
--- System Configuration Dialog ---
At any point you may enter a question mark '?' for help.
Use ctrl-c to abort configuration dialog at any prompt.
Default settings are in square brackets '[]'.
這是告訴你在設置對話過程中的任何地方都可以鍵入“?”得到系統的幫助,按ctrl-c可以退出設置過程,預設設置將顯示在‘[]’中。然後路由器會問是否進入設置對話:
Would you like to enter the initial configuration dialog? [yes]:
如果按y或回車,路由器就會進入設置對話過程。首先你可以看到各埠當前的狀況:
First, would you like to see the current interface summary? [yes]:
Any interface listed with OK? value "NO" does not have a valid configuration
Interface IP-Address OK? Method Status Protocol
Ethernet0 unassigned NO unset up up
Serial0 unassigned NO unset up up
……… ……… … …… … …
然後,路由器就開始全局參數的設置:
Configuring global parameters:
1.設置路由器名:
Enter host name [Router]:
2.設置進入特權狀態的密文(secret),此密文在設置以後不會以明文方式顯示:
The enable secret is a one-way cryptographic secret used
instead of the enable password when it exists.
Enter enable secret: cisco
3.設置進入特權狀態的密碼(password),此密碼只在沒有密文時起作用,並且在設置以後會以明文方式顯示:
The enable password is used when there is no enable secret
and when using older software and some boot images.
Enter enable password: pass
4.設置虛擬終端訪問時的密碼:
Enter virtual terminal password: cisco
5.詢問是否要設置路由器支持的各種網路協議:
Configure SNMP Network Management? [yes]:
Configure DECnet? [no]:
Configure AppleTalk? [no]:
Configure IPX? [no]:
Configure IP? [yes]:
Configure IGRP routing? [yes]:
Configure RIP routing? [no]:
………
6.如果配置的是撥號訪問伺服器,系統還會設置非同步口的參數:
Configure Async lines? [yes]:
1) 設置線路的最高速度:
Async line speed [9600]:
2) 是否使用硬體流控:
Configure for HW flow control? [yes]:
3) 是否設置modem:
Configure for modems? [yes/no]: yes
4) 是否使用默認的modem命令:
Configure for default chat s cript? [yes]:
5) 是否設置非同步口的PPP參數:
Configure for Dial-in IP SLIP/PPP access? [no]: yes
6) 是否使用動態IP地址:
Configure for Dynamic IP addresses? [yes]:
7) 是否使用預設IP地址:
Configure Default IP addresses? [no]: yes
8) 是否使用TCP頭壓縮:
Configure for TCP Header Compression? [yes]:
9) 是否在非同步口上使用路由表更新:
Configure for routing updates on async links? [no]: y
10) 是否設置非同步口上的其它協議。
接下來,系統會對每個介面進行參數的設置。
1.Configuring interface Ethernet0:
1) 是否使用此介面:
Is this interface in use? [yes]:
2) 是否設置此介面的IP參數:
Configure IP on this interface? [yes]:
3) 設置介面的IP地址:
IP address for this interface: 192.168.162.2
4) 設置介面的IP子網掩碼:
Number of bits in subnet field [0]:
Class C network is 192.168.162.0, 0 subnet bits; mask is /24
在設置完所有介面的參數後,系統會把整個設置對話過程的結果顯示出來:
The following configuration command s cript was created:
hostname Router
enable secret 5 $1$W5Oh$p6J7tIgRMBOIKVXVG53Uh1
enable password pass
…………
請注意在enable secret後面顯示的是亂碼,而enable password後面顯示的是設置的內容。
顯示結束後,系統會問是否使用這個設置:
Use this configuration? [yes/no]: yes
如果回答yes,系統就會把設置的結果存入路由器的NVRAM中,然後結束設置對話過程,使路由器開始正常的工作。
四、常用命令
1. 幫助
在IOS操作中,無論任何狀態和位置,都可以鍵入“?”得到系統的幫助。
2. 改變命令狀態
任務 命令
進入特權命令狀態 enable
退出特權命令狀態 disable
進入設置對話狀態 setup
進入全局設置狀態 config terminal
退出全局設置狀態 end
進入埠設置狀態 interface type slot/number
進入子埠設置狀態 interface type number.subinterface [point-to-point | multipoint]
進入線路設置狀態 line type slot/number
進入路由設置狀態 router protocol
退出局部設置狀態 exit
3. 顯示命令
任務 命令
查看版本及引導信息 show version
查看運行設置 show running-config
查看開機設置 show startup-config
顯示埠信息 show interface type slot/number
顯示路由信息 show ip router
4. 拷貝命令
用於IOS及CONFIG的備份和升級
5. 網路命令
任務 命令
登錄遠程主機 telnet hostname|IP address
網路偵測 ping hostname|IP address
路由跟蹤 trace hostname|IP address
6. 基本設置命令
任務 命令
全局設置 config terminal
設置訪問用戶及密碼 username username password password
設置特權密碼 enable secret password
設置路由器名 hostname name
設置靜態路由 ip route destination subnet-mask next-hop
啟動IP路由 ip routing
啟動IPX路由 ipx routing
埠設置 interface type slot/number
設置IP地址 ip address address subnet-mask
設置IPX網路 ipx network network
激活埠 no shutdown
物理線路設置 line type number
啟動登錄進程 login [local|tacacs server]
設置登錄密碼 password password
五、配置IP定址
1. IP地址分類
IP地址分為網路地址和主機地址二個部分,A類地址前8位為網路地址,後24位為主機地址,B類地址16位為網路地址,後16位為主機地址,C類地址前24位為網路地址,後8位為主機地址,網路地址范圍如下表所示:
種類 網路地址范圍
A 1.0.0.0 到126.0.0.0有效 0.0.0.0 和127.0.0.0保留
B 128.1.0.0到191.254.0.0有效 128.0.0.0和191.255.0.0保留
C 192.0.1.0 到223.255.254.0有效 192.0.0.0和223.255.255.0保留
D 224.0.0.0到239.255.255.255用於多點廣播
E 240.0.0.0到255.255.255.254保留 255.255.255.255用於廣播
2. 分配介面IP地址
任務 命令
介面設置 interface type slot/number
為介面設置IP地址 ip address ip-address mask
掩瑪(mask)用於識別IP地址中的網路地址位數,IP地址(ip-address)和掩碼(mask)相與即得到網路地址。
3. 使用可變長的子網掩碼
通過使用可變長的子網掩碼可以讓位於不同介面的同一網路編號的網路使用不同的掩碼,這樣可以節省IP地址,充分利用有效的IP地址空間。
如下圖所示:
Router1和Router2的E0埠均使用了C類地址192.1.0.0作為網路地址,Router1的E0的網路地址為192.1.0.128, 掩碼為255.255.255.192, Router2的E0的網路地址為192.1.0.64,掩碼為255.255.255.192,這樣就將一個C類網路地址分配給了二個網,既劃分了二個子網,起到了節約地址的作用。
4. 使用網路地址翻譯(NAT)
NAT(Network Address Translation)起到將內部私有地址翻譯成外部合法的全局地址的功能,它使得不具有合法IP地址的用戶可以通過NAT訪問到外部Internet.
當建立內部網的時候,建議使用以下地址組用於主機,這些地址是由Network Working Group(RFC 1918)保留用於私有網路地址分配的`.
?; Class A:10.1.1.1 to 10.254.254.254
?; Class B:172.16.1.1 to 172.31.254.254
?; Class C:192.168.1.1 to 192.168.254.254
命令描述如下:
任務 命令
定義一個標准訪問列表 access-list access-list-number permit source [source-wildcard]
定義一個全局地址池 ip nat pool name start-ip end-ip {netmask netmask | prefix-length prefix-length} [type rotary]
建立動態地址翻譯 ip nat inside source {list {access-list-number | name} pool name [overload] | static local-ip global-ip}
指定內部和外部埠 ip nat {inside | outside}
如下圖所示,
路由器的Ethernet 0埠為inside埠,即此埠連接內部網路,並且此埠所連接的網路應該被翻譯,Serial 0埠為outside埠,其擁有合法IP地址(由NIC或服務提供商所分配的合法的IP地址),來自網路10.1.1.0/24的主機將從IP地址池 c2501中選擇一個地址作為自己的合法地址,經由Serial 0口訪問Internet。命令ip nat inside source list 2 pool c2501 overload中的參數overload,將允許多個內部地址使用相同的全局地址(一個合法IP地址,它是由NIC或服務提供商所分配的地址)。命令 ip nat pool c2501 202.96.38.1 202.96.38.62 netmask 255.255.255.192定義了全局地址的范圍。
設置如下:
ip nat pool c2501 202.96.38.1 202.96.38.62 netmask 255.255.255.192
interface Ethernet 0
ip address 10.1.1.1 255.255.255.0
ip nat inside
!
interface Serial 0
ip address 202.200.10.5 255.255.255.252
ip nat outside
!
ip route 0.0.0.0 0.0.0.0 Serial 0
access-list 2 permit 10.0.0.0 0.0.0.255
! Dynamic NAT
!
ip nat inside source list 2 pool c2501 overload
line console 0
exec-timeout 0 0
!
line vty 0 4
end
六、配置靜態路由
通過配置靜態路由,用戶可以人為地指定對某一網路訪問時所要經過的路徑,在網路結構比較簡單,且一般到達某一網路所經過的路徑唯一的情況下採用靜態路由。
任務 命令
建立靜態路由 ip route prefix mask {address | interface} [distance] [tag tag] [permanent]
Prefix :所要到達的目的網路
mask :子網掩碼
address :下一個跳的IP地址,即相鄰路由器的埠地址。
interface :本地網路介面
distance :管理距離(可選)
tag tag :tag值(可選)
permanent :指定此路由即使該埠關掉也不被移掉。
以下在Router1上設置了訪問192.1.0.64/26這個網下一跳地址為192.200.10.6,即當有目的地址屬於 192.1.0.64/26的網路范圍的數據報,應將其路由到地址為192.200.10.6的相鄰路由器。在Router3上設置了訪問 192.1.0.128/26及192.200.10.4/30這二個網下一跳地址為192.1.0.65。由於在Router1上埠Serial 0地址為192.200.10.5,192.200.10.4/30這個網屬於直連的網,已經存在訪問192.200.10.4/30的路徑,所以不需要在Router1上添加靜態路由。
Router1:
ip route 192.1.0.64 255.255.255.192 192.200.10.6
Router3:
ip route 192.1.0.128 255.255.255.192 192.1.0.65
ip route 192.200.10.4 255.255.255.252 192.1.0.65
同時由於路由器Router3除了與路由器Router2相連外,不再與其他路由器相連,所以也可以為它賦予一條默認路由以代替以上的二條靜態路由,
ip route 0.0.0.0 0.0.0.0 192.1.0.65
即只要沒有在路由表裡找到去特定目的地址的路徑,則數據均被路由到地址為192.1.0.65的相鄰路由器。
;『柒』 Cisco路由器配置命令
Cisco路由器配置命令大全
為方便考生復習思科路由器的配置,以下是我為大家整理的Cisco路由器配置命令,歡迎閱讀與收藏。
1. switch配置命令
(1)模式轉換命令
用戶模式----特權模式, 使用命令"enable"
特權模式----全局配置模式, 使用命令"config t"
全局配置模式----介面模式, 使用命令"interface+介面類型+介面號"
全局配置模式----線控模式, 使用命令"line+介面類型+介面號"
注:
用戶模式:查看初始化的信息.
特權模式:查看所有信息、調試、保存配置信息
全局模式:配置所有信息、針對整個路由器或交換機的所有介面
介面模式:針對某一個介面的配置
線控模式:對路由器進行控制的介面配置
(2)配置命令
show running config 顯示所有的配置
show versin 顯示版本號和寄存器值
shut down 關閉介面
no shutdown 打開介面
ip add +ip地址 配置IP地址
secondary+IP地址 為介面配置第二個IP地址
show interface+介面類型+介面號 查看介面管理性
show controllers interface 查看介面是否有DCE電纜
show history 查看歷史記錄
show terminal 查看終端記錄大小
hostname+主機名 配置路由器或交換機的標識
config memory 修改保存在NVRAM中的啟動配置
exec timeout 0 0 設置控制台會話超時為0
service password-encryptin 手工加密所有密碼
enable password +密碼 配置明文密碼
ena sec +密碼 配置密文密碼
line vty 0 4/15 進入telnet介面
password +密碼 配置telnet密碼
line aux 0 進入AUX介面
password +密碼 配置密碼
line con 0 進入CON介面
password +密碼 配置密碼
bandwidth+數字 配置帶寬
no ip address 刪除已配置的IP地址
show startup config 查看NVRAM中的配置信息
run-config atartup config 保存信息到NVRAM
write 保存信息到NVRAM
erase startup-config 清除NVRAM中的配置信息
show ip interface brief 查看介面的謫要信息
banner motd # +信息 + # 配置路由器或交換機的描素信息
description+信息 配置介面聽描素信息
vlan database 進入VLAN資料庫模式
vlan +vlan號+ 名稱 創建VLAN
switchport access vlan +vlan號 為VLAN為配介面
interface vlan +vlan號 進入VLAN介面模式
ip add +ip地址 為VLAN配置管理IP地址
vtp+service/tracsparent/client 配置SW的VTP工作模式
vtp +domain+域名 配置SW的VTP域名
vtp +password +密碼 配置SW的密碼
switchport mode trunk 啟用中繼
no vlan +vlan號 刪除VLAN
show spamming-tree vlan +vlan號 查看VLA怕生成樹議
2. 路由器配置命令
ip route+非直連網段+子網掩碼+下一跳地址 配置靜態/默認路由
show ip route 查看路由表
show protocols 顯示出所有的被動路由協議和介面上哪些協議被設置
show ip protocols 顯示了被配置在路由器上的路由選擇協議, 同時給出了在路由選擇協議中使用的定時器等信息
router rip 激活RIP協議
路由器的幾個基本命令:
Router>enable 進入特權模式
Router#disable 從特權模式返回到用戶模式
Router#configure terminal 進入到全局配置模式
Router(config)#interface ethernet 1 進入到路由器編號為1的乙太網口
exit 返回上層模式
end 直接返回到特權模式
========================================================
注意:
1、CISCO CATALYST(交換機),如果在初始化時沒有發現「用戶配置」文件,就會自動載入Default Settings(默認配置)文件,進行交換機初始化,以確保交換機正常工作。
2、CISCO Router(路由器)在初始化時,如果沒有發現「用戶配置」文件,系統會自動進入到「初始化配置模式」(系統配置對話模式,SETUP模式, STEP BY STEP CONFIG模式),不能正常工作!
========================================================
1、CONSOLE PORT(管理控制台介面):距離上限制,獨占的方式。剛開始配置的時候一般使用這個。
2、AUX port(輔助管理介面):可以掛接MODEM實現遠程管理,獨占的方式。
3、Telnet:多人遠程管理(決定於性能,VTY線路數量)不安全。後期維護,遠程管理登陸。
========================================================
注意:
交換機、路由器配置命令都是回車後立即執行,立即生效的。在運行中的機器上修改命令的時候要特別注意。
========================================================
Router(config)#hostname ?
WORD This system's network name
在配置模式下修改當前主機的本地標識,例:
------------------
Router(config)#hostname r11
r11(config)#
------------------
r11(config-if)#ip address ?
A.B.C.D IP address
為當前埠設置IP地址,使用前先進入需要配置的埠,例:
------------------
r11(config)#interface ethernet 1
r11(config-if)#ip address 172.16.1.1 255.255.255.0
------------------
r11>show version
r11#show version 觀察IOS版本,設備工作時間,相關介面列表
r11#show running-config 查看當前生效的配置,此配置文件存儲在RAM
r11#show interfaces ethernet 1 查看乙太網介面的狀態,工作狀態等等等...
========================================================
r11#reload 重新載入Router(重啟)
r11#setup 手工進入setup配置模式
r11#show history 查看歷史命令(最近剛用過的命令)
r11#terminal history size<0-256>設置命令緩沖區大小,0 : 代表不緩存
r11# running-config startup-config 保存當前配置
注意概念:
nvram:非易失性內存,斷電信息不會丟失 <-- 用戶配置 <-- 保存著startup-config
ram:隨機存儲器,斷電信息全部丟失 <-- 當前生效配置 <-- 保存著running-config
startup-config:在每次路由器或是交換機啟動時候,會主動載入(默認情況)
========================================================
設置說明和密碼的幾個命令:
r11(config)#banner motd [char c] 同時要以[char c]另起一行結束,描述機器登陸時的說明
r11(config-if)#description 描述介面注釋,需要在埠配置模式下
配置console口密碼:
------------------
r11(config)#line console 0 進入到consolo 0
r11(config-line)#password eliuzd 設置一個密碼為「eliuzd」
r11(config-line)#login 設置login(登陸)時使用密碼
------------------
配置enable密碼:
------------------
r11(config)#enable password cisco 設置明文的enable密碼
r11(config)#enable secret eliuzd 設置暗文的enable密碼(優先於明文被使用)
r11(config)#service password-encryption 加密系統所有明文密碼(功能較弱)
------------------
配置Telnet密碼:
------------------
r11(config)#line vty 0
r11(config-line)#password cisco
r11(config-line)#login
------------------
========================================================
配置虛擬回環介面:(回環介面默認為UP狀態)
(config)# 下,虛擬一個埠
------------------
r11(config)#interface loopback 0 創建一個回環介面loopback 0
r11(config-if)#ip address 192.168.1.1 255.255.255.0 配置它的IP地址
no * 做配置的反向操作(刪除配置)
------------------
=========================================================
路由器 DCE/DTE 僅存在廣域網中
r11#show controllers serial 0 用於查看DCE與DTE的屬性,serial 0路由器廣域網埠
DCE的Router需要配置時鍾頻率
r11(config-if)#clock rate ? 配置DCE介面的時鍾頻率(系統指定頻率)
一般實際情況下,這個不需要自己配置,因為DCE設備都在運營商那。
=========================================================
r11#show interfaces serial 1
查看埠狀態,第一行提示說明
Serial1 is administratively down, Line protocol is down
沒有使用no shutdown命令激活埠
Serial1 is down, Line protocol is down
1、對方沒有no shutdown激活埠
2、線路損壞,介面沒有任何連接線纜
Serial1 is up, line protocol is down
1、對方沒有配置相同的二層協議,Serial介面default encapsulation: HDLC
2、可能沒有配置時鍾頻率
3、可能沒有正確的配置三層地址(可能)
Serial1 is up,line protocol is up
介面工作正常
========================================================
查看CDP信息的幾個命令:
r11#show cdp neighbors 查看CDP的鄰居(不含IP)
r11#show cdp neighbors detail 查看CDP的鄰居(包含三層的IP地址)
r11#show cdp entry * 查看CDP的鄰居(包含三層的IP地址)老命令
r1(config)#no cdp run 在全局配置模式關閉CDP協議(影響所有的介面)
r1(config-if)#no cdp enable 在介面下關閉CDP協議(僅僅影響指定的介面)
r11#clear cdp table 清除CDP鄰居表
r11#show cdp interface serial 1 查看介面的CDP信息
注意兩個提示:
Sending CDP packets every 60 seconds(每60秒發送cdp數據包)
HoldTime 180 seconds(每個cdp數據包保持180秒)
========================================================
r11(config)#ip host 設置靜態的主機名映射
r11#show sessions 查看設置過的映射主機名
========================================================
Telnet *.*.*.* 被telnet的設備,需要設置line vty的密碼,如果需要進入特權模式需要配置enable密碼
『捌』 思科三層交換機配置實例及命令
三層交換機是不是經常讓你機器不好使,看看下面的三層交換機配置文章,一切問題都能解決。本文詳細介紹實例講解:全面的三層交換機配置比較全面的三層交換機配置實例,帶命令解釋喲!
三層交換機配置:
Enable //進入私有模式
Configure terminal //進入全局模式
service password-encryption //對密碼進行加密
hostname Catalyst 3550-12T1 //給三層交換機定義名稱
enable password 123456. //enable密碼
Enable secret 654321 //enable的加密密碼(應該是亂碼而不是654321這樣)
Ip subnet-zero //允許使用全0子網(默認都是打開的)
Ip name-server 172.16.8.1 172.16.8.2 //三層交換機名字Catalyst 3550-12T1對應的IP地址是172.16.8.1
Service dhcp //提供DHCP服務
ip routing //啟用三層交換機上的路由模塊
Exit
三層交換機配置:
Vtp mode server //定義VTP工作模式為sever模式
Vtp domain centervtp //定義VTP域的名稱為centervtp
Vlan 2 name vlan2 //定義vlan並給vlan取名(如果不取名的話,vlan2的名字應該是vlan002)
Vlan 3 name vlan3
Vlan 4 name vlan4
Vlan 5 name vlan5
Vlan 6 name vlan6
Vlan 7 name vlan7
Vlan 8 name vlan8
Vlan 9 name vlan9
Exit
三層交換機配置:
interface Port-channel 1 //進入虛擬的以太通道組1
switchport trunk encapsulation dot1q //給這個介面的trunk封裝為802.1Q的幀格式
switchport mode trunk //定義這個介面的工作模式為trunk
switchport trunk allowed vlan all //在這個trunk上允許所有的vlan通過
Interface gigabitethernet 0/1 //進入模塊0上的吉比特以太口1
switchport trunk encapsulation dotlq //給這個介面的trunk封裝為802.1Q的幀格式
switchport mode trunk //定義這個介面的工作模式為trunk
switchport trunk allowed vlan all //在這個trunk上允許所有的vlan通過
channel-group 1 mode on //把這個介面放到快速以太通道組1中
Interface gigabitethernet 0/2 //同上
switchport trunk encapsulation dotlq
switchport mode trunk
switchport trunk allowed vlan all
channel-group 1 mode on
三層交換機配置:
port-channel load-balance src-dst-ip //定義快速以太通道組的負載均衡方式(依*源和目的IP的方式)
interface gigabitethernet 0/3 //進入模塊0上的吉比特以太口3
switchport trunk encapsulation dotlq //給trunk封裝為802.1Q
switchport mode trunk //定義這個介面的工作模式為trunk
switchport trunk allowed vlan all //允許所有vlan信息通過
interface gigabitethernet 0/4 //同上
switchport trunk encapsulation dotlq
switchport mode trunk
switchport trunk allowed vlan all
interface gigbitethernet 0/5 //同上
switchport trunk encapsulation dotlq
switchport mode trunk
switchport trunk allowed vlan all
interface gigbitethernet 0/6 //同上
switchport trunk encapsulation dotlq
switchport mode trunk
switchprot trunk allowed vlan all
三層交換機配置:
interface gigbitethernet 0/7 //進入模塊0上的吉比特以太口7
Switchport mode access //定義這個介面的工作模式為訪問模式
switchport access vlan 9 //定義這個介面可以訪問哪個vlan(實際就是分配這個介面到vlan)
no shutdown
spanning-tree vlan 6-9 cost 1000 //在生成樹中,vlan6-9的開銷定義為10000
interface range gigabitethernet 0/8 – 10 //進入模塊0上的吉比特以太口8,9,10
switchport mode access //定義這些介面的'工作模式為訪問模式
switchport access vlan 8 //把這些介面都分配到vlan8中
no shutdown
三層交換機配置:
spanning-tree portfast //在這些介面上使用portfast(使用portfast以後,在生成樹的時候不參加運算,直接成為轉發狀態)
interface gigabitethernet 0/11 //進入模塊0上的吉比特以太口11
switchport trunk encapsulation dotlq //給這個介面封裝為802.1Q
switchport mode trunk //定義這個介面的工作模式為trunk
switchport trunk allowed vlan all //允許所有vlan信息通過
interface gigabitethernet 0/12 //同上
switchport trunk encapsulation dotlq
switchport mode trunk
switchport trunk allowed vlan all
interface vlan 1 //進入vlan1的邏輯介面(不是物理介面,用來給vlan做路由用)
ip address 172.16.1.7 255.255.255.0 //配置IP地址和子網掩碼
no shutdown
三層交換機配置:
standby 1 ip 172.16.1.9 //開啟了冗餘熱備份(HSRP),冗餘熱備份組1,虛擬路由器的IP地址為172.16.1.9
standby 1 priority 110 preempt //定義這個三層交換機在冗餘熱備份組1中的優先順序為110,preempt是用來開啟搶占模式
interface vlan 2 //同上
ip address 172.16.2.252 255.255.255.0
no shutdown
standby 2 ip 172.16.2.254
standby 2 priority 110 preempt
ip access-group 101 in //在入方向上使用擴展的訪問控制列表101
interface vlan 3 //同上
ip address 172.16.3.252 255.255.255.0
no shutdown
三層交換機配置:
standby 3 ip 172.16.3.254
standby 3 priority 110 preempt
ip access-group 101 in
interface vlan 4 //同上
ip address 172.16.4.252 255.255.255.0
no shutdown
standby 4 ip 172.16.4.254
standby 4 priority 110 preempt
ip access-group 101 in
interface vlan 5
ip address 172.16.5.252 255.255.255.0
no shutdown
standby 5 ip 172.16.5.254
standby 5 priority 110 preempt
ip access-group 101 in
interface vlan 6
ip address 172.16.6.252 255.255.255.0
no shutdown
三層交換機配置:
standby 6 ip 172.16.6.254
standby 6 priority 100 preempt
interface vlan 7
ip address 172.16.7.252 255.255.255.0
no shutdown
standby 7 ip 172.16.7.254
standby 7 priority 100 preempt
interface vlan 8
ip address 172.16.8.252 255.255.255.0
no shutdown
standby 8 ip 172.16.8.254
standby 8 priority 100 preempt
interface vlan 9
ip address 172.16.9.252 255.255.255.0
no shutdown
三層交換機配置:
standby 9 ip 172.16.9.254
standby 9 priority 100 preempt
access-list 101 deny ip any 172.16.7.0 0.0.0.255 //擴展的訪問控制列表101
access-list 101 permit ip any any
Interface vlan 1 //進入vlan1這個邏輯介面
Ip helper-address 172.16.8.1 //可以轉發廣播(helper-address的作用就是把廣播轉化為單播,然後發向172.16.8.1)
Interface vlan 2
Ip helper-address 172.16.8.1
Interface vlan 3
ip helper-address 172.16.8.1
interface vlan 4
ip helper-address 172.16.8.1
interface vlan 5
ip helper-address 172.16.8.1
interface vlan 6
ip helper-address 172.16.8.1
interface vlan 7
ip helper-address 172.16.8.1
interface vlan 9
ip helper-address 172.16.8.1
router rip//啟用路由協議RIP
version 2//使用的是RIPv2,如果沒有這句,則是使用RIPv1
network 172.16.0.0//宣告直連的網段
exit
三層交換機配置:
ip route 0.0.0.0 0.0.0.0 172.16.9.250//預設路由,所有在路由表中沒有辦法匹配的數據包,都發向下一跳地址為172.16.9.250這個路由器
line con 0
line aux 0
line vty 0 15//telnet線路(路由器只有5個,是0-4)
password 12345678//login密碼
login
end
running-config startup-config 保存配置
『玖』 cisco交換機安全配置設定命令
cisco交換機安全配置設定命令大全
思科交換機的安全怎麼設置,下面為大家分交換機安全設置的配置命令,希望對同學們學習思科交換機有所幫助!
一、交換機訪問控制安全配置
1、對交換機特權模式設置密碼盡量採用加密和md5 hash方式
switch(config)#enable secret 5 pass_string
其中 0 Specifies an UNENCRYPTED password will follow
5 Specifies an ENCRYPTED secret will follow
建議不要採用enable password pass_sting密碼,破解及其容易!
2、設置對交換機明文密碼自動進行加密隱藏
switch(config)#service password-encryption
3、為提高交換機管理的靈活性,建議許可權分級管理並建立多用戶
switch(config)#enable secret level 7 5 pass_string7 /7級用戶進入特權模式的密碼
switch(config)#enable secret 5 pass_string15 /15級用戶進入特權模式的密碼
switch(config)#username userA privilege 7 secret 5 pass_userA
switch(config)#username userB privilege 15 secret 5 pass_userB
/為7級,15級用戶設置用戶名和密碼,Cisco privilege level分為0-15級,級別越高許可權越大
switch(config)#privilege exec level 7 commands
/為7級用戶設置可執行的命令,其中commands可以根據分配給用戶的許可權自行定義
4、本地console口訪問安全配置
switch(config)#line console 0
switch(config-line)#exec-timeout 5 0 /設置不執行命令操作的超時時間,單位為分鍾和秒
switch(config-line)#logging synchronous
/強制對彈出的干擾日誌信息進行回車換行,使用戶輸入的命令連續可見
設置登錄console口進行密碼驗證
方式(1):本地認證
switch(config-line)#password 7 pass_sting /設置加密密碼
switch(config-line)#login /啟用登錄驗證
方式(2):本地AAA認證
switch(config)#aaa new-model /啟用AAA認證
switch(config)#aaa authentication login console-in group acsserver local
enable
/設置認證列表console-in優先依次為ACS Server,local用戶名和密碼,enable特權密碼
switch(config)#line console 0
switch(config-line)# login authentication console-in
/調用authentication設置的console-in列表
5、遠程vty訪問控制安全配置
switch(config)#access-list 18 permit host x.x.x.x
/設置標准訪問控制列表定義可遠程訪問的PC主機
switch(config)#aaa authentication login vty-in group acsserver local
enable
/設置認證列表vty-in, 優先依次為ACS Server,local用戶名和密碼,enable特權密碼
switch(config)#aaa authorization commands 7 vty-in group acsserver local
if-authenticated
/為7級用戶定義vty-in授權列表,優先依次為ACS Server,local授權
switch(config)#aaa authorization commands 15 vty-in group acsserver local
if-authenticated
/為15級用戶定義vty-in授權列表,優先依次為ACS Server,local授權
switch(config)#line vty 0 15
switch(config-line)#access-class 18 in /在線路模式下調用前面定義的標准ACL 18
switch(config-line)#exec-timeout 5 0 /設置不執行命令操作的超時時間,單位為分鍾和秒
switch(config-line)#authorization commands 7 vty-in /調用設置的授權列表vty-in
switch(config-line)#authorization commands 15 vty-in
switch(config-line)#logging synchronous
/強制對彈出的干擾日誌信息進行回車換行,使用戶輸入的命令連續可見
switch(config-line)#login authentication vty-in
/調用authentication設置的vty-in列表
switch(config-line)#transport input ssh
/有Telnet協議不安全,僅允許通過ssh協議進行遠程登錄管理
6、AAA安全配置
switch(config)#aaa group server tacacs+ acsserver /設置AAA伺服器組名
switch(config-sg-tacacs+)#server x.x.x.x /設置AAA伺服器組成員伺服器ip
switch(config-sg-tacacs+)#server x.x.x.x
switch(config-sg-tacacs+)#exit
switch(config)# tacacs-server key paa_string /設置同tacacs-server伺服器通信的密鑰
二、交換機網路服務安全配置
禁用不需要的各種服務協議
switch(config)#no service pad
switch(config)#no service finger
switch(config)#no service tcp-small-servers
switch(config)#no service udp-small-servers
switch(config)#no service config
switch(config)#no service ftp
switch(config)#no ip http server
switch(config)#no ip http secure-server
/關閉http,https遠程web管理服務,默認cisco交換機是啟用的
三、交換機防攻擊安全加固配置
MAC Flooding(泛洪)和Spoofing(欺騙)攻擊
預防方法:有效配置交換機port-security
STP攻擊
預防方法:有效配置root guard,bpguard,bpfilter
VLAN,DTP攻擊
預防方法:設置專用的native vlan;不要的介面shut或將埠模式改為access
DHCP攻擊
預防方法:設置dhcp snooping
ARP攻擊
預防方法:在啟用dhcp snooping功能下配置DAI和port-security在級聯上層交換機的trunk下
switch(config)#int gi x/x/x
switch(config-if)#sw mode trunk
switch(config-if)#sw trunk encaps dot1q
switch(config-if)#sw trunk allowed vlan x-x
switch(config-if)#spanning-tree guard loop
/啟用環路保護功能,啟用loop guard時自動關閉root guard
接終端用戶的埠上設定
switch(config)#int gi x/x/x
switch(config-if)#spanning-tree portfast
/在STP中交換機埠有5個狀態:disable、blocking、listening、learning、forwarding,只有處於forwarding狀態的埠才可以發送數據。但需經過從blocking-->listening
15s,listening-->learning 15s,learning-->forwarding 20s
共計50s的時間,啟用portfast後將直接從blocking-->forwarding狀態,這樣大大縮短了等待的時間。
說明:portfast僅適用於連接終端或伺服器的交換機埠,不能在連接交換機的埠上使用!
switch(config-if)#spanning-tree guard root
/當一埠啟用了root
guard功能後,當它收到了一個比根網橋優先值更優的.BPDU包,則它會立即阻塞該埠,使之不能形成環路等情況。這個埠特性是動態的,當沒有收到更優的包時,則此埠又會自己變成轉發狀態了。
switch(config-if)#spanning-tree bpfilter enable
/當啟用bpfilter功能時,該埠將丟棄所有的bp包,可能影響網路拓撲的穩定性並造成網路環路
switch(config-if)#spanning-tree bpguard enable
/當啟用bpguard功能的交換機埠接收到bp時,會立即將該埠置為error-disabled狀態而無法轉發數據,進而避免了網路環路!
注意:同時啟用bpguard與bpfilter時,bpfilter優先順序較高,bpguard將失效!
廣播、組播風暴控制設定
switch(config-if)#storm-control broadcast level 10 /設定廣播的閥值為10%
switch(config-if)#storm-control multicast level 10 /設定組播的閥值為10%
switch(config-if)#storm-control action shutdown / Shutdown this interface
if a storm occurs
or switch(config-if)#storm-control action trap / Send SNMP trap if a storm
『拾』 cisco交換機安全配置設定命令(2)
MAC地址綁定埠安全設定
switch(config-if)#switchport port-security /啟用埠安全
switch(config-if)#switchport port-security maximum number /默認每個介面最大的值為1
switch(config-if)#switchport port-security violation
protect|restrict|shutdown /啟用安全違規行為
protect:當介面學習到設定數量的MAC後,後來的MAC信息將直接丟棄,且不產生通知
restrict: 當介面學習到設定數量的MAC後,後來的MAC信息將直接丟棄並發送snmp trap,syslog信息。
shutdown: 當介面學習到設定數量的MAC後,後來的MAC信息將不再解析並直接關閉該埠,除非手動shut,no
shut或通過errdisable recovery cause 原因 來進行恢復
switch(config-if)#switchport port-security mac-address sticky
/啟用mac自動學習功能,無需手動進行綁定
埠錯誤檢測和自動恢復設定
switch(config)#errdisable detect cause all /啟用所有類型錯誤檢測
switch(config)#errdisable recovery cause all /啟用所有類型錯誤發生後在30s後自動恢復
switch(config)#errdisable recovery interval 30 /自動恢復間隔時間為30s
四、三層交換機常用路由協議安全配置
1、RIP協議
建議不採用RIPV1,使用支持md5認證的RIPV2版本
switch(config)#key chain chain_name /設置密鑰鏈名
switch(config-key-chain)#key 1 /設置密鑰號
switch(config-key-chain)#key-string pass_string /設置密鑰字元串
switch(config)#router rip
switch(config-router)#version 2 /啟用RIP-V2
switch(config-router)#network x.x.x.x
switch(config-router)# passive-interface x/x
/啟用passive-interface禁用一些不需要接收和轉發路由信息的埠(只是禁止轉發路由信息,並沒有禁止接收)
switch(config)#interface x/x
switch(config-if)#ip rip authentication mode md5 /指定認證方式為md5
switch(config-if)#ip rip authentication key-chain chain_name /調用定義的密鑰鏈名
注意:啟用RIPV2協議的互連路由介面其密鑰Key ID和Key string必須相同才可通過認證!
2、EIGRP協議
eigrp僅支持md5認證
switch(config)#key chain chain_name /設置密鑰鏈名
switch(config-key-chain)#key 1 /設置密鑰號
switch(config-key-chain)#key-string pass_string /設置密鑰字元串
switch(config)#router eigrp as-num /設置eigrp自治系統號,在本地有效
switch(config-router)#network x.x.x.x
switch(config-router)#no auto-summary /關閉自動匯總功能
switch(config)#interface x/x
switch(config-if)#ip authentication mode eigrp 100 md5 /指定eigrp
100區域的認證方式為md5
switch(config-if)#ip authentication key-chain eigrp 100 chain_name
/調用定義的密鑰鏈名
注意:啟用EIGRP md5認證的.互連路由介面其密鑰Key ID和Key string必須相同才可通過認證!
3、OSPF協議
由於明文認證在更改密碼時會出現斷流且容易比抓包破解,推薦採用md5認證;另OSPF在介面上的認證和區域內的認證是不同的,只要兩端的一樣就可以通信!
switch(config)#router ospf 100 /設置本地有效的標識符100
switch(config-router)#area area_id authentication message-digest
/在區域內啟用md5認證
switch(config-if)#ip ospf authentication message-digest /在介面下啟用md5認證
switch(config-if)#ip ospf message-digest-key id md5 pass_string
/在介面下設置md5密鑰id及密鑰字元串,兩端啟用OSPF路由協議的埠必須相同
4、HSRP/VRRP協議
switch(config)#key chain chain_name /設置密鑰鏈名
switch(config-key-chain)#key 1 /設置密鑰號
switch(config-key-chain)#key-string pass_string /設置密鑰字元串
switch(config-if)#standby group_num authentication md5 key-chain chain_name
/在啟用hsrp協議的介面下啟用md5認證並調用設定的密鑰鏈名
switch(config-if)#vrrp group_num authentication md5 key-chain chain_name
/在啟用vrrp協議的介面下啟用md5認證並調用設定的密鑰鏈名
五、交換機日誌收集審計安全配置
trunk介面日誌事件設定
switch(config)#int gi x/x/x
switch(config-if)#sw mode trunk
switch(config-if)#sw trunk encaps dot1q
switch(config-if)#logging event trunk-status
switch(config-if)#logging event link-status
switch(config-if)#logging event spanning-tree
switch(config-if)#logging event bundle-status
switch(config-if)#logging event status
access介面日誌世界設定
switch(config)#int gi x/x/x
switch(config-if)#sw mode access
switch(config-if)#sw access vlan xx
switch(config-if)#logging event link-status
switch(config-if)#logging event spanning-tree
switch(config-if)#logging event bundle-status
switch(config-if)#logging event status
日誌收集分析設定
switch(config)#logging on /啟動日誌
switch(config)#logging host x.x.x.x /設定收集日誌的syslog server
switch(config)#logging source-interface loopback0 /設定發送日誌的原地址
switch(config)#logging facility local6 /cisco設備的默認類型
switch(config)#logging trap 7 /設定記錄日誌服務的類型,數據越大,威脅程度越低,分為0-7,
設置為7表示包含所有日誌類型
switch(config)#logging buffered number /設定本地日誌buffer size 大小
時區和時間設定(確保日誌記錄的准確性)
switch(config)# clock timezone UTC 8 /設定時區為UTC 8
switch(config)#ntp server x.x.x.x /設定NTP Server時間同步伺服器
switch(config)#ntp source loopback0 /設定ntp時間同步原地址
switch(config)#ntp authenticate /啟用ntp認證
switch(config)#ntp authentication-key 1 md5 pass-string /設置認證密鑰和密碼
switch(config)#ntp trusted-key 1
六、交換機其他安全配置
1、即時關注cisco ios漏洞信息,為漏洞ios安裝補丁或升級ios
2、定期備份交換機設備配置文件及ios文件
3、嚴格設置登錄Banner。必須包含非授權用戶禁止登錄的字樣
4、禁用DNS查找
switch(config)#no ip domain-lookup