华三路由器交换机配置命令.docx
《华三路由器交换机配置命令.docx》由会员分享,可在线阅读,更多相关《华三路由器交换机配置命令.docx(36页珍藏版)》请在冰豆网上搜索。
华三路由器交换机配置命令
华三路由器交换机配置命令
———————————————————————————————— 作者:
————————————————————————————————日期:
ﻩ
路由器:
1、进入SETUP模式Router#setup
2、 时间设置router#clock set hh:
mm:
ss date moth year
3、router>showhistory
Router>terminalhistorysize lines
4、router#show version
5、router#showrunning-config
6、router#showstarup-config
7、 router(config)#hostnamename 主机命名
8、router(config)#banner motd#message#开机时的固定显示信息
9、router(config)#enablepasswordpassword特权模式明文密码
10、 router(config)#noenable password
11、router(config)#enablesecretpassword特权模式加密密码
12、router(config)#no enablesecret
13、 router(config)#servicepassword-encryption特权模式把明文密码加密密码,但没enablesecret安全可以反解
14、router(config)#line console控制台密码
15、router(config-line)#login
16、router(config-line)#password password
17、 router(config-line)#exec-timeout mmss禁止控制台会话自动退出
18、router(config-line)#loggingsynchronous重显被打乱的控制台输入
router(config)#noip domain-lookup禁止域名解析
19、router(config)#line vty 0 4虚拟终端密码
20、router(config-line)#login
21、router(config-line)#passwordpassword
22、router(config)#interfacetype number(slot/port)端口设置
23、router(config-if)#ipaddressipsummast
24、router(config-if)#clockrate64000(时钟频率单位为bps,只在DCE端设置)
25、router(config-if)#bandwith 64(带宽设置,单位为KB)
26、 router(config-if)#no shutdown(shutdown)
27、router(config-if)#media-type type(10base)为以太网端口选择适当的介质类型
28、router(config-if)#ctrl+z保存退出到特权模式
29、router#
30、router>用户模式enable进入
router#特权模式configterminal进入
router(config)#全局配置模式
31、
Interface Router(config-if)#端口设置
Subinterface Router(config-subif)# 子端口设置
ControllerRouter(config-controller)#控制口设置
LineRouter(config-line)#虚拟口设置
Router Router(config-router)#路由设置
IPXrouterRouter(config-ipx-router)#IPX路由设置
32、 router#showinterface
33、 router#showinterfaceEthernet0
34、router#showinterface serial 0
35、router#showrunning-config
36、router#show starup-config
37、router#showflash
38、router#showcontroller
39、 router#showcontrollerinterface type
40、router#showrunning-config
router#copyrunning-configstarup-config
router#copyrunning-configtftp
router#copystarup-configtftp
router#copyflashtftp
router#copyt
router#copyt
--------------------------------------------------------------------------------
端口状态
Serial1is up,lineprotocolisup正常工作
Serial1 is up,lineprotocol isdown连接问题
Serial1isdown,lineprotocolis down端口问题
Serial1 isadministratively down, lineprotocolisdown人为关闭
配置寄存器的值
1、 关闭路由器的电源重新启动按住ctrl+break键入进
2、>
3、>o/r0×2142(跳过nvarm启动恢复密码)
4、>I
5、当系统提示是否进入setup模式时,按N
6、router>
7、router>enable
8、router#
9、进入修改后(包括密码、寄存器的值:
0×2100为rommonitor启动、0×2101为setup模式启动、0×2102为
10、router#copy running-configstarup-config
11、 router#reload
12、 也可以在router#setup进入setup模式
静态路由协议设置
router(config)#ip routenetworksubmask(要到达的网络号掩码)ipaddress(下一跳或出口ip地址)
router(config)#iproute0.0.0.0 s0(出口端口或下一跳IP地址)
rip设置
router(config)#routerrip
router(config-router)#networknetwork-number
router#showip protocol查看RIP信息
router#showip route查看路由表
router#debugiprip查看RIP更新信息
router(config-router)#passive-interface e0(阻止发出作息)
router(config-router)#ipripreceiveversion12接收1、2RIP版本信息
igrp设置
router(config)#routerigrpasnumber
router(config-router)#networknetwork number
router#showiproute查看路由表
router#debugipigrpevents查看IGRP路由更新大概信息
router#debugipigrptransaction 查看IGRP路由更新详细信息
Router(config-router)#variance multiplier 控制IGRPloadbalancing
Router(config-router)#traffic-share{balanced |min}控制load-balanced traffic 的分布
eigrp设置
router(config)#routereigrpasnumber
router(config-router)#networknetworknumber
router(config)#noauto-summry关闭自动汇总
router(config)#auto-summry 打开自动汇总(默认是打开的)
router#showiprouteeigrp显示当前的路由表里的EIGRP条目
router#show ipprotocol显示活动的路由协议进程的参数和当前的状态
router#showipeigrpneighbors显示被EIGRP发现的邻居
router#showipeigrptraffic显示发出和收到的IPEIGRP 包的数量
router#showipeigrp topology 显示IPEIGRP的拓扑表
Router#debugipeigrp
ospf设置
1.Router(config)#routerospf process-id
Router(config-router)#network address(可以是网络号也可以是Ip地址mask(通配掩码)areaarea-id
Router(config-if)#ipospfprioritynumbe配置OSPF的优先级
Router#showipprotocols验证OSPF的配置
Router#showiproute显示路由器学到的所有路由
Router#showipospfinterfacetypenumber显示 area-ID 和邻接信息
Router#show ipospf neighbor基于每接口显示OSPF邻居信息
Router#debug ipospf events
Router#debugip ospfpacket
2.Router(config)#interfaceloopbacknumber(lookback回路配置)
Router(config-if)#ipaddressip-addresssubnet-mask
Router(config-if)#ipospfcostcost-numbe修改OSPF的Cost数值
Router(config-if)# ip ospfauthentication-key key 配置明文口令
Router(config-if)#ipospfmessge-digest-keykeyidmd5key配置MD5口令
(keyid和key必须配对一致,两邻居才可以通信)
Router(config-route)# areaarea-idauthentication[message-digest]
message-digest为可选项,使用后路由器只传送口令消息的摘要(或散列) 配置OSPF区域的验证:
3.Router(config-if)# ip ospf hello-intervalseconds配置hello间隔:
Router(config-if)#ipospf dead-intervalseconds配置down机判断间隔
--------------------------------------------------------------------------------
访问列表
1.标准访问列表(standardaccesslists):
只使用源IP地址来做过滤决定
Router(config)#access-list10deny172.16.40.00.0.0.255
Router(config)#access-list10 permitany
Router(config)#inte1
Router(config-if)#ipaccess-group10 out
使用IP标准ACL来控制VTY线路的访问.
Router(config)#access-list50permit172.16.10.3
Router(config)#linevty0 4
Router(config-line)#access-class 50in
删除IP标准ACL
Router(config-line)#no ipaccess-class50in
Router(config)#noaccess-list50
2.扩展访问列表(extendedaccess lists):
它比较源IP地址和目标IP地址,层3的协议字段,层4端口号来做过滤决定
Router(config)#access-list 110denytcp anyhost172.16.30.5eq21
Router(config)#access-list110denytcp anyhost172.16.30.5eq23
Router(config)#access-list110permitipanyany
Router(config)#inte1
Router(config-if)#ip access-group 110out
3.虚拟通道访问
router(config)#access-list12permit 192.89.55.00.0.0.255
router(config)#line vty 04
outer(config-line)#access-class12in
3.showipinterface:
只显示IP访问列表信息
4.showipinterface:
显示所有接口的信息和配置的ACL信息
5.show ipinterface [接口号]:
显示具体某个接口的信息和配置的ACL信息
6.show running-config:
显示DRAM信息和ACL信息,以及接口对ACL的应用信息.
交换机配置
交换机上设置登陆口令
Switch(config)# enablepassword levellevel password
Switch(config)#noenable passwordlevellevelpassword
hostname
1900/2900(config)#hostnamehostname
IPAddress
1900(config)#ipaddress {ipaddress}{mask}
1900(config)#ip address10.5.5.11255.255.255.0
2950(config#interfacevlan1
2950(config-if)#ipaddress {ip_address}{mask}
2950(config)#interfacevlan 1
2950(config-if)#ipaddress 10.5.5.11255.255.255.0
defaultgateway
1900/2950(config)#ipdefault-gateway{ipaddress}
1900/2950(config)#ip default-gateway172.20.137.1
查看交换机的IP地址
1900#showip
IPaddress:
10.5.5.11
Subnet mask:
255.255.255.0
Defaultgateway:
10.5.5.3
Management VLAN:
1
2950#showinterfacevlan1
Vlan1isup,lineprotocolisup
HardwareisCat5k VirtualEthernet,address is0010.f6a9.9800(bia0010.f6a9.9800)
Internetaddress is172.16.80.79/24
Broadcastaddressis255.255.255.255
设置双工选项
1900(config)#interfacee0/1
1900(config-if)#duplex{auto|full|full-flow-control|half}
2950(config)#interfacefe0/1
2950(config-if)#duplex{auto| full|half}
设置端口速度:
switch(config-if)#speed {10|100|auto}
查勘双工选项
Switch#show interfacesfastethernet0/3
查看MAC地址表
1900/2950#showmac-address-table
配置永久MAC地址
1900(config)#mac-address-tablepermanent{mac-addresstypemodule/port}
1900(config)#mac-address-tablepermanent 2222.2222.2222ethernet0/3
1900#showmac-address-table
2950(config)#mac-address-tablestatic mac_addr{vlanvlan_id} [interface int1[int2 ...int15]]
--------------------------------------------------------------------------------
配置受限静态MAC地址
1900(config)#mac-address-table restrictedstatic{mac-addresstypemodule/portsrc-if-list}
1900(config)#mac-address-table restrictedstatic1111.1111.1111e0/4e0/1
1900#showmac-address-table
2950(config)#mac-address-tablesecuremac-addrinterface[vlanvlan-id]
2950(config)#mac-address-table secure0003.3333.3333fa0/1 vlan1
2950#showmac-address-table
配置端口安全性
1900(config-if)#portsecure max-mac-countcount
1900(config)#interfacee0/4
1900(config-if)#portsecure
1900(config-if)#portsecuremax-mac-count1
1900(config)#address-violation {suspend |disable |ignore
1900#show mac-address-tablesecurity
2950(config-if)#port security max-mac-count count
2950(config)#interfacefa0/1
2950(config-if)#portsecurity
2950(config-if)#port securitymax-mac-count10
2950(config-if)#portsecurityaction{shutdown|trap}
2950#showmac-address-table secure
2950#showport-security
管理配置文件
1900#copynvramt
1900#copyt nvram
1950#copynvramt
2950#copystartup-configt
清除NVRAM
1900#deletenvram
2950#erase startup-config
vlan配置
1900VLAN建立
1900下,使用vlan[vlan#]name[name][vlan#]命令,如下:
>en
#config t
(config)#hostname 1900
1900(config)#vlan2namesales
1900(config)#vlan 3namemarketing
1900(config)#vlan4namemis
1900(config)#exit
端口分配
1900(config)#int e0/2
1900(config-if)#vlan-membership static 2
1900(config)#inte0/4
1900(config-if)#vlan-membershipstatic3
1900(config)#inte0/5
1900(config-if)#vlan-membershipstatic4
1900(config-if)#exit
1900(config)#exit
VLAN验证
1900#shvlan
2900VLAN建立
在2950下创建VLAN,在特权模式下使用vlan database命令
2950#vlan database
2950(vlan)#vlan2 nameMarketing
VLAN 2 modified:
Name:
Marketing
2950(vlan)#vlan3nameAccounting
VLAN3 added:
Name:
Accounting
2950(vlan)#apply
APPLY complete
2950(vlan)#Ctrl+C
2950#
端口分配
2950下的端口配置,使用switchport accessvlan[vlan#]命令,
2950(config-if)#intf0/2
2950(config-if)#switchportaccessvlan2
2950(config-if)#intf0/3
2950(config-if)#switchport accessvlan3
2950(config-if)#intf0/4
2950(config-if)#switchport accessvlan4
2950(config-if)#exit
2950(config)#exit
验证配置信息,如下:
2950#shvlan
或
2950#shvlanbrief
trunk配置
1900 trunk配置
1900(config)#intf0/26