网络设备命令大全
;进入vlan 1 ;添加远程登录IP ;添加默认网关 ;查看内存
;写入保存 ;查看当前配置信息 ;看VLAN ;显示所有端口信息 ;显示端口0的信息
第 1 页,共 3 页
路由器显示命令: router#show run router#show interface router#show ip route router#show cdp nei router#reload
交换机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 <name> ; 设置发vtp域名 switch(config)#vtp password <word> switch(config)#vtp mode server switch(config)#vtp mode client 交换机设置IP地址: switch(config)#interface vlan 1 switch(config-if)#ip address <IP> <mask> switch(config)#ip default-gateway <IP> switch#dir flash: 交换机显示命令: switch#write switch#show vtp switch#show run switch#show vlan switch#show interface switch#show int f0/0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;显示接口 ;显示接口 ;显示路由 ;看邻居 ;重新起动
设置口令: router>enable router#config terminal router(config)#hostname <hostname> router(config)#enable secret xxx router(config)#enable password xxx router(config)#line console 0 router(config-line)#line vty 0 4 router(config-line)#login router(config-line)#password xx router(config)# (Ctrl+z) router#exit
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 交换机基本状态: switch: rommon> hostname> hostname# hostname(config)# hostname(config-if)# 交换机口令设置: switch>enable switch#config terminal switch(config)#hostname <hostname> switch(config)#enable secret xxx switch(config)#enable password xxx switch(config)#line console 0 swБайду номын сангаасtch(config-line)#line vty 0 4 switch(config-line)#login switch(config-line)#password xx switch#exit
;进入ROM监控状态 ;跳过配置,26 36 45xx ;使用配置,恢复工作状态 ;重新引导,等效于重开机 ;从console升级IOS ;设置路由器IP ;设置路由器掩码 ;指定TFTP服务器IP ;所要下载的文件 ;ROM监控状态下升级IOS ;查看闪存中的内容 ;引导IOS
静态路由: ip route <ip-address> <subnet-mask> <gateway> 例: router(config)#ip route 10.1.0.0 255.255.0.0 10.2.1.1 router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2 动态路由: router(config)#ip routing router(config)#router rip router(config-router)#network <netid> router(config-router)#negihbor <ip-address>
;ROM状态, 路由器是 ;用户模式 ;特权模式 ;全局配置模式 ; 接口状态
;进入特权模式 ;进入全局配置模式 ;设置交换机的主机名 ;设置特权加密口令为 xxx ;设置特权非密口令为 xxx ;进控制台口(Rs232)初始化 ;进入虚拟终端virtual tty ;允许登录 ;设置登录口令xx ;返回命令
;使能帧中继交换 ;使能帧中继 ;DCE端(需要配虚电路) ;配置虚电路号
基本访问控制列表: router(config)#access-list <number> permit|deny <source ip> <wild|any> router(config)#interface <interface> ;default: deny any router(config-if)#ip access-group <number> in|out ;default: out 例: 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
;使用root用户 ;口令是linux ;关机 ;关机
;显示IP地址 address> netmask <netmask> ;设置IP地址 address> netmask <netmask> down ; 删除IP地址 gw <ip> gw <ip> gw <ip> ;设置网关 gw <ip> ;删除网关 ;显示网关 ;建立telnet之前先ping一下
;进入特权模式 ;进入全局配置模式 ;设置交换机的主机名 ;设置特权加密口令为 xxx ;设置特权非密口令为 xxx ;进控制台口(Rs232)初始化 ;进入虚拟终端virtual tty ;允许登录 ;设置登录口令xx ; 返回特权模式 ;返回命令
配置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 <ip><netmask> ; router(config-subif.1)#encapsulation dot1q <n> ; router(config)#config-register 0x2142 ;跳过配置文件 router(config)#config-register 0x2102 ;正常使用配置文件 router#reload ;重新引导 复制操作: router#copy router#copy router#copy router#copy router#copy
;启动路由 ;启动RIP路由协议。 ;配置范围,有的支持all。 ;点对点 帧中继用。
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^