您的位置:首页 > 其它

路由器交换机命令总结

2016-06-28 15:56 232 查看
特权模式:enable (en)
全局配置模式:config terminal (conf t)
接口模式:interface fastethernet 模块号/端口号 (int f0/1)
同时进入多个接口 int range f0/0 – 4
终止域名解析:ctrl+shift+6
退出到特权模式:crtl+z end
退出到上一层:exit
ctrl+A 光标到命令行开始位置
ctrl+E 光标到命令行结束位置

特权模式下命令
show version 显示系统ios名称及版本信息
查看当前配置信息: show running-config (sh run)
查看以保存的配置信息: show startup-config (shstar)
保存当前配置信息:copy running-config startup-config (copy run star ) = write
删除已保存的配置信息:erase nvram erasestartup-config
tracert 192.168.1.1 查看到192.168.1.1的过程
重启:reload
查看vlan:show vlan brief

全局模式下命令:
host xx 修改主机名为xx
还原接口为默认配置:default interface f0/1
配置双工模式:deplex 【full|half|auto】
配置接口速率:speed 【10|100|100】
永不超时:
line con 0
exec-timeout 0 0
信息同步:
line con 0
logging synchronous (logg syn)
禁用DNS查询:no ip domain-lookup

交换机:
查看mac地址表:show mac-address-table
查看f0/1信息(包括双工模式和速率):show int f0/1
在三层交换机上启用路由功能:ip routing
查看接口模式状态: show interface interface-id switchport

创建vlan :
1.vlan database
vlan vlan-id [name vlan-name]
exit
2.conf t
vlan vlan-id
name vlan-name
exit
将端口f0/1分配到vlan 2:
conf t
int f0/1
switchport mode access
switchport access vlan 2
exit

给交换机虚接口配置ip:
int vlan 1
ip add 192.168.1.1 255.255.255.0
no sh
配置默认网关: ip default-gateway 192.168.1.254

配置交换机console口密码:
全局模式:
line console 0
password cisco
login
配置特权模式密码:
全局模式下:
enable password cisco (明文) / enablesecret cisco (密文)
加密明文密码:service password-encryption

配置vty密码;
line vty 0 4
password cisco
login
设置好vty密码和enable密码,可以通过telnet远程管理交换机。远程管理不同网段的交换机时,需要给交换机配置默认网关

trunk配置:
int f0/1
switchport trunk encapsulation dot1q
switchport mode trunk

禁止trunk传送某个vlan的数据,删除这个vlan: switchport trunk allowed vlan remove vlan-id
允许trunk传送某个vlan的数据,添加这个vlan: switchport trunk allowed vlan add vlan-id

配置以太网通道:
interface range f0/1 – 2
channel-group 1 mode on
查看以太网通道配置: show etherchannel 1 summary
VTP配置:
创建vtp域:Switch(config)# vtp domain domain-name
配置交换机的vtp模式:Switch(config)# vtp mode {server|client|transparent}
配置vtp口令:Switch(config)# vtp password password
配置vtp修剪: Switch(config)# vtp pruning
配置vtp版本:Switch(config)# vtp version 2 (默认运行版本1)
查看vtp配置信息:Switch# show vtp status
查看vtp口令:Switch# show vtp password
交换机密码恢复:
1.开机按mode键 2.初始化flash : flash_init
3.将config.text修改为config.old
rename flash:config.text flash:config.old
4.重启:boot
5.把配置文件名改回
rename flash:config.old flash:config.text
6.手动加载配置文件
copy flash:config.text system:running-config
7.查看配置并修改
8.保存:wr 路由器:
查看arp缓存表:show arp
清除arp缓存表:clear arp-cache
查看所有接口ip: sh ip int brief
查看路由表:show ip route (c-直连路由,s-静态路由,s*-默认路由)
配置静态路由: ip route 目的网段子网掩码 address(到达目的网络经过的下一跳路由器的接口地址)
配置默认路由: ip route 0.0.0.0 0.0.0.0 address(下一跳地址)
no ip routing : 把路由器路由功能关了,模拟交换机

配置ip:
int f0/0
ip add 10.0.0.10 255.255.255.0
no shut down

配置单臂路由:需要配置子接口的封装结构,vlan和ip
int f0/0.1
encapsulatation dot1q 10(vlan-id)
ip add 10.0.0.1 255.255.255.0
int f0/0.2

配置DHCP:
定义ip地址池:Router(config)# ip dhcp pool pool-name
动态分配ip地址段: Router(dhcp-config)# network 网段掩码
设定网关地址:Router(dhcp-config)# default-router 网关地址
为客户端配置DNS地址:Router(dhcp-config)# dns-server dns-ip
设定地址租期:Router(dhcp-config)# lease days
预留静态分配的ip地址: Router(dhcp-config)# ip dhcp excluded-address low-address[high-address]
路由器密码恢复:
1.中断开机:ctrl+break 2.修改寄存器的值:confreg0x2142
3.重启:reset
4.手动加载配置文件:copy startup-confg running-config
5.查看配置并修改
6.恢复寄存器的值:config-register 0x2102
7.保存配置:copy run star
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  命令 交换机 路由器