第一篇:思科三層交換機配置總結
思科交換機的基本配置命令學習
CISCO交換機基本配置:Console端口連接 用戶模式hostname# ;
特權模式hostname(config)# ;
全局配置模式hostname(config-if)# ; 交換機口令設置:
switch>enable ;進入特權模式
switch#config terminal ;進入全局配置模式
switch(config)#hostname csico ;設置交換機的主機名 switch(config)#enable secret csico1 ;設置特權加密口令 switch(config)#enable password csico8 ;設置特權非密口令 switch(config)#line console 0 ;進入控制臺口 switch(config-line)#line vty 0 4 ;進入虛擬終端 switch(config-line)#login ;虛擬終端允許登錄
switch(config-line)#password csico6 ;設置虛擬終端登錄口令csico6 switch#exit ;返回命令
交換機VLAN創建,刪除,端口屬性的設置,配置trunk端口,將某端口加入vlan中,配置VTP: switch#vlan database ;進入VLAN設置 switch(vlan)#vlan 2 ;建VLAN 2
switch(vlan)#vlan 3 name vlan3 ;建VLAN 3并命名為vlan3 switch(vlan)#no vlan 2 ;刪vlan 2 switch(config)#int f0/1 ;進入端口1
switch(config)#speed ? 查看speed命令的子命令
switch(config)#speed 100 設置該端口速率為100mb/s(10/auto)switch(config)#duplex ? 查看duplex的子命令
switch(config)#duplex full 設置該端口為全雙工(auto/half)
switch(config)#description TO_PC1 這是該端口描述為TO_PC1 switch(config-if)#switchport access vlan 2 ;當前端口加入vlan 2
switch(config-if)#switchport mode trunk ;設置為trunk模式(access模式)switch(config-if)#switchport trunk allowed vlan 1,2 ;設置允許的vlan switch(config-if)#switchport trunk encap dot1q ;設置vlan 中繼 switch(config)#vtp domain vtpserver ;設置vtp域名相同 switch(config)#vtp password ;設置發vtp密碼 switch(config)#vtp server ;設置vtp服務器模式 switch(config)#vtp client ;設置vtp客戶機模式
交換機設置IP地址,默認網關,域名,域名服務器,配置和查看MAC地址表: switch(config)#interface vlan 1 ;進入vlan 1
switch(config-if)#ip address 192.168.1.1 255.255.255.0 ;設置IP地址 switch(config)#ip default-gateway 192.168.1.6 ;設置默認網關 switch(config)#ip domain-name cisco.com 設置域名
switch(config)#ip name-server 192.168.1.18 設置域名服務器
switch(config)#mac-address-table? 查看mac-address-table的子命令
switch(config)#mac-address-table aging-time 100 設置超時時間為100ms
switch(config)#mac-address-table permanent 0000.0c01.bbcc f0/3 加入永久地址在f0/3端口
switch(config)#mac-address-table restricted static 0000.0c02.bbcc f0/6 f0/7 加入靜態地址目標端口f0/6源端口f0/7
switch(config)#end switch#show mac-address-table 查看整個MAC地址表
switch#clear mac-address-table restricted static 清除限制性靜態地址 交換機顯示命令:
switch#write ;保存配置信息
switch#show vtp ;查看vtp配置信息 switch#show run ;查看當前配置信息 switch#show vlan ;查看vlan配置信息 switch#show interface ;查看端口信息 switch#show int f0/0 ;查看指定端口信息
switch#show int f0/0 status;查看指定端口狀態 switch#dir flash: ;查看閃存
Cisco路由器配置命令大全網絡 2010-06-26 06:43:44 閱讀657 評論0 字號:大中小 訂閱.(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中的配置信息 copy 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協議
network +直連網段 發布直連網段 interface lookback 0 激活邏輯接口
passive-interface +接口類型+接口號 配置接口為被動模式 debug ip +協議 動態查看路由更新信息 undebug all 關閉所有DEBUG信息
router eigrp +as號 激活EIGRP路由協議 network +網段+子網掩碼 發布直連網段 show ip eigrp neighbors 查看鄰居表 show ip eigrp topology 查看拓撲表 show ip eigrp traffic 查看發送包數量 router ospf +process-ID 激活OSPF協議
network+直連網段+area+區域號 發布直連網段 show ip ospf 顯示OSPF的進程號和ROUTER-ID encapsulation+封裝格式 更改封裝格式
no ip admain-lookup 關閉路由器的域名查找 ip routing 在三層交換機上啟用路由功能 show user 查看SW的在線用戶 clear line +線路號 清除線路 3.三層交換機配置命令 配置一組二層端口 configure terminal 進入配置狀態
nterface range {port-range} 進入組配置狀態 配置三層端口
configure terminal 進入配置狀態
interface {{fastethernet | gigabitethernet} interface-id} | {vlan vlan-id} | {port-channel port-channel-number} 進入端口配置狀態 no switchport 把物理端口變成三層口
ip address ip_address subnet_mask 配置IP地址和掩碼 no shutdown 激活端口 例:
Switch(config)# interface gigabitethernet0/2 Switch(config-if)# no switchport
Switch(config-if)# ip address 192.20.135.21 255.255.255.0 Switch(config-if)# no shutdown 配置VLAN
configure terminal 進入配置狀態
vlan vlan-id 輸入一個VLAN號, 然后進入vlan配態,可以輸入一個新的VLAN號或舊的來進行修改。
name vlan-name 可選)輸入一個VLAN名,如果沒有配置VLAN名,缺省的名字是VLAN號前面用0填滿 的4位數,如VLAN0004是VLAN4的缺省名字 mtu mtu-size(可選)改變MTU大小 例
Switch# configure terminal Switch(config)# vlan 20
Switch(config-vlan)# name test20 Switch(config-vlan)# end 或
Switch# vlan database
Switch(vlan)# vlan 20 name test20 Switch(vlan)# exit
將端口分配給一個VLAN
configure terminal 進入配置狀態
interface interface-id 進入要分配的端口 switchport mode access 定義二層口
switchport access vlan vlan-id 把端口分配給某一VLAN 例
Switch# configure terminal
Enter configuration commands, one per line.End with CNTL/Z.Switch(config)# interface fastethernet0/1 Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan 2 Switch(config-if)# end Switch#
配置VLAN trunk
configure terminal 進入配置狀態
interface interface-Id 進入端口配置狀態
switchport trunk encapsulation {isl | dot1q | negotiate}配置trunk封裝ISL 或 802.1Q 或 自動協商 switchport mode {dynamic {auto | desirable} | trunk} 配置二層trunk模式。dynamic auto—自動協商是否成為trunk
dynamic desirable—把端口設置為trunk如果對方端口是trunk, desirable, 配置Native VLAN(802.1q)
或自動模式,trunk—設置端口為強制的trunk方式,而不理會對方端口是否為trunk switchport access vlan vlan-id 可選)指定一個缺省VLAN, 如果此端口不再是trunk switchport trunk native vlan vlan-id 指定802.1Q native VLAN號 例:
Switch# configure terminal
Enter configuration commands, one per line.End with CNTL/Z.Switch(config)# interface fastethernet0/4 Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk encapsulation dot1q Switch(config-if)# end
定義TRUNK允許的VLAN
configure terminal子 進入配置狀態 interface interface-id 進入端口配置
switchport mode trunk 配置二層口為trunk
switchport trunk allowed vlan {add | all | except | remove} vlan-list可選)配置trunk允 許的VLAN.使用add, all, except, remove關健字
no switchport trunk allowed vlan 允許所有VLAN通過 例
Switch(config)# interface fastethernet0/1
Switch(config-if)# switchport trunk allowed vlan remove 2 Switch(config-if)# end
配置Native VLAN(802.1q)configure terminal 進入配置狀態
interface interface-id 進入配置成802.1qtrunk的端口 switchport trunk native vlan vlan-Id 配置native VLAN號
no switchport trunk native vlan 端口配置命令回到缺省的狀態 配置基于端口權值的負載均衡
configure terminal 進入Switch 1配置狀態 vtp domain domain-name 配置VTP域
vtp mode server 將Switch 1配置成VTP server.show vtp status 驗證VTP的配置 show vlan 驗證VLAN
configure terminal 進入配置狀態
interface fastethernet 0/1 進入F0/1端口
switchport trunk encapsulation {isl | dot1q | negotiate}配置trunk封裝 switchport mode trunk 配置成trunk
show interfaces fastethernet0/1 switchport 驗證VLAN配置 按以上步驟對想要負載均衡的接口進行配置 在另一個交換機上進行此配置
show vlan 當trunk已經起來,在switch2上驗證已經學到相的vlan配置 configure terminal 在Switch 1上進入配置狀態 interface fastethernet0/1 進入要配置的端口
spanning-tree vlan 8 port-priority 10 將端口權值10賦與VLAN 8.spanning-tree vlan 9 port-priority 10 將端口權值10賦與VLAN 9.spanning-tree vlan 10 port-priority 10 將端口權值10賦與VLAN 10.interface fastethernet0/2 進入F0/2
spanning-tree vlan 3 port-priority 10 將端口權值10賦與VLAN 3.spanning-tree vlan 4 port-priority 10 將端口權值10賦與VLAN 4 spanning-tree vlan 5 port-priority 10 將端口權值10賦與VLAN 5 spanning-tree vlan 6 port-priority 10 將端口權值10賦與VLAN 10 end 退出
show running-config 驗證配置
copy running-config startup-config 保存配置 配置STP路徑值的負載均衡
Trunk1走VLAN8-10,Trunk2走VLAN2-4 configure terminal 進入 Switch 1配置狀態 interface fastethernet 0/1 進入F0/1
switchport trunk encapsulation {isl | dot1q | negotiate}配置封裝 switchport mode trunk 配置Trunk,缺省是ISL封裝 exit 退回
在F0/2口上重復2-4步驟 exit 退回
show running-config 驗證配置
show vlan驗證switch1 已經學到Vlan configure terminal 進入配置狀態 interface fastethernet 0/1 進入F0/1
spanning-tree vlan 2 cost 30 設置Vlan2生成樹路徑值為30 spanning-tree vlan 3 cost 30 設置Vlan3生成樹路徑值為30 spanning-tree vlan 4 cost 30 設置Vlan4生成樹路徑值為30 end 退出
在switch1的F0/2上重復9-11步驟設置VLAN8,9,10生成樹路徑值為30 end 退出
show running-config 驗證配置
copy running-config startup-config 保存配置 補充:CISCO命令集——路由選擇協議及排障 *ip route命令
Router(config)# ip route <目錄網絡或子網號> [子網掩碼] <下一路由器IP地址 | 從本地出口 的地址> [管理距離0~255,默認為1](注:靜態地址配置)*ip default-network命令
Router(config)# ip default-network <目標網絡號>
(注:配合路由協使用,用其中的一個動態路由號作默認路由配置)
Router(config)# ip route 0.0.0.0 0.0.0.0 <下一路由器IP地址 | 從本地出口的地址>(注:只有一個公網地址時,在出口路由器上的配置)*內部路由選擇協議
*使用router和network命令
Router(config)# router <路由協議rip | igrp | eigrp | ospf | is-is等> [自主系統號] Router(config-router)# network <直接相連的要用此路由協議的網絡號> Router(config-router)# network <直接相連的要用此路由協議的網絡號> *路由信息協議RIP
Router(config)# router rip Router(config-router)# network <直接相連的要用rip協議的有類別網絡號> Router# show ip protocols Router# show ip route Router# debug ip rip
*內部網關路由協議IGRP
Router(config)# router igrp <自主系統號>
Router(config-router)# network <直接相連的要用igrp協議的有類別網絡號> Router# show ip interface Router# show ip protocols Router# show ip route Router# debug ip rip *排除網絡故障
排除網絡故障的一個總體模型
Router# ping <有故障的主機 | 有故障的IP地址> Router# show ip route
Router# show interface <有故障的接口> Router# show run *IP的故故障排除 檢查可用的路由
Router# show ip route <有故障的IP地址> 27.4.4 跟蹤路由(Tracing the Route)
SUN-A> traceroute <有故障的主機 | 有故障的IP地址> C:/windows/> winipcfg C:/windows/> ipconfig C:/windows/> ipconfig / all
C:/windows/> tracert <有故障的主機 | 有故障的IP地址> 使用擴展的ping來跟蹤連接性 Router# ping
*其它可能的故障
一個地址解析(ARP)的故障 Router# show arp
Router# show interface <有故障的接口> C:/windows/> arp-a SUN-A> arp –a
驗證終端系統的路由表 C:/windows/> netstat –rn
C:/windows/> route –f add 0.0.0.0 mask 0.0.0.0 <需要添加入的網關地址> C:/windows/> route [–f ] [[print | add | delete | change] [destination] [mask netmask] [gateway]]
C:/windows/> route add mask <網絡掩碼> <網關ip地址> C:/windows/> route delete mask <網絡掩碼> <網關ip地址> C:/windows/> nbtstat <相應的參數> SUN-A> netstat-rn路由器
CISCO交換機配置命令大全2009-08-13 21:131.在基于IOS的交換機上設置主機名/系統名: switch(config)# hostname hostname
在基于CLI的交換機上設置主機名/系統名: switch(enable)set system name name-string 2.在基于IOS的交換機上設置登錄口令:
switch(config)# enable password level 1 password 在基于CLI的交換機上設置登錄口令: switch(enable)set password switch(enable)set enalbepass
3.在基于IOS的交換機上設置遠程訪問: switch(config)# interface vlan 1
switch(config-if)# ip address ip-address netmask switch(config-if)# ip default-gateway ip-address 在基于CLI的交換機上設置遠程訪問:
switch(enable)set interface sc0 ip-address netmask broadcast-address switch(enable)set interface sc0 vlan
switch(enable)set ip route default gateway
4.在基于IOS的交換機上啟用和瀏覽CDP信息: switch(config-if)# cdp enable switch(config-if)# no cdp enable
為了查看Cisco鄰接設備的CDP通告信息: switch# show cdp interface [type modle/port]
switch# show cdp neighbors [type module/port] [detail] 在基于CLI的交換機上啟用和瀏覽CDP信息: switch(enable)set cdp {enable|disable} module/port 為了查看Cisco鄰接設備的CDP通告信息:
switch(enable)show cdp neighbors[module/port] [vlan|duplex|capabilities|detail] 5.基于IOS的交換機的端口描述:
switch(config-if)# description description-string 基于CLI的交換機的端口描述:
switch(enable)set port name module/number description-string 6.在基于IOS的交換機上設置端口速度: switch(config-if)# speed{10|100|auto} 在基于CLI的交換機上設置端口速度:
switch(enable)set port speed moudle/number {10|100|auto} switch(enable)set port speed moudle/number {4|16|auto} 7.在基于IOS的交換機上設置以太網的鏈路模式: switch(config-if)# duplex {auto|full|half}
在基于CLI的交換機上設置以太網的鏈路模式:
switch(enable)set port duplex module/number {full|half} 8.在基于IOS的交換機上配置靜態VLAN: switch# vlan database
switch(vlan)# vlan vlan-num name vla switch(vlan)# exit
switch# configure teriminal
switch(config)# interface interface module/number switch(config-if)# switchport mode access
switch(config-if)# switchport access vlan vlan-num switch(config-if)# end
在基于CLI的交換機上配置靜態VLAN: switch(enable)set vlan vlan-num [name name]
switch(enable)set vlan vlan-num mod-num/port-list 9.在基于IOS的交換機上配置VLAN中繼線: switch(config)# interface interface mod/port switch(config-if)# switchport mode trunk
switch(config-if)# switchport trunk encapsulation {isl|dotlq} switch(config-if)# switchport trunk allowed vlan remove vlan-list switch(config-if)# switchport trunk allowed vlan add vlan-list 在基于CLI的交換機上配置VLAN中繼線:
switch(enable)set trunk module/port [on|off|desirable|auto|nonegotiate] Vlan-range [isl|dotlq|dotl0|lane|negotiate]
10.在基于IOS的交換機上配置VTP管理域: switch# vlan database
switch(vlan)# vtp domain domain-name 在基于CLI的交換機上配置VTP管理域: switch(enable)set vtp [domain domain-name] 11.在基于IOS的交換機上配置VTP 模式: switch# vlan database
switch(vlan)# vtp domain domain-name switch(vlan)# vtp {sever|cilent|transparent} switch(vlan)# vtp password password 在基于CLI的交換機上配置VTP 模式:
switch(enable)set vtp [domain domain-name] [mode{ sever|cilent|transparent }][password password] 12.在基于IOS的交換機上配置VTP版本: switch# vlan database
switch(vlan)# vtp v2-mode
在基于CLI的交換機上配置VTP版本: switch(enable)set vtp v2 enable
13.在基于IOS的交換機上啟動VTP剪裁: switch# vlan database switch(vlan)# vtp pruning
在基于CL I 的交換機上啟動VTP剪裁: switch(enable)set vtp pruning enable
14.在基于IOS的交換機上配置以太信道:
switch(config-if)# port group group-number [distribution {source|destination}] 在基于CLI的交換機上配置以太信道:
switch(enable)set port channel moudle/port-range mode{on|off|desirable|auto} 15.在基于IOS的交換機上調整根路徑成本:
switch(config-if)# spanning-tree [vlan vlan-list] cost cost 在基于CLI的交換機上調整根路徑成本:
switch(enable)set spantree portcost moudle/port cost
switch(enable)set spantree portvlancost moudle/port [cost cost][vlan-list] 16.在基于IOS的交換機上調整端口ID:
switch(config-if)# spanning-tree[vlan vlan-list]port-priority port-priority 在基于CLI的交換機上調整端口ID:
switch(enable)set spantree portpri {mldule/port}priority
switch(enable)set spantree portvlanpri {module/port}priority [vlans] 17.在基于IOS的交換機上修改STP時鐘:
switch(config)# spanning-tree [vlan vlan-list] hello-time seconds switch(config)# spanning-tree [vlan vlan-list] forward-time seconds ` switch(config)# spanning-tree [vlan vlan-list] max-age seconds 在基于CLI的交換機上修改STP時鐘:
switch(enable)set spantree hello interval[vlan] switch(enable)set spantree fwddelay delay [vlan] switch(enable)set spantree maxage agingtiame[vlan]
18.在基于IOS的交換機端口上啟用或禁用Port Fast 特征: switch(config-if)#spanning-tree portfast
在基于CLI的交換機端口上啟用或禁用Port Fast 特征:
switch(enable)set spantree portfast {module/port}{enable|disable} 19.在基于IOS的交換機端口上啟用或禁用UplinkFast 特征:
switch(config)# spanning-tree uplinkfast [max-update-rate pkts-per-second] 在基于CLI的交換機端口上啟用或禁用UplinkFast 特征:
switch(enable)set spantree uplinkfast {enable|disable}[rate update-rate] [all-protocols off|on]
20.為了將交換機配置成一個集群的命令交換機,首先要給管理接口分配一個IP地址,然后使用下列命令: switch(config)# cluster enable cluster-name
21.為了從一條中繼鏈路上刪除VLAN,可使用下列命令: switch(enable)clear trunk module/port vlan-range 22.用show vtp domain 顯示管理域的VTP參數.23.用show vtp statistics顯示管理域的VTP參數.24.在Catalyst交換機上定義TrBRF的命令如下:
switch(enable)set vlan vlan-name [name name] type trbrf bridge bridge-num[stp {ieee|ibm}] 25.在Catalyst交換機上定義TrCRF的命令如下:
switch(enable)set vlan vlan-num [name name] type trcrf
{ring hex-ring-num|decring decimal-ring-num} parent vlan-num
26.在創建好TrBRF VLAN之后,就可以給它分配交換機端口.對于以太網交換,可以采用如下命令給VLAN分配端口:
switch(enable)set vlan vlan-num mod-num/port-num
27.命令show spantree顯示一個交換機端口的STP狀態.28.配置一個ELAN的LES和BUS,可以使用下列命令: ATM(config)# interface atm number.subint multioint ATM(config-subif)# lane serber-bus ethernet elan-name 29.配置LECS:
ATM(config)# lane database database-name
ATM(lane-config-databade)# name elan1-name server-atm-address les1-nsap-address ATM(lane-config-databade)# name elan2-name server-atm-address les2-nsap-address ATM(lane-config-databade)# name …
30.創建完數據庫后,必須在主接口上啟動LECS.命令如下: ATM(config)# interface atm number
ATM(config-if)# lane config database database-name ATM(config-if)# lane config auto-config-atm-address
31.將每個LEC配置到一個不同的ATM子接口上.命令如下: ATM(config)# interface atm number.subint multipoint ATM(config)# lane client ethernet vlan-num elan-num 32.用show lane server 顯示LES的狀態.33.用show lane bus顯示bus的狀態.34.用show lane database顯示LECS數據庫可內容.35.用show lane client顯示LEC的狀態.36.用show module顯示已安裝的模塊列表.37.用物理接口建立與VLAN的連接: router# configure terminal
router(config)# interface media module/port router(config-if)# description description-string router(config-if)# ip address ip-addr subnet-mask router(config-if)# no shutdown
38.用中繼鏈路來建立與VLAN的連接:
router(config)# interface module/port.subinterface
router(config-ig)# encapsulation[isl|dotlq] vlan-number router(config-if)# ip address ip-address subnet-mask 39.用LANE 來建立與VLAN的連接: router(config)# interface atm module/port router(config-if)# no ip address
router(config-if)# atm pvc 1 0 5 qsaal router(config-if)# atm pvc 2 0 16 ilni
router(config-if)# interface atm module/port.subinterface multipoint router(config-if)# ip address ip-address subnet-mask router(config-if)# lane client ethernet elan-num
router(config-if)# interface atm module/port.subinterface multipoint router(config-if)# ip address ip-address subnet-name router(config-if)# lane client ethernet elan-name router(config-if)# …
40.為了在路由處理器上進行動態路由配置,可以用下列IOS命令來進行: router(config)# ip routing
router(config)# router ip-routing-protocol
router(config-router)# network ip-network-number router(config-router)# network ip-network-number 41.配置默認路由:
switch(enable)set ip route default gateway
42.為一個路由處理器分配VLANID,可在接口模式下使用下列命令: router(config)# interface interface number router(config-if)# mls rp vlan-id vlan-id-num 43.在路由處理器啟用MLSP: router(config)# mls rp ip
44.為了把一個外置的路由處理器接口和交換機安置在同一個VTP域中: router(config)# interface interface number
router(config-if)# mls rp vtp-domain domain-name 45.查看指定的VTP域的信息:
router# show mls rp vtp-domain vtp domain name
46.要確定RSM或路由器上的管理接口,可以在接口模式下輸入下列命令: router(config-if)#mls rp management-interface 47.要檢驗MLS-RP的配置情況: router# show mls rp
48.檢驗特定接口上的MLS配置:
router# show mls rp interface interface number
49.為了在MLS-SE上設置流掩碼而又不想在任一個路由處理器接口上設置訪問列表: set mls flow [destination|destination-source|full]
50.為使MLS和輸入訪問列表可以兼容,可以在全局模式下使用下列命令: router(config)# mls rp ip input-acl
51.當某個交換機的第3層交換失效時,可在交換機的特權模式下輸入下列命令: switch(enable)set mls enable
52.若想改變老化時間的值,可在特權模式下輸入以下命令: switch(enable)set mls agingtime agingtime 53.設置快速老化:
switch(enable)set mls agingtime fast fastagingtime pkt_threshold
54.確定那些MLS-RP和MLS-SE參與了MLS,可先顯示交換機引用列表中的內容再確定: switch(enable)show mls include 55.顯示MLS高速緩存記錄: switch(enable)show mls entry
56.用命令show in arp顯示ARP高速緩存區的內容。
57.要把路由器配置為HSRP備份組的成員,可以在接口配置模式下使用下面的命令: router(config-if)# standby group-number ip ip-address 58.為了使一個路由器重新恢復轉發路由器的角色,在接口配置模式下: router(config-if)# standy group-number preempt 59.訪問時間和保持時間參數是可配置的:
router(config-if)# standy group-number timers hellotime holdtime 60.配置HSRP跟蹤:
router(config-if)# standy group-number track type-number interface-priority 61.要顯示HSRP路由器的狀態:
router# show standby type-number group brief 62.用命令show ip igmp確定當選的查詢器。63.啟動IP組播路由選擇:
router(config)# ip muticast-routing 64.啟動接口上的PIM:
dalllasr1>(config-if)# ip pim {dense-mode|sparse-mode|sparse-dense-mode} 65.啟動稀疏-稠密模式下的PIM: router# ip multicast-routing router# interface type number router# ip pim sparse-dense-mode 66.核實PIM的配置:
dallasr1># show ip pim interface[type number] [count] 67.顯示PIM鄰居:
dallasr1># show ip neighbor type number 68.為了配置RP的地址,命令如下:
dallasr1># ip pim rp-address ip-address [group-access-list-number][override] 69.選擇一個默認的RP: dallasr1># ip pim rp-address
通告RP和它所服務的組范圍:
dallasr1># ip pim send-rp-announce type number scope ttl group-list access-list-number 為管理范圍組通告RP的地址:
dallasr1># ip pim send-rp-announce ethernet0 scope 16 group-list1 dallasr1># access-list 1 permit 266.0.0.0 0.255.255.255 設定一個RP映像代理:
dallasr1># ip pim send-rp-discovery scope ttl 核實組到RP的映像:
dallasr1># show ip pim rp mapping
dallasr1># show ip pim rp [group-name|group-address] [mapping]
70.在路由器接口上用命令ip multicast ttl-threshold ttl-value設定TTL閥值: dallasr1>(config-if)# ip multicast ttl-threshold ttl-value 71.用show ip pim neighbor顯示PIM鄰居表。72.顯示組播通信路由表中的各條記錄:
dallasr1>show ip mroute [group-name|group-address][scoure][summary][count][active kbps] 73.要記錄一個路由器接受和發送的全部IP組播包: dallasr1> #debug ip mpacket [detail] [access-list][group] 74.要在CISCO路由器上配置CGMP: dallasr1>(config-if)# ip cgmp
75.配置一個組播路由器,使之加入某一個特定的組播組: dallasr1>(config-if)# ip igmp join-group group-address 76.關閉 CGMP:
dallasr1>(config-if)# no ip cgmp 77.啟動交換機上的CGMP: dallasr1>(enable)set cgmp enable 78.核實Catalyst交換機上CGMP的配置情況: catalystla1>(enable)show config set prompt catalystla1>
set interface sc0 192.168.1.1 255.255.255.0 set cgmp enable
79.CGMP離開的設置:
Dallas_SW(enable)set cgmp leave
80.在Cisco設備上修改控制端口密碼: R1(config)# line console 0 R1(config-line)# login
R1(config-line)# password Lisbon R1(config)# enable password Lilbao R1(config)# login local
R1(config)# username student password cisco
81.在Cisco設備上設置控制臺及vty端口的會話超時: R1(config)# line console 0
R1(config-line)# exec-timeout 5 10 R1(config)# line vty 0 4
R1(config-line)# exec-timeout 5 2 82.在Cisco設備上設定特權級:
R1(config)# privilege configure level 3 username R1(config)# privilege configure level 3 copy run start R1(config)# privilege configure level 3 ping R1(config)# privilege configure level 3 show run R1(config)# enable secret level 3 cisco
83.使用命令privilege 可定義在該特權級下使用的命令: router(config)# privilege mode level level command 84.設定用戶特權級:
router(config)# enable secret level 3 dallas router(config)# enable secret san-fran
router(config)# username student password cisco 85.標志設置與顯示:
R1(config)# banner motd ‘unauthorized access will be prosecuted!’ 86.設置vty訪問:
R1(config)# access-list 1 permit 192.168.2.5 R1(config)# line vty 0 4
R1(config)# access-class 1 in 87.配置HTTP訪問:
Router3(config)# access-list 1 permit 192.168.10.7 Router3(config)# ip http sever
Router3(config)# ip http access-class 1
Router3(config)# ip http authentication local
Router3(config)# username student password cisco 88.要啟用HTTP訪問,請鍵入以下命令: switch(config)# ip http sever
89.在基于set命令的交換機上用setCL1啟動和核實端口安全:
switch(enable)set port security mod_num/port_num…enable mac address switch(enable)show port mod_num/port_num
在基于CiscoIOS命令的交換機上啟動和核實端口安全:
switch(config-if)# port secure [mac-mac-count maximum-MAC-count] switch# show mac-address-table security [type module/port] 90.用命令access-list在標準通信量過濾表中創建一條記錄:
Router(config)# access-list access-list-number {permit|deny} source-address [source-address] 91.用命令access-list在擴展通信量過濾表中創建一條記錄:
Router(config)# access-list access-list-number {permit|deny{protocol|protocol-keyword}}{source source-wildcard|any}{destination destination-wildcard|any}[protocol-specific options][log] 92.對于帶內路由更新,配置路由更新的最基本的命令格式是:
R1(config-router)#distribute-list access-list-number|name in [type number] 93.對于帶外路由更新,配置路由更新的最基本的命令格式是:
R1(config-router)#distribute-list access-list-number|name out [interface-name] routing-process| autonomous-system-number
94.set snmp命令選項:
set snmp community {read-only|ready-write|read-write-all}[community_string] 95.set snmp trap 命令格式如下: set snmp trap {enable|disable}
[all|moudle|classis|bridge|repeater| auth|vtp|ippermit|vmps|config|entity|stpx] set snmp trap rvcr_addr rcvr_community 96.啟用SNMP chassis 陷阱:
Console>(enable)set snmp trap enable chassis 97.啟用所有SNMP chassis 陷阱: Console>(enable)set snmp trap enable 98.禁用SNMP chassis 陷阱:
Console>(enable)set snmp trap disable chassis 99.給SNMP陷阱接收表加一條記錄:
Console>(enable)set snmp trap 192.122.173.42 public 100.show snmp 輸出結果。
101.命令set snmp rmon enable 的輸出結果。102.顯示SPAN信息: Consile> show span 一些華為路由器命令: 刪除設備配置
reset saved-configuration 重啟 reboot
看當前配置文件
display current-configuration 改設備名 sysname 保存配置 save
進入特權模式 sysview
華為只有2層模式 不像cisco enale之后還要conf t 定義acl
acl nubmere XXXX(3000以上)進入以后
rule permit/deny IP/TCP/UDP等 source XXX.XXX.XXX.XXX XXX.XXX.XXX.XXX(反向)destination XXX.XXX.XXX.XXX XXX.XXX.XXX.XXX(反向)eq 注意 華為默認沒有deny any any 防火墻上端口加載ACL
[Quidway-Ethernet0/0]firewall packet-filter 3000 inbound 防火墻上新增加用戶 local-user XXX(用戶名)password simple XXX(密碼)local-user XXX service-type ppp 刪除某條命令
undo(類似與cisco的no)靜態路由
ip route-static 0.0.0.0 0.0.0.0 XXX.XXX.XXX.XXX 對vpdn用戶設置acl的接口 inte***ce Virtual-Template1 查看路由表
display ip routing-table 設定telnet密碼
user-inte***ce vty 0 4 user privilege level 3
set authentication password simple XXX 啟動/關閉 啟動 un shut 關閉 shut 動態nat設置 acl number 3000
rule 0 permit ip source XXX.XXX.XXX.XXX rule 1 permit ip source XXX.XXX.XXX.XXX rule 2 permit ip source XXX.XXX.XXX.XXX inte***ce Ethernet1/0
des cription ====To-Internet(WAN)====
ip address XXX.XXX.XXX.XXX XXX.XXX.XXX.XXX nat outbound 3000 ipsec policy policy1
利用acl來做 符合acl的IP地址可以出去(注意 此處的ACL隱含了deny any any)不符合的IP地址不可以出去 創建vlan
[shzb-crsw-s6506-1]vlan 100 華為vlan不支持name 將port放入vlan
創建了vlan后 進入vlan模式
[shzb-crsw-s6506-1-vlan100]port GigabitEthernet 1/0/1 to GigabitEthernet 1/0/8 表示從G1/0/1 到1/0/8放入VLAN 100 創建trunk
inte***ce GigabitEthernet1/0/1 duplex full speed 1000
* port link-type trunk
* port trunk permit vlan all port link-aggregation group 1
帶*號的是創建trunk鏈路的語句 vlan地址指定
inte***ce Vlan-inte***ce2 des cription server
ip address XXX.XXX.XXX.XXX XXX.XXX.XXX.XXX vrrp vrid 2 virtual-ip XXX.XXX.XXX.XXX vrrp vrid 2 priority 120 vrrp vrid 2 preempt-mode timer delay 10 其中vrrp語句指定vrrp 類似與hsrp 使用vrrp要注意的是華為不支持pvst 只能一臺完全是主,一臺完全是備份 在主vrrp設備上要指定 stp instance 0 root primary stp TC-protection enable stp enable
在從vrrp設備上要指定 stp instance 0 root secondary stp TC-protection enable stp enable
交換機下面綁acl
首先進入接口模式,輸入qos命令
[shzb-crsw-s6506-1-GigabitEthernet1/0/1]qos 在輸入如下命令
[shzb-crsw-s6506-1-qoss-GigabitEthernet1/0/1]packet-filter inbound ip-group 3000 華為交換機只能指定inbound方向 啟用ospf
[shzb-crsw-s6506-1]ospf 100
[shzb-crsw-s6506-1-ospf-100]area 0
[shzb-crsw-s6506-1-ospf-100-area-0.0.0.0]network XXX.XXX.XXX.XXX XXX.XXX.XXX.XXX 配置ospf重發布
[shzb-crsw-s6506-1-ospf-100-area-0.0.0.0]quit [shzb-crsw-s6506-1-ospf-100]import-route static
建立link-group(類似與cisco的channel-group)link-aggregation group 1 mode manual 然后進入接口
port link-aggregation group 1 啟用VRRP之前必須輸入 vrrp ping-enable
使得客戶能ping網關
第二篇:思科交換機配置命令總結
思科交換機配置命令總結
1.switch(config)# hostname hostname 在基于CLI的交換機上設置主機名/系統名: switch(enable)set system name name-string 2.在基于IOS的交換機上設置登錄口令: switch(config)# enable password level 1 password 在基于CLI的交換機上設置登錄口令: switch(enable)set password switch(enable)set enalbepass 3.在基于IOS的交換機上設置遠程訪問: switch(config)# interface vlan 1 switch(config-if)# ip address ip-address netmask switch(config-if)# ip default-gateway ip-address 在基于CLI的交換機上設置遠程訪問: switch(enable)set interface sc0 ip-address netmask broadcast-address switch(enable)set interface sc0 vlan switch(enable)set ip route default gateway 4.在基于IOS的交換機上啟用和瀏覽CDP信息: switch(config-if)# cdp enable switch(config-if)# no cdp enable 為了查看Cisco鄰接設備的CDP通告信息: switch# show cdp interface [type modle/port] switch# show cdp neighbors [type module/port] [detail] 在基于CLI的交換機上啟用和瀏覽CDP信息: switch(enable)set cdp {enable|disable} module/port 為了查看Cisco鄰接設備的CDP通告信息: switch(enable)show cdp neighbors[module/port] [vlan|duplex|capabilities|detail] 5.基于IOS的交換機的端口描述: switch(config-if)# description description-string 基于CLI的交換機的端口描述: switch(enable)set port name module/number description-string 6.在基于IOS的交換機上設置端口速度: switch(config-if)# speed{10|100|auto} 在基于CLI的交換機上設置端口速度: switch(enable)set port speed moudle/number {10|100|auto} switch(enable)set port speed moudle/number {4|16|auto} 7.在基于IOS的交換機上設置以太網的鏈路模式: switch(config-if)# duplex {auto|full|half} 在基于CLI的交換機上設置以太網的鏈路模式: switch(enable)set port duplex module/number {full|half} 8.在基于IOS的交換機上配置靜態VLAN: switch# vlan database switch(vlan)# vlan vlan-num name vla switch(vlan)# exit switch# configure teriminal switch(config)# interface interface module/number switch(config-if)# switchport mode access switch(config-if)# switchport access vlan vlan-num switch(config-if)# end 在基于CLI的交換機上配置靜態VLAN: switch(enable)set vlan vlan-num [name name] switch(enable)set vlan vlan-num mod-num/port-list 9.在基于IOS的交換機上配置VLAN中繼線: switch(config)# interface interface mod/port switch(config-if)# switchport mode trunk switch(config-if)# switchport trunk encapsulation {isl|dotlq} switch(config-if)# switchport trunk allowed vlan remove vlan-list switch(config-if)# switchport trunk allowed vlan add vlan-list 在基于CLI的交換機上配置VLAN中繼線: switch(enable)set trunk module/port [on|off|desirable|auto|nonegotiate] Vlan-range [isl|dotlq|dotl0|lane|negotiate] 10.在基于IOS的交換機上配置VTP管理域: switch# vlan database switch(vlan)# vtp domain domain-name 在基于CLI的交換機上配置VTP管理域: switch(enable)set vtp [domain domain-name] 11.在基于IOS的交換機上配置VTP 模式: switch# vlan database switch(vlan)# vtp domain domain-name switch(vlan)# vtp {sever|cilent|transparent} switch(vlan)# vtp password password 在基于CLI的交換機上配置VTP 模式: switch(enable)set vtp [domain domain-name] [mode{ sever|cilent|transparent }][password password] 12.在基于IOS的交換機上配置VTP版本: switch# vlan database switch(vlan)# vtp v2-mode 在基于CLI的交換機上配置VTP版本: switch(enable)set vtp v2 enable 13.在基于IOS的交換機上啟動VTP剪裁: switch# vlan database switch(vlan)# vtp pruning 在基于CL I 的交換機上啟動VTP剪裁: switch(enable)set vtp pruning enable 14.在基于IOS的交換機上配置以太信道: switch(config-if)# port group group-number [distribution {source|destination}] 在基于CLI的交換機上配置以太信道: switch(enable)set port channel moudle/port-range mode{on|off|desirable|auto} 15.在基于IOS的交換機上調整根路徑成本: switch(config-if)# spanning-tree [vlan vlan-list] cost cost 在基于CLI的交換機上調整根路徑成本: switch(enable)set spantree portcost moudle/port cost switch(enable)set spantree portvlancost moudle/port [cost cost][vlan-list] 16.在基于IOS的交換機上調整端口ID: switch(config-if)# spanning-tree[vlan vlan-list]port-priority port-priority 在基于CLI的交換機上調整端口ID: switch(enable)set spantree portpri {mldule/port}priority switch(enable)set spantree portvlanpri {module/port}priority [vlans] 17.在基于IOS的交換機上修改STP時鐘: switch(config)# spanning-tree [vlan vlan-list] hello-time seconds switch(config)# spanning-tree [vlan vlan-list] forward-time seconds ` switch(config)# spanning-tree [vlan vlan-list] max-age seconds 在基于CLI的交換機上修改STP時鐘: switch(enable)set spantree hello interval[vlan] switch(enable)set spantree fwddelay delay [vlan] switch(enable)set spantree maxage agingtiame[vlan] 18.在基于IOS的交換機端口上啟用或禁用Port Fast 特征: switch(config-if)#spanning-tree portfast 在基于CLI的交換機端口上啟用或禁用Port Fast 特征: switch(enable)set spantree portfast {module/port}{enable|disable} 19.在基于IOS的交換機端口上啟用或禁用UplinkFast 特征: switch(config)# spanning-tree uplinkfast [max-update-rate pkts-per-second] 在基于CLI的交換機端口上啟用或禁用UplinkFast 特征: switch(enable)set spantree uplinkfast {enable|disable}[rate update-rate] [all-protocols off|on] 20.為了將交換機配置成一個集群的命令交換機,首先要給管理接口分配一個IP地址,然后使用下列命令: switch(config)# cluster enable cluster-name 21.為了從一條中繼鏈路上刪除VLAN,可使用下列命令: switch(enable)clear trunk module/port vlan-range 22.用show vtp domain 顯示管理域的VTP參數.23.用show vtp statistics顯示管理域的VTP參數.24.在Catalyst交換機上定義TrBRF的命令如下: switch(enable)set vlan vlan-name [name name] type trbrf bridge bridge-num[stp {ieee|ibm}] 25.在Catalyst交換機上定義TrCRF的命令如下: switch(enable)set vlan vlan-num [name name] type trcrf {ring hex-ring-num|decring decimal-ring-num} parent vlan-num 26.在創建好TrBRF VLAN之后,就可以給它分配交換機端口.對于以太網交換,可以采用如下命令給VLAN分配端口: switch(enable)set vlan vlan-num mod-num/port-num 27.命令show spantree顯示一個交換機端口的STP狀態.28.配置一個ELAN的LES和BUS,可以使用下列命令: ATM(config)# interface atm number.subint multioint ATM(config-subif)# lane serber-bus ethernet elan-name 29.配置LECS: ATM(config)# lane database database-name ATM(lane-config-databade)# name elan1-name server-atm-address les1-nsap-address ATM(lane-config-databade)# name elan2-name server-atm-address les2-nsap-address ATM(lane-config-databade)# name …
30.創建完數據庫后,必須在主接口上啟動LECS.命令如下: ATM(config)# interface atm number ATM(config-if)# lane config database database-name ATM(config-if)# lane config auto-config-atm-address 31.將每個LEC配置到一個不同的ATM子接口上.命令如下: ATM(config)# interface atm number.subint multipoint ATM(config)# lane client ethernet vlan-num elan-num 32.用show lane server 顯示LES的狀態.33.用show lane bus顯示bus的狀態.34.用show lane database顯示LECS數據庫可內容.35.用show lane client顯示LEC的狀態.36.用show module顯示已安裝的模塊列表.37.用物理接口建立與VLAN的連接: router# configure terminal router(config)# interface media module/port router(config-if)# description description-string router(config-if)# ip address ip-addr subnet-mask router(config-if)# no shutdown 38.用中繼鏈路來建立與VLAN的連接: router(config)# interface module/port.subinterface router(config-ig)# encapsulation[isl|dotlq] vlan-number router(config-if)# ip address ip-address subnet-mask 39.用LANE 來建立與VLAN的連接: router(config)# interface atm module/port router(config-if)# no ip address router(config-if)# atm pvc 1 0 5 qsaal router(config-if)# atm pvc 2 0 16 ilni router(config-if)# interface atm module/port.subinterface multipoint router(config-if)# ip address ip-address subnet-mask router(config-if)# lane client ethernet elan-num router(config-if)# interface atm module/port.subinterface multipoint router(config-if)# ip address ip-address subnet-name router(config-if)# lane client ethernet elan-name router(config-if)# …
40.為了在路由處理器上進行動態路由配置,可以用下列IOS命令來進行: router(config)# ip routing router(config)# router ip-routing-protocol router(config-router)# network ip-network-number router(config-router)# network ip-network-number 41.配置默認路由: switch(enable)set ip route default gateway 42.為一個路由處理器分配VLANID,可在接口模式下使用下列命令: router(config)# interface interface number router(config-if)# mls rp vlan-id vlan-id-num 43.在路由處理器啟用MLSP: router(config)# mls rp ip 44.為了把一個外置的路由處理器接口和交換機安置在同一個VTP域中: router(config)# interface interface number router(config-if)# mls rp vtp-domain domain-name 45.查看指定的VTP域的信息: router# show mls rp vtp-domain vtp domain name 46.要確定RSM或路由器上的管理接口,可以在接口模式下輸入下列命令: router(config-if)#mls rp management-interface 47.要檢驗MLS-RP的配置情況: router# show mls rp 48.檢驗特定接口上的MLS配置:
router# show mls rp interface interface number 49.為了在MLS-SE上設置流掩碼而又不想在任一個路由處理器接口上設置訪問列表: set mls flow [destination|destination-source|full] 50.為使MLS和輸入訪問列表可以兼容,可以在全局模式下使用下列命令: router(config)# mls rp ip input-acl [page] 51.當某個交換機的第3層交換失效時,可在交換機的特權模式下輸入下列命令: switch(enable)set mls enable 52.若想改變老化時間的值,可在特權模式下輸入以下命令: switch(enable)set mls agingtime agingtime 53.設置快速老化:
switch(enable)set mls agingtime fast fastagingtime pkt_threshold 54.確定那些MLS-RP和MLS-SE參與了MLS,可先顯示交換機引用列表中的內容再確定: switch(enable)show mls include 55.顯示MLS高速緩存記錄: switch(enable)show mls entry 56.用命令show in arp顯示ARP高速緩存區的內容。
57.要把路由器配置為HSRP備份組的成員,可以在接口配置模式下使用下面的命令: router(config-if)# standby group-number ip ip-address 58.為了使一個路由器重新恢復轉發路由器的角色,在接口配置模式下: router(config-if)# standy group-number preempt 59.訪問時間和保持時間參數是可配置的:
router(config-if)# standy group-number timers hellotime holdtime 60.配置HSRP跟蹤:
router(config-if)# standy group-number track type-number interface-priority 61.要顯示HSRP路由器的狀態:
router# show standby type-number group brief 62.用命令show ip igmp確定當選的查詢器。63.啟動IP組播路由選擇:
router(config)# ip muticast-routing 64.啟動接口上的PIM:
dalllasr1>(config-if)# ip pim {dense-mode|sparse-mode|sparse-dense-mode} 65.啟動稀疏-稠密模式下的PIM: router# ip multicast-routing router# interface type number router# ip pim sparse-dense-mode 66.核實PIM的配置:
dallasr1># show ip pim interface[type number] [count] 67.顯示PIM鄰居:
dallasr1># show ip neighbor type number 68.為了配置RP的地址,命令如下:
dallasr1># ip pim rp-address ip-address [group-access-list-number][override] 69.選擇一個默認的RP: dallasr1># ip pim rp-address 通告RP和它所服務的組范圍:
dallasr1># ip pim send-rp-announce type number scope ttl group-list access-list-number 為管理范圍組通告RP的地址:
dallasr1># ip pim send-rp-announce ethernet0 scope 16 group-list1 dallasr1># access-list 1 permit 266.0.0.0 0.255.255.255 設定一個RP映像代理:
dallasr1># ip pim send-rp-discovery scope ttl 核實組到RP的映像:
dallasr1># show ip pim rp mapping dallasr1># show ip pim rp [group-name|group-address] [mapping] 70.在路由器接口上用命令ip multicast ttl-threshold ttl-value設定TTL閥值: dallasr1>(config-if)# ip multicast ttl-threshold ttl-value 71.用show ip pim neighbor顯示PIM鄰居表。72.顯示組播通信路由表中的各條記錄:
dallasr1>show ip mroute [group-name|group-address][scoure][summary][count][active kbps] 73.要記錄一個路由器接受和發送的全部IP組播包:
dallasr1> #debug ip mpacket [detail] [access-list][group] 74.要在CISCO路由器上配置CGMP: dallasr1>(config-if)# ip cgmp 75.配置一個組播路由器,使之加入某一個特定的組播組: dallasr1>(config-if)# ip igmp join-group group-address 76.關閉 CGMP:
dallasr1>(config-if)# no ip cgmp 77.啟動交換機上的CGMP:
dallasr1>(enable)set cgmp enable 78.核實Catalyst交換機上CGMP的配置情況: catalystla1>(enable)show config set prompt catalystla1> set interface sc0 192.168.1.1 255.255.255.0 set cgmp enable 79.CGMP離開的設置:
Dallas_SW(enable)set cgmp leave 80.在Cisco設備上修改控制端口密碼: R1(config)# line console 0 R1(config-line)# login R1(config-line)# password Lisbon R1(config)# enable password Lilbao R1(config)# login local R1(config)# username student password cisco 81.在Cisco設備上設置控制臺及vty端口的會話超時: R1(config)# line console 0 R1(config-line)# exec-timeout 5 10 R1(config)# line vty 0 4 R1(config-line)# exec-timeout 5 2 82.在Cisco設備上設定特權級:
R1(config)# privilege configure level 3 username R1(config)# privilege configure level 3 copy run start R1(config)# privilege configure level 3 ping R1(config)# privilege configure level 3 show run R1(config)# enable secret level 3 cisco 83.使用命令privilege 可定義在該特權級下使用的命令: router(config)# privilege mode level level command 84.設定用戶特權級:
router(config)# enable secret level 3 dallas router(config)# enable secret san-fran router(config)# username student password cisco 85.標志設置與顯示:
R1(config)# banner motd ‘unauthorized access will be prosecuted!’ 86.設置vty訪問:
R1(config)# access-list 1 permit 192.168.2.5 R1(config)# line vty 0 4 R1(config)# access-class 1 in 87.配置HTTP訪問:
Router3(config)# access-list 1 permit 192.168.10.7 Router3(config)# ip http sever Router3(config)# ip http access-class 1 Router3(config)# ip http authentication local Router3(config)# username student password cisco 88.要啟用HTTP訪問,請鍵入以下命令: switch(config)# ip http sever 89.在基于set命令的交換機上用setCL1啟動和核實端口安全:
switch(enable)set port security mod_num/port_num…enable mac address switch(enable)show port mod_num/port_num 在基于CiscoIOS命令的交換機上啟動和核實端口安全:
switch(config-if)# port secure [mac-mac-count maximum-MAC-count] switch# show mac-address-table security [type module/port] 90.用命令access-list在標準通信量過濾表中創建一條記錄:
Router(config)# access-list access-list-number {permit|deny} source-address [source-address] 91.用命令access-list在擴展通信量過濾表中創建一條記錄: Router(config)# access-list access-list-number {permit|deny{protocol|protocol-keyword}}{source source-wildcard|any}{destination destination-wildcard|any}[protocol-specific options][log] 92.對于帶內路由更新,配置路由更新的最基本的命令格式是:
R1(config-router)#distribute-list access-list-number|name in [type number] 93.對于帶外路由更新,配置路由更新的最基本的命令格式是:
R1(config-router)#distribute-list access-list-number|name out [interface-name] routing-process| autonomous-system-number 94.set snmp命令選項:
set snmp community {read-only|ready-write|read-write-all}[community_string] 95.set snmp trap 命令格式如下: set snmp trap {enable|disable} [all|moudle|classis|bridge|repeater| auth|vtp|ippermit|vmps|config|entity|stpx] set snmp trap rvcr_addr rcvr_community 96.啟用SNMP chassis 陷阱: Console>(enable)set snmp trap enable chassis 97.啟用所有SNMP chassis 陷阱: Console>(enable)set snmp trap enable 98.禁用SNMP chassis 陷阱: Console>(enable)set snmp trap disable chassis 99.給SNMP陷阱接收表加一條記錄:
Console>(enable)set snmp trap 192.122.173.42 public 100.show snmp 輸出結果。
101.命令set snmp rmon enable 的輸出結果。102.顯示SPAN信息: Consile> show span
第三篇:華為三層交換機配置心得
華為三層交換機配置心得
一、給交換機劃分VLAN
Vlan是虛擬局域網的意思,它相當于一個局域網工作組。“vlan幾”可以理解成編號為幾的vlan,比如vlan 2就是編號為2的vlan,只是一個編號而已,并不是說vlan 2的網段一定要是2網段,vlan 2的IP地址是可以隨便設置的。
下面我將三層交換機的第20個端口添加到vlan 10里,步驟如下:
A、在交換機里添加VLAN 10
system-view
(一般用縮寫:sys)
[Quidway] vlan10
(添加編號為10的vlan)[Quidway-vlan10] quit
(一般縮寫:q)
B、設置vlan 10的IP地址為192.168.66.66 網關為255.255.255.0
[Quidway]interface vlanif 10(interface一般可以縮寫為:int 寫vlan)[Quidway-vlanif10]ip address192.168.66.66
;vlanif也可以只
255.255.255.0(address縮寫add)[Quidway-vlanif10]quit
C、設定交換機上第20個端口模式為access(默認為trunk,需在將端口劃入VLAN前轉為ACCESS)
[Quidway]intgigabitethernet 0/0/20
(gigabitethernet:千兆以太網口)
[Quidway-GigabitEthernet0/0/20]portlink-type access
(port:端口)
[Quidway-GigabitEthernet0/0/20]quit
D.將第20個端口加入到vlan 10里 [Quidway] vlan 10
[Quidway-vlan10] port gigabitethernet 0/0/20(如果是多個連續端口,用XX to XX)[Quidway-Vlan10]quit 這樣就是成功的將交換機上的第20個端口添加到了編號為10的Vlan里,劃分VLAN就是這4個步驟,2個步驟設置vlan,2個步驟設置端口。現在可以用網線把交換機的第20個端口和電腦網卡連接起來,設置網卡地址為192.168.66.XX,網關為192.168.66.66,在CMD里ping192.168.66.66可以ping通。
二、刪除VLAN
A、在系統視圖下,用“undo intvlan 2”命令刪除vlan 2的3層口,這樣vlan 2就沒有了,但是劃分給vlan 2的那些端口依然還處于vlan 2里,這時可以將那些端口釋放出來,讓他們不再屬于任何vlan B.在系統視圖下,用“undo vlan 2”命令刪除2層口,這個命令可以釋放那些原先劃分給了vlan 2的端口,現在它們不屬于任何vlan了。當然,將交換機上的某個端口更換到某個vlan里,是可以直接在vlan視圖里添加端口的。
注意:交換機上的某個端口被設置成了access模式,且加入了一個vlan,要想將這個端口的模式更改為trunk,直接在端口視圖里打上“port link-type trunk”是不行的,會出現Error: Please renew thedefault configurations.這時需要先從VLAN里刪除這個端口,也就是前面說的讓這個端口不屬于任何vlan,才能將這個端口設置為trunk。
三、通過端口進行限速
現在要對交換機上的第2個端口進行限速操作,讓通過這個端口的下載速度不超過128KB/S
配置命令說明:
Inbound:對入端口報文進行限速 Outbound:對出端口報文進行限速
[Quidway]intgigabitethernet 0/0/2 [Quidway-GigabitEthernet0/0/2]qoslr outbound cir1024 cbs 204800(1024代表1M的帶寬,理論下載速度就是128KB/S,204800=1024*200,cbs代表突發信息速率cir代表承諾信息速率)
這個命令執行后,端口2的下載速度就被限制在128KB/S以內,實際測速表明,這個限速數值是該端口數據流量穩定后的速度,它的短暫峰值高出128KB/S很多,這個應該是交換機從偵測端口流量到啟動限速需要一個過程,下載速度穩定后是在128KB/S上下徘徊,效果還是不錯的,比路由器限速和限速軟件的效果都要好很多,最關鍵的交換機穩定。
注:取消限速方法
[Quidway-GigabitEthernet0/0/2]undoqoslr outbound
四、配置基于地址池的DHCP服務器
A.全局啟動DHCP服務。sys
[Quidway] dhcpenable
B.配置IP地址池10的屬性(地址池范圍,dns地址,出口網關,地址池租期)
[Quidway] ip pool10
Info:It'ssuccessful to create an IP address pool.[Quidway-ip-pool-10]network 192.168.10.0 mask 255.255.255.0
[Quidway-ip-pool-10]dns-list 202.103.24.68 [Quidway-ip-pool-10]gateway-list 192.168.10.1 [Quidway-ip-pool-10]lease day 10 [Quidway-ip-pool-10]q
C、將接口GE0/0/1加入到VLAN 10 [Quidway] vlan 10 [Quidway-vlan10] port gigabitethernet 0/0/1(如果是多個連續端口,用XX to XX)[Quidway-Vlan10] quit
D、配置VLANIF10接口下的客戶端從全局地址池中獲取IP地址 [Quidway]int vlan10
[Quidway-vlanif10]ip add 192.168.10.1 24 [Quidway-vlanif10]dhcp select global [Quidway-vlanif10]q
這時,可以用“dis ip pool”命令查看IP地址池配置情況 最后可以在電腦上驗證是否成功
五、telnet遠程登錄設置
system-view
[Quidway] aaa(進入aaa視圖)[Quidway-aaa]local-usertcwqpasswordciphertcwq(cipher是暗號的意思,password cipher就是指密碼顯示出來的是亂碼,在用dis cur命令時,看到的密碼是亂碼)
[Quidway-aaa] local-usertcwqpasswordsimpletcwq(simple是簡單的意思,passwor simple:弱口令,可以理解為明文,和cipher是相對的,在用dis cur命令時,看到的密碼是明文)
[Quidway-aaa] local-user tcwq service-type telnet(設置用戶tcwq的登錄方式為telnet)
[Quidway-aaa] local-user tcwq privilege level3(privilege level:權限級別,3為最高級別,擁有最高權限)
[Quidway-aaa] q
[Quidway]user-interfacevty0 4(vty:虛擬終端,0 4代表有0到4一共最多5個終端可以同時登錄到交換機)
[Quidway-vty0-4]authentication-mode aaa(authentication:認證,驗證。驗證模式設置為aaa模式)[Quidway-ui-vty0-4]q
設置完畢,這時可以在cmd里telnet網關,即可登錄到交換機。下面是S5324和S5700成功配置telnet后的截圖
注意:當提示驗證失敗時,將網卡禁用再啟用可以解決問題。
六、配置FTP服務器
建立一個FTP服務器,用戶名為tcwq,密碼為tcwq sys
[Quidway] ftp server enable(開啟FTP服務)[Quidway] aaa [Quidway-aaa] local-usertcwqpasswordsimpletcwq [Quidway-aaa]local-user tcwq service-type ftp
[Quidway-aaa]local-user tcwq ftp-directory flash:/(配置FTP用戶的訪問路徑,如果不配置這一項,登錄時會提示“530 logged incorrect”)[Quidway-aaa] q
這時用網線把電腦網卡和交換機的某個端口相連,電腦IP設置為和該端口所在Vlan的網關同一網段的地址(如IP:192.168.1.128,網關:192.168.1.1),在CMD命令行里輸入FTP 192.168.1.1即可進入FTP的驗證界面,輸入賬號tcwq,密碼tcwq,即可登錄
登錄到ftp后,可以從交換機的Flash里下載文件到電腦里(下載的文件所在位置是登錄到ftp服務器前的盤符,如上圖中是從F盤根目錄登錄到FTP的,那么文件都會被下載到F盤的根目錄里),也可以從電腦里選擇文件上傳到交換機的Flash里(速度很快,比串口燒錄快多了),還可以刪除flash里文件
ftp>dir(查看文件)
ftp>get vrpcfg.zip(下載文件名為“vrpcfg.zip”的文件)
ftp>put f:S5700web.zip(將電腦F盤里名字為S5700的文件夾里的web.zip文件上傳的交換機的Flash里)
ftp>delete web.zip(刪除文件名為“web.zip”的文件)
七、WEB網頁管理
三層交換機可以進行網頁管理,前提是HTTP服務要開啟,且交換機Flash里有web管理文件并被成功加載。
上一步進行了FTP服務器配置,如果交換機里沒有ZIP后綴名的WEB管理文件,就需要先用FTP把WEB管理文件上傳到Flash里
ftp> put f:S5700web.zip
200 Port command okay.150 Opening ASCII mode data connection for web.zip.226 Transfer complete.顯示到這里就說明web.zip文件被成功上傳到Flash里了。
下面就需要在終端或者telnet里將剛剛上傳的web.zip進行加載
sys
[Quidway] http server load web.zip(加載web.zip)
接下來就可以開啟HTTP服務了,在沒有加載web.zip之前,HTTP服務是開啟不了的
[Quidway] http server enable
現在建立一個網管賬號,賬戶名xiaodong,密碼xiaodong [Quidway] aaa [Quidway-aaa] local-userxiaodongpasswordsimplexiaodong [Quidway-aaa] local-userxiaodong service-type http [Quidway-aaa] q 這時可以在電腦上打開瀏覽器,輸入192.168.1.1,進入登錄驗證界面,輸入賬號xiaodong,密碼xiaodong,驗證碼,即可登錄。
第四篇:交換機路由器配置總結
交換機和路由器配置過程總結
作為網絡中重要的硬件設備,隨著網絡融入我們的日常生活,交換機和路由器也逐漸被人們所熟悉。關于交換機、路由器的配置,計算機和網絡專業的學生理應能夠操作熟練。通過這次網絡工程師培訓,借助Packet Tracer 5.0仿真軟件學習網絡配置、拓撲圖設計等,我對交換機、路由器配置有了深刻的了解,現將配置過程小結如下。
第一部分 交換機配置
一、概述 一層、二層交換機工作在數據鏈路層,三層交換機工作在網絡層,最常見的是以太網交換機。交換機一般具有用戶模式、配置模式、特權模式、全局配置模式等模式。
二、基本配置命令(CISCO)Switch >enable 進入特權模式
Switch #config terminal 進入全局配置模式 Switch(config)#hostname 設置交換機的主機名
Switch(config)#enable password 進入特權模式的密碼(明文形式保存)Switch(config)#enable secret 加密密碼(加密形式保存)(優先)Switch(config)#ip default-gateway 配置交換機網關
Switch(config)#show mac-address-table 查看MAC地址
Switch(config)logging synchronous 阻止控制臺信息覆蓋命令行上的輸入 Switch(config)no ip domain-lookup 關閉DNS查找功能 Switch(config)exec-timeout 0 0 阻止會話退出
使用Telnet遠程式管理
Switch(config)#line vty 0 4 進入虛擬終端 Switch(config-line)# password 設置登錄口令 Switch(config-line)# login 要求口令驗證
控制臺口令
switch(config)#line console 0 進入控制臺口 switch(config-line)# password xx switch(config-line)# 設置登錄口令login 允許登錄 恢復出廠配置
Switch(config)#erase startup-config Switch(config)delete vlan.dat Vlan基本配置
Switch#vlan database 進去vlan配置模式 Switch(vlan)#vlan 號碼 name 名稱 創建vlan及vlan名 Switch(vlan)#vlan號碼 mtu數值 修改MTU大小
Switch(vlan)#exit 更新vlan數據并推出 Switch#show vlan 查看驗證 Switch#copy running-config startup-config 保存配置 VLAN 中添加 刪除端口
Switch#config terminal 進入全局配置 Switch(config)#interface fastethernet0/1 進入要分配的端口 Switch(config-if)#Switchport mode access 定義二層端口 Switch(config-if)#Switchport acces vlan 號 把端口分給一個vlan Switch(config-if)#switchport mode trunk 設置為干線
Switch(config-if)#switchport trunk encapsulation dot1q 設置vlan 中繼協議 Switch(config-if)#no switchport mode 或(switchport mode access)禁用干線 Switch(config-if)#switchport trunk allowed vlan add 1,2 從Trunk中添加vlans Switch(config-if)#switchport trunk allowed vlan remove 1,2 從Trunk中刪除vlan Switch(config-if)#switchport trunk pruning vlan remove 1,2 ;從Trunk中關閉局部修剪
查看vlan信息 Switch#show vlan brief 所有vlan信息
查看vlan信息 Switch#show vlan id 某個vlan信息 注:Switch#show int trunk 查看trunk協議
注:可以使用default interface interface-id 還原接口到默認配置狀態 Trunk
開啟(no)——將端口設置為永久中繼模式
關閉(off)——將端口設置為永久非中繼模式,并且將鏈路轉變為非中繼鏈路 企望(desirable)——讓端口主動試圖將鏈路轉換成中繼鏈路 自動(auto)——使該端口愿意將鏈路變成中繼鏈路 交換機顯示命令:
switch#show vtp status 查看vtp配置信息 switch#show running-config 查看當前配置信息 switch#show vlan 查看vlan配置信息 switch#show interface 查看端口信息 switch#show int f0/0 查看指定端口信息 switch#dir flash: 查看閃存
switch#show version 查看當前版本信息
switch#show cdp cisco設備發現協議(可以查看聆接設備)switch#show cdp traffic 杳看接收和發送的cdp包統計信息 switch#show cdp neighbors 查看與該設備相鄰的cisco設備
switch#show interface f0/1 switchport 查看有關switchport的配置 switch#show cdp neighbors 查看與該設備相鄰的cisco設備
三、模擬配置(一個實例)
圖一:PC機IP地址、子網掩碼、默認網關配置截圖
圖二:模擬網絡拓撲結構圖
圖三:全局模式下對交換機進行配置
圖四:查看VLAN當前配置信息
第二部分 路由器配置
一、環境搭建(借鑒網上的材料,通過自己配置也實現了同樣的功能)
添加一個模塊化的路由器,單擊Packet Tracer 5.0的工作區中剛添加的路由器,在彈出的配置窗口上添加一些模塊:
圖五
默認情況下,路由器的電源是打開的,添加模塊時需要關閉路由器的電源,單擊圖一箭頭所指的電源開關,將其關閉,路由器的電源關閉后綠色的電源指示燈也將變暗。
圖六 添加所需要的模塊
在“MODULES”下尋找所需要的模塊,選中某個模塊時會在下方顯示該模塊的信息。然后拖到路由器的空插槽上即可。
圖八 添加一計算機,其RS-232與路由器的Console端口相連
圖九 用計算機的終端連接路由器
圖十 實驗環境搭建完成
二、配置單個路由器
路由器的幾種模式:User mode(用戶模式)、Privileged mode(特權模式)、Global configuration mode(全局配置模式)、Interface mode(接口配置模式)、Subinterface mode(子接口配置模式)、Line mode、Router configuration mode(路由配置模式)。每種模式對應不同的提示符。
圖十一 幾種配置命令提示符和配置路由器的名字
圖十二 通過Console端口登錄到路由器需要輸入密碼
圖十三 顯示信息的命令
通過模擬交換機和路由器的配置,進一步理解了它們的工作原理,對網絡拓撲架構有了清晰的認識,為以后的網絡知識學習打下了基礎。謝謝彭老師!
第五篇:成都大學教學用思科交換機路由器配置命令
成都大學思科路由器教學資料 思科Cisco交換機、路由器設置命令 Lzshihj_tz2f_3550
交換機口令設置:
switch>enable ;進入特權模式 switch#config terminal ;進入全局配置模式 switch(config)#hostname
switch(config)#enable secret xxx ;設置特權加密口令為 xxx
switch(config)#enable password xxx ;設置特權非密口令為 xxx
switch(config)#line console 0 ;進控制臺口(Rs232)初始化
switch(config-line)#line vty 0 4 ;進入虛擬終端virtual tty
switch(config-line)#login ;允許登錄
switch(config-line)#password xx ;設置登錄口令xx switch#exit ;返回命令
交換機VLAN設置:
switch#vlan database ;進入VLAN設置 switch(vlan)#vlan 2 ;建VLAN 2 switch(vlan)#no vlan 2 ;刪vlan 2 switch(config)#int f0/1 ;進入端口1 switch(config-if)#switchport access vlan 2 ;當前端口1加入VLAN 2
switch(config-if)#switchport mode trunk ;設置為干線 switch(config-if)#switchport trunk allowed vlan 1,2;設置允許的vlan switch(config-if)#switchport trunk encap dot1q ;設置vlan中繼 switch(config)#vtp domain
交換機設置IP地址:
switch(config)#interface vlan 1 ;進入vlan 1
switch(config-if)#ip address
switch#dir flash: ;查看內存
交換機顯示命令:
switch#write ;寫入保存 switch#show vtp switch#show run ;查看當前配置信息 switch#show vlan ;看VLAN switch#show interface ;顯示所有端口信息
switch#show int f0/0 ;顯示端口0的信息 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 路由器顯示命令:
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 ;設置特權加密口令為 xxx
router(config)#enable password xxx ;設置特權非密口令為 xxx
router(config)#line console 0 ;進控制臺口(Rs232)初始化
router(config-line)#line vty 0 4 ;進入虛擬終端virtual tty
router(config-line)#login ;允許登錄
router(config-line)#password xx ;設置登錄口令xx router(config)#(Ctrl+z);返回特權模式 router#exit ;返回命令
配置IP地址:
router(config)#int s0/0 ;進行串Serail接口
router(config-if)#no shutdown ;起動接口 router(config-if)#clock rate 64000 ;設置時鐘
router(config-if)#ip address 10.1.1.1 255.255.0.0 ;設置IP地址和子網掩碼
router(config-if)#ip add 10.1.1.2 255.255.0.0 second;
router(config-if)#int f0/0.1;進入子接口 router(config-subif.1)#ip address
router(config)#config-register 0x2142 ;跳過配置文件 router(config)#config-register 0x2102 ;正常使用配置文件 router#reload ;重新引導 復制操作:
router#copy running-config startup-config ;存配置 router#copy running-config tftp ;上載 router#copy startup-config tftp
router#copy tftp flash: ;特權模式下升級IOS
router#copy tftp startup-config
;下載配置文件到nvram
ROM狀態:
Ctrl+Break ;進入ROM監控狀態
rommon>confreg 0x2142 ;跳過配置,26 36 45xx
rommon>confreg 0x2102 ;使用配置,恢復工作狀態
rommon>reset
;重新引導,等效于重開機
rommon>copy xmodem:
rommon>IP_ADDRESS=10.65.1.2 ;設置路由器IP rommon>IP_SUBNET_MASK=255.255.0.0 ;設置路由器掩碼 rommon>TFTP_SERVER=10.65.1.1 ;指定TFTP服務器IP
rommon>TFTP_FILE=c2600.bin ;所要下載的文件 rommon>tftpdnld ;ROM監控狀態下升級IOS
rommon>dir flash: ;查看閃存中的內容 rommon>boot ;引導IOS
靜態路由:
ip route
動態路由:
router(config)#ip routing ;啟動路由 router(config)#router rip ;啟動RIP路由協議。router(config-router)#network
router(config-router)#negihbor
幀中繼命令:
router(config)# frame-relay switching ;使能幀中繼交換 router(config-s0)# encapsulation frame-relay ;使能幀中繼
router(config-s0)# frame-relay intf-type DCE ;DCE端(需要配虛電路)
router(config-s0)# frame-relay local-dlci 20 ;配置虛電路號
基本訪問控制列表:
router(config)#access-list
例:
RB(config)#access-list 4 permit 10.8.1.1
RB(config)#access-list 4 deny 10.8.1.0 0.0.0.255
RB(config)#access-list 4 permit 10.8.0.0 0.0.255.255 RB(config)#access-list 4 deny 10.0.0.0 0.255.255.255 RB(config)#access-list 4 permit any RB(config)#int f0/0
RB(config-if)#ip access-group 4 in
擴展訪問控制列表:
access-list
access-list
router(config)#access-list 101 deny icmp any 10.64.0.2 0.0.0.0 echo router(config)#access-list 101 permit ip any any router(config)#int s0/0
router(config-if)#ip access-group 101 in 例2:
router(config)#access-list 102 deny tcp any 10.65.0.2 0.0.0.0 eq 80 router(config)#access-list 102 permit ip any any router(config)#interface s0/1
router(config-if)#ip access-group 102 out
router(config)#no access-list 102
router(config-if)#no ip access-group 101 in
在路由器上設置 SNMP Community Strings
router(config)# snmp-server community read-community-string ro
router(config)# snmp-server community write-community-string rw
在交換機上設置 SNMP Community Strings
switch(config)# snmp-server community read-community-string ro
switch(config)# snmp-server community write-community-string rw
在路由器上配置日志信息(Syslog Message Logging)
router(config)# logging on
router(config)# logging server-ip-address router(config)# logging trap severity-level 路由器恢復出廠設置
erase start-config 或write erase 或erase NVROM