记不住思科简单配置命令的朋友们有福利了!!! 以下是关于思科设备一些简单的配置命令,初学的朋友们没记住的可以来看看哦!

CISCO: Switch>用户模式 Switch>**enable

  • Switch#特权模式

Switch#configure terminal Switch(config)#全局配置模式 Switch(config)#interface fastEthernet 0/1 Switch(config-if)#接口模式 Exit返回上一模式

修改主机名 Switch>用户模式 Switch>enable Switch#特权模式 Switch#configure terminal Switch(config)#全局配置模式 Switch(config)#hostname+自定义用户名

查看配置信息内存中的信息 Switch#show running-config 查看配置信息

Switch#show mac-address-table查看mac地址

Switch#show version 查看IOS版本信息

Switch (config)#(+no 撤销密码)

enable password(不用写数字) 123 配置用户进入特权模式的明文密码

Switch (config)#(+no 撤销密码)enable secret(不用写数字) 456 配置用户进入特权模式的密文密码

Switch#copy running-config startup-config/ write/wr 保存当前配置

Switch(config-if)#no ip address 删除ip地址,删除命令用no

Switch#reload 重启

Switch#show interfaces f0/1 switchport 查看接口参数(在交换机)

Switch#show interfaces f0/1 查看接口参数(在路由器)

Switch(config-if)#switchport mode trunk 把接口模式改成truck

Switch(config-if)#switchport mode access 把接口模式改成access

Switch#show ip route 查看路由表

Router(config)#vlan +数字 创建vlan

Switch#vlan database vlan数据库(第二种创建vlan的方式)

Switch(config-if)#switchport access vlan +数字 将某接口加入vlan

给三层交换机接口打802.1q封装(二层交换机自动学) (可用三层与三层交换机之间的trunk连接) Switch(config-if)#switchport trunk encapsulation dot1q (修改链路模式) Switch(config-if)#switchport mode trunk

Switch(config-if)#ip address+ip+子网掩码 配置三层交换机ip

Switch(config-if)#no switchport 把二层接口变成路由接口

Switch(config)#ip routing 开启三层交换机的路由功能

Switch#show run 查看所有端口

*R1(config)#no ip routing 关闭路由功能

*R1(config)# ip default-gateway 192.168.0.254 在本设备设置要到达的网关

查看完路由表后 查看优先级

Switch#show ip route

S 192.168.3.0/24 [1(优先数值)/0] via 192.168.1.2 数值越小越优先 *动态路由

先把接口ip和网关配好 R6(config)#router rip (动态协议) 进入动态(rip)路由模式 R6(config-router)#version 2(进入版本2) R6(config-router)#no auto-summary(自动协商) R6(config-router)#network 192.168.4.0(宣告所连网络段)

*使用本机回环接口在rip中传递路由信息(创建虚拟接口测试动态路由) 进入本机回环接口并设置ip (loopback接口依托物理接口;只要物理接口激活,loopback接口就能ping通) R6(config-router)#inter loopback 0 (用户自定义) R6(config-if)#ip address 192.168.6.1 255.255.255.0

在rip中宣告回环接口所在网段 R6(config-if)#router rip R6(config-router)#network 192.168.6.0

*配置远程登录(在设备里开启远程功能) R2(config)#line vty 0 4(0~4人管理) R2(config-line)#password 123(配置远程登录密码) R2(config-line)#no login(远程登录时不需要密码)(可有可无) R2(config-line)#exit R2(config)#enable password 123(配置进入特权密码) *之后在pc机中使用telnet命令测试 R1#telnet 192.168.4.2(要进入的设备接口ip)

1、连接wan网 DHCP 一个网段分配一个DHCP池

DHCP(自动分配Ip)的配置:

Router(config)#ip dhcp pool xx 创建地址池,名字为xx

Router(dhcp-config)#network(网络) 192.168.1.0 255.255.255.0 添加网段,(要给那个网段分配地址)

Router(dhcp-config)#default-router 192.168.1.254 指定网关地址

Router(dhcp-config)#dns-server 8.8.8.8 指定DNS地址

Router(dhcp-config)#int f0/0 进入网关接口/vlan

Router(config-if)#ip address 192.168.1.254 255.255.255.0 配置网关地址

Router(config-if)#no shutdown 激活接口

Switch(config)#ip routing 开启三层交换机的路由功能 去pc机进入接口输入R6(config-if)#ip address dhcp (才能获得ip) 设置静态路由(目标网段、子网掩码、下一跳地址)

Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1

Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.1 (配置默认路由)用于末梢网络

Router(config)#ip route 0.0.0.0 0.0.0.0 +(自己的端口)f0/0 (吓一跳 在不知道对方接口ip时可用)

2、创建内部服务器

在三层交换机创建vlan池;DHCP地址保留一个地址为服务器用(员工获取不到)

Switch(config)#ip dhcp excluded-address (排除地址)192.168.10.1

trunk是用在一条链路中多个vlan的通信,相当于一个物理链路中开了很多个虚拟的互不相干的链路! 主要用在交换机与交换机之间,交换机与路由器之间(交换机端口配置trunk)。

在trunk链路中去除外来客户使用的电脑所在的vlan(单线)

Switch(config-if)#(no)switchport trunk allowed vlan remove(去掉) 外来客户使用的电脑

Switch(config)#interface range(范围)fastEthernet 0/1,f0/4(把多个接口加入同一个范围)

Switch(config-if-range)#channel-group (通道组)1 (用户自定义)mode on

Switch(config-if)#switchport mode trunk 把接口模式改成truck

在trunk链路聚合中去除外来客户使用的电脑所在的vlan(多线)

Switch(config)#interface port-channel 1

Switch(config-if)#switchport trunk allowed vlan remove 2