思科软件命令总结
- 交换机支持的命令:
交换机基本状态: switch: ;ROM状态,
路由器是rommon>hostname> ;
用户模式daohostname# ;
特权模式hostname(config)# ;
全局配置模式hostname(config-if)# ;接口状态
交换机口令设置:
switch>enable ;进入特权模式
switch#config terminal ;进入全局配置模式
switch(config)#hostname ;设置交换机的主机名
switch(config)#enable secret xxx ;设置特权加密口令
switch(config)#enable password xxa ;设置特权非密口令
switch(config)#line console 0 ;进入控制台口
switch(config-line)#line vty 0 4 ;进入虚拟终端
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 ;当前端口加入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 ;设置发vtp域名
switch(config)#vtp password ;设置发vtp密码
switch(config)#vtp mode server ;设置发vtp模式
switch(config)#vtp mode client ;设置发vtp模式交换机
设置IP地址:
switch(config)#interface vlan 1 ;进入vlan 1
switch(config-if)#ip address ;设置IP地址
switch(config)#ip default-gateway ;设置默认网关
switch#dir flash: ;查看闪存
交换机显示命令:
switch#write ;保存配置信息
switch#show vtp ;查看vtp配置信息
switch#show run ;查看当前配置信息
switch#show vlan ;查看vlan配置信息
switch#show interface ;查看端口信息
switch#show int f0/0 ;查看指定端口信息
2.路由器支持的命令:
路由器显示命令:
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 ;返回命令
路由器配置:
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 ;重新引导
路由器文件操作:
router#copy running-config startup-config ;保存配置
router#copy running-config tftp ;保存配置到tftp
router#copy startup-config tftp ;开机配置存到tftp
router#copy tftp flash: ;下传文件到flash
router#copy tftp startup-config;下载配置文件ROM状态:
Ctrl+Break ;进入ROM监控状态
rommon>confreg 0x2142 ;跳过配置文件
rommon>confreg 0x2102 ;恢复配置文件
rommon>reset ;重新引导
rommon>copy xmodem: flash: ;从console传输文件rommon>IP_ADDRESS=10.65.1.2 ;设置路由器rommon>IP_SUBNET_MASK=255.255.0.0 ;设置路由器掩码rommon>TFTP_SERVER=10.65.1.1 ;指定TFTP服务器rommon>TFTP_FILE=c2600.bin ;指定下载的文件
rommon>tftpdnld ;从tftp下载
rommon>dir flash: ;查看闪存内容
rommon>boot ;引导IOS
静态路由:
ip route ;命令格式router(config)#ip route 2.0.0.0 255.0.0.0 1.1.1.2 ;
静态路由举例router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2 ;默认路由举例
动态路由:
router(config)#ip routing ;启动路由转发
router(config)#router rip ;启动RIP路由协议。
router(config-router)#network ;设置发布路由
router(config-router)#negihbor ;点对点帧中继用。
思科软件网络部署
-
静态路由配置
配置R1到R3的路由
R1:ip route 192.168.1.192 255.255.255.224 192.168.1.246
ip route 192.168.1.128 255.255.255.192 192.168.1.246
R2:ip route 192.168.1.192 255.255.255.224 192.168.1.250
ip route 192.168.1.0 255.255.255.128 192.168.1.245
R3:ip route 192.168.1.0 255.255.255.128 192.168.1.249
ip route 192.168.1.128 255.255.255.192 192.168.1.249
实现了R1 R2 R3三个子网的互通
R4ip route 192.168.0.0 255.255.255.128 192.168.1.249 -
密码管理,远程管理
密码管理:
Enable登录密码
#conf t#enable password 123 (设置明文密码
)#enable secret 1234 (设置加密口令)
#exit (退出后登录验证)
同时设置明文密码和加密密码后,明文密码失效,必须输入加密的密码才能登 陆
Console口密码:
#conf t
#line console 0
#password 123
#login
#exit
远程登录:
#conf t
#line vty 0 4 设置终端类型和个数
#login
登陆模式
#password 1234设置密码
#exit
管理ip:
#conf t
#interface vlan 1
#ip address 192.168.1.3 255.255.255.0
#no shutdown
#exit
#ip default_gateway 192.168.1.1
#exit 打开pc机的命令行模式 输入telnet 192.168.1.3进行登录 -
vlan设置
命令:
创建vlan: vlan 11
修改名称: name v11
删除vlan: no vlan 11
将端口加入到vlan:
1、 选中端口 interface fa0/1 (多个端口 interface range fa0/1-8)
2、 端口加入到指定vlan:Switchport access vlan 11
3、 修改端口模式trunk: 选中端口后执行switchport mode trunk
4、 配置客户端ip,测试跨交换机的同vlan通信 -
单臂路由
添加Switch2,在上面添加vlan 11 和vlan2
所有已连接的端口改成trunk模式
路由器配置:
选中端口0/0:interface fa0/0
将端口**:no shutdown
配置多vlan:
Router(config)#interface fastEthernet 0/0.1
Router(config-subif)#encapsulation dot1q 1
Router(config-subif)#ip address 192.168.1.1 255.255.255.0
Router(config-subif)#exit Router(config)#interface fastEthernet 0/0.2
Router(config-subif)#encapsulation dot1q 2
Router(config-subif)#ip address 192.168.3.1 255.255.255.0
Router(config-subif)#exit Router(config)#interface fastEthernet 0/0.3
Router(config-subif)#encapsulation dot1q 11
Router(config-subif)#ip address 192.168.2.1 255.255.255.0
Router(config-subif)#exit
配置完成后Ping命令测试
-
三层交换机
1、 vlan配置
2、 端口配置
3、 跨vlan通信:主要是设置vlan ip使Vlan1Vlan2Vlan3互通
通过设置vlan ip(网关)来实现
Interface vlan 1
Ip address 192.168.1.1 255.255.255.0
No shutdown
4、 路由功能:
开启路由:ip routing
改成路由接口:no switchport
路由配置同路由器配置 -
动态路由协议
1、距离矢量算法 RIP
RIP分1和2两个版本,区别是2可以支持可变长子网掩码
配置过程:
Router rip 开启rip功能
Version 2 选择版本号,默认是1No
auto-summary 取消子网自动聚合
Network 192.168.1.0 配置网络(将网段或端口加入的rip路由信息库中)
2、链路状态算法 OSPF
设置loopback端口,用作ospf的router-id
Interface loopback 0
Ip address 192.168.1.1 255.255.255.0
No shutdown
Loopback ip是指系统的回环地址,用于内部通信,通常设置为单一ip,既192.168.100.100/32
Router ospf 10 开启ospf功能,进程号为10
Network 192.168.1.0 0.0.0.255 area 0 设置网络,使用反掩码,标注区域号,0代表骨干区域、其他数字是标准区域、标准区域必须连接到骨干区域
3、ospf多域配置
骨干区域和费骨干区域的连接,连接点的路由器称为ABR(区域边界路由器ABR)在ABR上分别配置area 0和area 1两个区域的端口网络
连接自治系统(ospf区域和rip区域进行连接)
自治系统是指使用同一种路由协议的一组路由设备
ospf系统和rip系统相连接的路由器称为ASBR(自治系统边界路由器)
在asbr上需同时配置RIP和OSPF协议,并且开启路由重分发功能。
在ASBR route5上的配置
Router rip 开启rip功能
Version 2 选择版本号,默认是1
No auto-summary 取消子网自动聚合
Network 192.168.31.0 配置网络(将网段或端口加入的rip路由信息库中)Network 10.11.10.4
Network 10.11.10.0
Redistribute ospf 100 metric 10 配置路由重分发,ospf进程号是100,到达ospf区域的跳数统一定义为10。
设置loopback端口,用作ospf的router-id
Interface loopback 0
Ip address 192.168.111.1 255.255.255.0
No shutdown
Router ospf 10 开启ospf功能,进程号为10
router-id 192.168.111.1
Network 192.168.31.0 0.0.0.255 area 0
Network 10.11.10.0 0.0.0.3 area 0
Network 10.11.10.4 0.0.0.3 area 0
Redistribute rip subnets 配置RIP路由重分发