思科交换机基本配置命令

思科交换机基本配置命令
思科交换机基本配置命令

思科交换机基本配置命令

目录

1、基本概念介绍 (2)

2、密码、登陆等基本配置 (2)

3、CISCO设备端口配置详解 (4)

4、VLAN的规划及配置 (6)

4.1核心交换机的相关配置 (6)

4.2接入交换机的相关配置 (8)

5、配置交换机的路由功能 (9)

6、配置交换机的DHCP功能 (9)

7、常用排错命令 (10)

1、基本概念介绍

IOS: 互联网操作系统,交换机和路由器常用操作系统

VLAN: 虚拟lan

VTP: VLAN TRUNK PROTOCOL

DHCP: 动态主机配置协议

ACL:访问控制列表

三层交换机:具有三层路由转发能力的交换机

2、密码、登陆等基本配置

本节介绍cisco路由器或者交换机的基本配置,本教程用的是cisco的模拟器做的介绍,一些具体的端口显示可能与实际的设备不符,但并不影响基本配置命令的执行。

Router>

# 显示稳定后,出现最初的提示符,提示符“>”表示目前所处的状态为用户模式。Router>

Router>en

# 如果在当前状态下没有重复的命令,可以用“TAB”键来补齐命令

Router>enable

# 从用户模式(user mode)进入到特权模式(exec mode),提示符变为“#”

Router#configure terminal

#在特权模式下输入configure terminal进入全局配置模式(global configuration mode),在这之下输入的命令叫做全局命令,一旦输入,将对整个router产生即时影响。

*Mar 1 00:44:26.491: %SYS-5-CONFIG_I: Configured from console by console t # 在输入命令的过程中,IOS会出现一些即时提示。

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#exit # 退出当前模式

Router(config)#hostname test

# 更改当前设备的名字,主要是为了便于区分设备。

test(config)#

# 回车后当前的设备的名字发生了改变

test(config)#enable password cisco # 配置设备的登陆密码(不加密)

test(config)#end # 直接退回到全局配置模式

test#sh r # 查看交换机当前配置信息,此命令的完整写法是show running-config,此处的sh r用的是省略的写法,因无其他重复的命令所以可以被执行。

Building configuration...

Current configuration : 1559 bytes

!

version 12.3

service timestamps debug datetime msec

service timestamps log datetime msec

no service password-encryption

!

hostname test # 此处显示的是配置的设备名字

!

boot-start-marker

boot-end-marker

!

enable password cisco

# 此处显示的是配置的enable密码,注意此时是用明文显示的,不太安全。

!

no aaa new-model

!

resource policy

!

memory-size iomem 5

ip subnet-zero

!

--More--

# 到这一行其实并未全部显示完配置的内容,可以按键盘上的任意键来终止继续显示或通过按回车键逐行显示,或按空格键逐页的显示

test#conf t # 重新进入到全局配置模式

test(config)#service password-encryption # 利用这条命令给密码加密显示。

test(config)#end # 退回特权模式

test(config)#no service password-encryption

# 可利用这条命令(前面加no)来去掉密码加密功能,cisco的所有命令都可以通过这种方式来禁止。

test(config)#enable secret cisco #也可以直接用这个命令设置加密显示的登录密码配置超级终端登录参数

test(config)#line console 0 # 进入超级终端登录方式参数配置

test(config-line)#login # 启用密码,no login是不启用密码,不是必须的步骤test(config-line)#password cisco # 设置登录密码

test(config-line)#logging ?

# 在任何情况下如果忘记命令的相关参数可以用?来获得提示和帮助

synchronous Synchronized message output

test(config-line)#logging synchronous

# 在进行配置时,IOS会产生一些即时的提示信息,而这些信息会冲乱我们的光标显示,用这条命令可以将光标规矩在下一行,即使出现了一些即时的提示。

test(config-line)#exit # 退出当前console口的参数配置

test(config-line)#no password cisco # 清除console口设置的密码

Telnet登录相关参数设置

test(config)#interface vlan1

test(config-if)#ip address 192.168.1.100 255.255.255.0 #设置远程登录IP及子网掩码test(config-if)#no shutdown #启用网卡

test(config-if)#ip default-gateway 192.168.1.1 #设置缺省网关

test(config)#line vty 0 4

# vty 0 4代表同时允许5个用户通过telnet远程登录设备

test(config-line)#password cisco

# 配置telnet登录时的密码,如果此处不设置密码,那么用telnet来登陆的时候会提示:相关密码没有设置,禁止登陆。所以为了能远程telnet到这台设备,此处的密码一定要设置。

test(config-line)#login # 允许通过telnet来登录

test(config-line)#exit # 退出当前配置模式到全局配置模式。

test(config)#

test#conf s

Translating "s"...domain server (255.255.255.255)

% Unknown command or computer name, or unable to find computer address

# 在做配置的时如果出现输入错误的情况,ios系统会以为用户输入的是一个域名,就会做长时间的搜寻,试图找到这个域名对应的ip地址,这段时间比较长

test(config)#no ip domain-lookup # 在全局配置模式下,将ip域名的搜寻功能关闭就可以了test#conf x # 将上述功能关闭以后,再有输入错误的情况会直接提示你输入错误。

^

% Invalid input detected at '^' marker.

test(config)#ip domain-name 202.102.128.68

# 如果有必要将设备配置上DNS功能的话就用这条命令。

3、cisco设备端口配置

User Access Verification

# 从dos提示符下运行telnet ip地址,就会连接到相应的交换机或者路由器

Password: # 输入配置好的telnet密码,也就是上节提到的vtp中的密码

test>enable # 进入特权模式

Password: # 输入特权模式密码,也就是上节提到的enable密码。注意这些密码在输入的时候屏幕是不显示的。

test#show version # 查看系统硬件的配置,软件版本号等

test#show running-config # 查看当前正在运行的配置信息

test#show interfaces # 查看所有端口的配置信息

test#show interfaces f0/x # 查看具体某个具体端口号的配置信息

test#show ip interface brief # 查看当前所有端口ip状态,包括vlan和实际的物理接口状态,千兆端口的名称为:GigabitEthernet,百兆端口的名称为:FastEthernet。

ttest(config)#interface gi1/2

# 通过此命令进入端口配置模式,此处进入的是GigabitEthernet1/2口,gi1/2为简写。

test(config-if)#speed ? # 查询端口的可选速度模式

10 Force 10 Mbps operation # 强制此端口为10M

100 Force 100 Mbps operation # 强制此端口为100M

1000 Force 1000 Mbps operation # 强制此端口为1000M

auto Enable AUTO speed configuration # 允许速度自动协商

test(config-if)#speed 100

# 通过此命令就可将此端口强制设成100M,默认的状态下是auto。

test(config-if)#duplex ? # 查询此端口的可选双工模式

auto Enable AUTO duplex configuration # 自动配置此端口的双工模式

full Force full duplex operation # 强制此端口为全双工模式

half Force half-duplex operation # 强制此端口为半双工模式

test(config-if)#duplex auto # 强制此端口的双工模式为自适应模式

test(config-if)#end # 用end命令可直接退回到特权模式,用exit是一层一层的退出。test#terminal monitor # 打开终端监控。当用telnet登陆的时候默认是不显示各端口的实时变化情况的,打开这个功能就能实时的看到这台交换机上哪个端口up,哪个端口down,这对于排错的时候是很有帮助的。

test(config)#int gi1/2 # 重新回到端口配置模式

test(config-if)#shutdown # 手工关闭此端口

test(config-if)#no shut # 手工打开此端口

test(config-if)#switchport access vlan 100

# 我们配置此端口属于vlan100,如果此端口事先属于其他vlan,那么就会从其他vlan退出test(config)#int range gi 1/1-5 # 也可同时配置多个端口,表示同时对gi1/1到gi1/5这5个端口进行操作

test(config-if-range)#switchport access vlan 100 # 可同时配置这5个端口属于vlan100 test(config-if-range)#shutdown # 可同时关闭这5个端口

test(config-if-range)#no shutdown # 可同时启用这5个端口

test#sh int gi1/2 # 在特权模式下查看单个端口的状态GigabitEthernet1/2 is down, line protocol is down (notconnect)

# 这行说明此端口当前的状态是down的

Hardware is Gigabit Ethernet Port, address is 001a.6db4.a3c1 (bia 001a.6db4.a3c1)

# 此端口的MAC地址

......

Auto-duplex, Auto-speed, link type is auto, media type is 10/100/1000-TX

# 此端口的模式为10/100/1000-TX

test#sh int gi1/1

GigabitEthernet1/1 is up, line protocol is up (connected)

# 这行表明此端口是up的,并且连有网线。

......

0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored # 没有输入错误,表明链路状态良好

0 input packets with dribble condition detected

335026620 packets output, 223732323465 bytes, 0 underruns # 输出数据包统计

......

test#write # 保存配置结果

4、vlan的规划及配置

在本节中我们讲解vlan的规划及具体的配置命令。在此例中用的是vtp(VLAN Trunking Protocol)server的模式,在这种模式中需要配置核心交换机的vtp模式为server,各接入交换机的vtp模式为cilent,那么配置完成后接入交换机就会通过trunk口自动从核心交换机学习到所有的vlan配置信息。在接入交换机中只需要添加相应的端口即可,这样易于管理与部署。

4.1 核心交换机的相关配置

TEST#show vlan # 显示已经有的vlan信息,并且同时显示了各端口所属的vlan VLAN Name Status Ports

---- -------------------------------- --------- -------------------------------

1 default active Gi1/2, Gi1/3, Gi1/4, Gi1/5, Gi1/6, Gi1/7, Gi1/8, Gi1/9, Gi1/10, Gi1/11, Gi1/13, Gi1/14, Gi1/16, Gi1/17, Gi1/18, Gi1/19, Gi1/20, Gi3/12, Gi3/13, Gi3/16

2 firewall active Gi1/1

10 Engineering active Gi3/9, Gi3/10

20 Procurement active Gi3/19

50 Yard active Gi3/18

150 Server active Gi3/1, Gi3/2, Gi3/3, Gi3/4, Gi3/5, Gi3/6, Gi3/7, Gi3/8

160 Client active Gi3/11, Gi3/15

# 从这行往下是为其他协议预留的vlan号段,这些不必理会。

1002 fddi-default act/unsup 1003 token-ring-default act/unsup

1004 fddinet-default act/unsup

1005 trnet-default act/unsup

TEST(config)#vlan 200 # 新建一个vlan号为200的vlan

TEST(config-vlan)#name test # 给这个vlan命名,便于日常的管理。

TEST(config-vlan)#end # 建好vlan后退出到特权模式中

TEST#show ip int brief

# 显示目前有的端口配置状态,我们会发现此时并没有vlan200的相关信息

TEST(config)#interface gigabitEthernet 1/2 # 进入端口配置模式

TEST(config-if)#switchport access vlan 200 # 将此端口加入到vlan200中

TEST(config)#int vlan 200 # 给vlan 200添加相应的ip地址

TEST(config-if)#ip address 10.10.10.0.1 255.255.255.0 # 添加具体的ip地址

TEST(config-if)#no shut d own # 启用此端口

## 小结一下:在刚才的配置过程中,端口Gi1/2下面所连接的电脑的网关就是vlan200的地址——10.10.0.1。

TEST#show interface trunk

# 显示当前交换机中的trunk接口。作为trunk接口的端口下联的是接入层(或者是汇聚层)的交换机。

Port Mode Encapsulation Status Native vlan

Gi1/15 on 802.1q trunking 1

Port Vlans allowed on trunk

Gi1/15 1-4094

Port Vlans allowed and active in management domain

Gi1/15 1-2,10,20,30,40,50,60,70,80,100,110,120,150,160,200

Port Vlans in spanning tree forwarding state and not pruned

Gi1/15 1-2,10,20,30,40,50,60,70,80,100,110,120,150,160,200

TEST(config)#int gi1/15 # gi1/15为例说明如何将端口配置成trunk接口

TEST(config-if)#switchport mode ? # 定义此接口的模式为trunk

access Set trunking mode to ACCESS unconditionally

dynamic Set trunking mode to dynamically negotiate access or trunk mode

private-vlan Set the mode to private-vlan host or promiscuous

trunk Set trunking mode to TRUNK unconditionally

TEST(config-if)#switchport mode trunk

TEST(config-if)#switchport trunk allow vlan 1,220,230,240 #设置允许vlan220、230、240通过,如果不进行设置则默认允许该交换机上存在的所有vlan通过

TEST(config-if)#switchport trunk encapsulation ?

# 定义trunk口的封装类型,此处选择dot1q也叫802.1q,为通用封装类型

dot1q Interface uses only 802.1q trunking encapsulation when trunking

isl Interface uses only ISL trunking encapsulation when trunking

negotiate Device will negotiate trunking encapsulation with peer on interface

TEST(config-if)#switchport trunk encapsulation dot1q

# 对于使用的交换机都是思科交换机时,在设置多台交换机互联及分配VLAN时应该选择ISL TRUNK封装方式,这是思科独有的封装技术,兼容性和稳定性更佳。但如果用的是不同品牌的交换机,就需要使用通过switchport trunk encapsulation dot1q命令将封装类型改为802.1Q,或者是通过switchport trunk encapsulation negotiate命令进行自协商。

接下来是如何配置此核心交换机的VTP的一些相关设置。

TEST(config)#vtp mode ?

client Set the device to client mode.

server Set the device to server mode.

transparent Set the device to transparent mode.

TEST(config)#vtp mode server

# 首先在全局配置模式中将vtp的mode设置成server

TEST(config)#vtp domain pjoe

# 然后配置vtp的domain,所有的交换机应该在一个domain中

TEST(config)#vtp password pjoeserver

# 配置此vtp的介入密码,这样可以防止未授权的交换机随便加入到这个domian中来。TEST#show vtp status # 显示vtp的状态

VTP Version : 2

Configuration Revision : 22

Maximum VLANs supported locally : 1005

Number of existing VLANs : 20

VTP Operating Mode : Server # vtp的模式为server模式

VTP Domain Name : pjoe # vtp的域名是pjoe

VTP Pruning Mode : Disabled

VTP V2 Mode : Disabled

VTP Traps Generation : Enabled

MD5 digest : 0x00 0xB3 0x21 0xB7 0x56 0xD7 0x06 0x4F

# 此处表示的是vtp的密码(已加密)

Configuration last modified by 192.168.113.254 at 12-3-07 22:52:46

Local updater ID is 192.168.113.254 on interface Vl1 (lowest numbered VLAN interface found)

# 小结一下:经过以上的配置就将核心交换机的vtp等的配置工作完成了,只需要再配置好接入交换机的相关vtp参数和对应的trunk接口,接入交换机就能够从核心交换机上获取到所有的vlan信息,而不需要重新建立各个vlan。

TEST(config)#no vlan 200 # 第一步,删除vlan200

TEST(config)#no int vlan 200 # 第二步,删除int vlan200 ,经过这两步就可以彻底的删除vlan200

4.2 接入交换机的相关配置

# 在此例中联入的是一台接入交换机,此交换机的gi0/1口上联至核心交换机。也就意味着需要配置gi0/1为trunk口。具体的配置如下:

D-2960-3(config)#int gi0/1

D-2960-3(config-if)#switchport mode trunk

# 配置此接口的模式为trunk,在cisoc2960交换机中,配置完接口模式为trunk后就可以了,不需要进一步配置此trunk口的封装状态,因为其默认的也是唯一的封装类型就是dot1q,

并且此系列交换机并没有专门的封装配置命令。

D-2960-3(config)#vtp mode client

# 配置vtp模式为client,与核心交换机的server模式相呼应。

D-2960-3(config)#vtp domain pjoe

# 配置vtp域为pjoe,只有一个域中的交换机才能互传vlan信息。

D-2960-3(config)#vtp password pjoeserver # 配置vtp密码

# 稍等一会儿后通过show vlan验证一下是否学习到了核心交换机的vlan信息,它的学习有一小段的过程30秒的样子。

D-2960-3(config)#int vlan 1 # 管理ip地址配置在vlan1上

D-2960-3(config-if)#ip address 192.168.113.222 255.255.255.0 # 设置实际的ip地址

D-2960-3(config-if)#exit

D-2960-3(config)#ip default-gateway 192.168.113.254

# 设置这台交换机的网关,此地址即为核心交换机vlan1的地址。

5、配置交换机的路由功能

说明:只有在三层交换机上才有路由功能,其他的二层接入交换机要想在不同的vlan 之间传送数据需要通过trunk口到核心交换机上进行完路由交换后才可以。

TEST(config)#ip routing # 开启三层交换机的路由功能,默认是关闭的TEST(config)#ip route 0.0.0.0 0.0.0.0 172.16.0.1

# 配置交换机的默认路由,也就是总的出口路由。

TEST#sh ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

ia - IS-IS inter area, * - candidate default, U - per-user static route

o - ODR, P - periodic downloaded static route

Gateway of last resort is 172.16.0.1 to network 0.0.0.0

C 192.168.106.0/24 is directly connected, Vlan60

# 这种类型的路由——标志为“C”的路由,为静态直连路由。

S* 0.0.0.0/0 [1/0] via 172.16.0.1 # 为配置的默认路由

6、配置交换机的DHCP功能

以让vlan120提供DHCP功能为例

TEST(config)#ip dhcp pool wlan # 配置交换机的地址池并命名

TEST(config)#network 192.168.112.0 255.255.255.0 # 定义此地址池的网段

TEST(config)#default-router 192.168.112.254 # 定义分发下去的地址的默认网关

TEST(config)#dns-server 202.102.128.68 202.102.134.68

# 定义分发下去地址的DNS服务器,此处是2个中间用空格分隔。

TEST(config)#ip dhcp excluded-address 192.168.112.200 192.168.112.254

# 定义保留的ip地址端

# 至此所属这个vlan的客户机就可以通过自动获取地址的方式来得到正确的ip、网关、dns 等信息。

7、常用排错命令

TEST#terminal monitor

# 排除网络故障以前,请打开这一命令以便实时的接收到交换机的提示信息。

TEST#show running-config

#显示所有的配置清单,可将这些配置保存成文本作为交换机的配置备份。

TEST#show ip interface brief #显示所有端口的状态

TEST#show vlan # 显示所有的vlan信息

TEST#show vtp status # 显示vtp协议的相关配置

TEST#show interface gi1/2 # 显示具体物理接口的信息

TEST#show ip route # 显示这台交换机的所有路由信息

TEST#show processes cpu # 显示交换机的cpu利用率

TEST#reload # 重新启动交换机

TEST#show version # 显示当前设备的版本信息

思科交换机命令大全

思科交换机命令大全集团文件发布号:(9816-UATWW-MWUB-WUNN-INNUL-DQQTY-

思科交换机常用命令大全 1.1 用户模式与特权模式 用户模式:可以使用一些基本的查询命令 特权模式:可以对交换机进行相关的配置 进入特权模式命令:Switch>enable 退出特权模式命令:Switch#exit 启用命令查询: 时间设置:Switch#clock set 时间(自选参数,参数必须符合交换机要求) 显示信息命令:Switch#show 可选参数 注意:可以用TAB键补齐命令,自选参数为用户自定义参数,可选参数为交换机设定参数 查看交换机配置: Switch#show running-config 保存交换机配置:Switch#copy running-config startup-config Switch#wr

查看端口信息:Switch#show interface 查看MAC地址表:Switch#show mac-address-table 查看交换机CPU的状态信息:Switch#show processes 1.2 全局配置模式 进入全局配置模式:Switch#configure terminal 主机名修改:Switch(config)#hostname 主机名(自选参数) 特权模式进入密码: Switch(config)#enable secret 密码(自选参数) 取消特权模式密码:Switch(config)#no enable secret 取消主机名设置: Switch(config)#no hostname 退出配置模式: Switch(config)#exit 需要特别注意的是在配置模式中无法使用show命令,如果要使用 的话show前必须加do和空格,例如:do show * 指定根交换机命令:Switch(config)#spanning-tree vlan 自选参数(VLAN号) root primary 例如: Switch(config)#spanning-tree vlan 1 root primary

Cisco设备的基本配置命令

switch> 用户模式 1:进入特权模式 enable switch> enable switch# 2:进入全局配置模式 configure terminal switch> enable switch#c onfigure terminal switch(conf)# 3:交换机命名 hostname aptech2950 以aptech2950为例 switch> enable switch#c onfigure terminal switch(conf)#hostname aptch-2950 aptech2950(conf)# 4:配置使能口令 enable password cisco 以cisco为例 switch> enable switch#c onfigure terminal switch(conf)#hostname aptch2950 aptech2950(conf)# enable password cisco 5:配置使能密码 enable secret ciscolab 以cicsolab为例 switch> enable switch#c onfigure terminal switch(conf)#hostname aptch2950 aptech2950(conf)# enable secret ciscolab 6:设置虚拟局域网vlan 1 interface vlan 1 switch> enable switch#c onfigure terminal switch(conf)#hostname aptch2950 aptech2950(conf)# interface vlan 1 aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0 配置交换机端口ip 和子网掩码 aptech2950(conf-if)#no shut 是配置处于运行中aptech2950(conf-if)#exit aptech2950(conf)#ip default-gateway 192.168.254 设置网关地址 7:进入交换机某一端口 interface fastehernet 0/17 以17端口为例switch> enable switch#c onfigure terminal switch(conf)#hostname aptch2950 aptech2950(conf)# interface fastehernet 0/17 aptech2950(conf-if)#

思科交换机-常用命令及配置

思科交换机-常用命令及配置 switch> 用户模式 1:进入特权模式enable switch> enable switch# 2:进入全局配置模式configure terminal switch> enable switch#configure terminal switch(conf)# 3:交换机命名hostname name 以cisco001 为例 switch> enable switch#c onfigure terminal switch(conf)#hostname cisco001 cisco001(conf)# 4:配置使能口令(未加密)enable password cisco 以cisco 为例switch> enable switch#configure terminal cisco001(conf)# enable password cisco 5:配置使能密码(加密)enable secret ciscolab 以cicsolab 为例switch> enable switch#configure terminal switch(conf)# enable secret ciscolab

6:设置虚拟局域网vlan 1 interface vlan 1 switch> enable switch#configure terminal switch(conf)# interface vlan 1 switch(conf)# ip address 192.168.1.1 255.255.255.0 配置交换机端口ip 和子网掩码 switch (conf-if)#no shut 激活端口 switch (conf-if)#exit switch (conf)#ip default-gateway 192.168.254 设置网关地址 7:进入交换机某一端口interface fastehernet 0/17 以17 端口为例 switch> enable switch#configure terminal switch(conf)# interface fastehernet 0/17 switch(conf-if)# 8:查看命令show switch> enable switch# show version 察看系统中的所有版本信息 show interface vlan 1 查看交换机有关ip 协议的配置信息 show running-configure 查看交换机当前起作用的配置信息 show interface fastethernet 0/1 察看交换机1 接口具体配置和统计信息 show mac-address-table 查看mac 地址表

思科交换机命令大全

思科交换机常用命令大全 1.1 用户模式与特权模式 用户模式:可以使用一些基本的查询命令 特权模式:可以对交换机进行相关的配置 进入特权模式命令:Switch>enable 退出特权模式命令:Switch#exit 启用命令查询:? 时间设置:Switch#clock set 时间(自选参数,参数必须符合交换机要求) 显示信息命令:Switch#show 可选参数 注意:可以用TAB键补齐命令,自选参数为用户自定义参数,可选参数为交换机设定参数 查看交换机配置: Switch#show running-config 保存交换机配置:Switch#copy running-config startup-config Switch#wr 查看端口信息:Switch#show interface 查看MAC地址表:Switch#show mac-address-table 查看交换机CPU的状态信息:Switch#show processes 1.2 全局配置模式 进入全局配置模式:Switch#configure terminal

主机名修改:Switch(config)#hostname 主机名(自选参数) 特权模式进入密码: Switch(config)#enable secret 密码(自选参数) 取消特权模式密码:Switch(config)#no enable secret 取消主机名设置: Switch(config)#no hostname 退出配置模式: Switch(config)#exit 需要特别注意的是在配置模式中无法使用show命令,如果要使用 的话show前必须加do和空格,例如:do show * 指定根交换机命令:Switch(config)#spanning-tree vlan 自选参数(VLAN号)root primary 例如: Switch(config)#spanning-tree vlan 1 root primary 需要注意的是:设置根交换机是基于VLAN的 关闭生成树协议命令:Switch(config)#no spanning-tree vlan 自选参数(VLAN 号) 例如: Switch(config)#no spanning-tree vlan 1 1.3 接口配置模式 进入接口配置模式:Switch(config)#interface 端口名称(可选参数) 启用端口:Switch(config-if)#no shutdown 停用端口:Switch(config-if)#shutdown 进入同种类型多端口配置:Switch(config)# interface range fastethernet 0/1-5 进入不同类型多端口配置:Switch(config)#interface range fastethernet 0/1-5,gigabitethernet 0/1-2

华为,CISCO交换机基本命令配置

华为交换机命令 2007-12-14 14:59 计算机命令 ~~~~~~~~~~ PCA login: root ;使用root用户 password: linux ;口令是linux # shutdown -h now ;关机 # init ;关机 # logout ;用户注销# login ;用户登录# ifconfig ;显示IP地址# ifconfig eth0 netmask ;设置IP地址 # ifconfig eht0 netmask down ;禁用IP地址 # route add 0.0.0.0 gw ;设置网关 # route del 0.0.0.0 gw ;删除网关 # route add default gw ;设置网关 # route del default gw ;删除网关 # route ;显示网关

# ping ;发ECHO包 # telnet ;远程登录 ---------------------------------------- 交换机命令 ~~~~~~~~~~ [Quidway]dis cur ;显示当前配置 [Quidway]display current-configuration ;显示当前配置[Quidway]display interfaces ;显示接口信息 [Quidway]display vlan all ;显示路由信息 [Quidway]display version ;显示版本信息 [Quidway]super password ;修改特权用户密码 [Quidway]sysname ;交换机命名 [Quidway]interface ethernet 0/1 ;进入接口视图 [Quidway]interface vlan x ;进入接口视图 [Quidway-Vlan-interfacex]ip address 10.65.1.1 255.255.0.0 ;配置VLAN的IP地址 [Quidway]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 ;静态路由=网关 [Quidway]rip ;三层交换支持

Cisco IOS 基本命令

Cisco IOS 基本命令一、基本路由器的检验命令 show version show processes show protocols show mem show ip route show startup-config show running-config show flash show interfaces 二、基本路由配置命令 进入:config terminal/memory/network 配置网络时常采用的命令:copy和load 1.标识:hostname 标识名 2.启动标识:banner 启动标识 3.接口:interface 端口号 4.密码:line 0 6 login passwd 口令 enable password/secret 口令 5.接口:

1)配置端口 interface 端口号 clock rate 时钟速率(64000)/* 在串口中配置*/ bandwidth 带宽(缺省56)/* 在串口中配置*/ media-type 介质类型/* 在以太网口上*/ early-token release /* 在令牌环网口上*/ ring-speed 16 /* 在令牌环网口上*/ no shutdown write memory 2)检验端口 show interfaces show controllers 6.配置环境 1)引导方式 boot system flash IOS-filename boot system tftp IOS-filename tftp-address boot system rom 2)配置Register值 config-register 0x2102 7.查看邻居路由 show cdp interface show cdp neighbors [detail]

1-cisco路由器基本配置及远程登录

实训目的: (1)学习和掌握科路由器的配置方式和要求。 (2)学习和掌握科路由器的工作模式分类、提示符、进入方式。1、路由器的配置方式 ①超级终端方式。该方式主要用于路由器的初始配置,路由器不需要IP地址。基本方法是:计算机通过COM1/COM2口和路由器的Console口连接,在计算机上启用“超级终端”程序,设置“波特率:9600 ,数据位:8,停止位:1,奇偶校验: 无,校验:无”即可。常用 ②Telnet方式。该方式配置要求路由器必须配置了IP地址。基本方法是:计算机通过网卡和路由器的以太网接口相连,计算机的网卡和路由器的以太网接口的IP地址必须在同一网段。常用 ③其他方式:AUX口接MODEM,通过电话线与远方运行终端仿真软件的微机;通过Ethernet上的TFTP服务器;通过Ethernet上的SNMP网管工作站。 2、路由器的工作模式 在命令行状态下,主要有以下几种工作模式: ①一般用户模式。主要用于查看路由器的基本信息,只能执行少数命令,不能对路由 器进行配置。提示符为:Router>;进入方式为:Telnet或Console ②使能(特权)模式。主要用于查看、测试、检查路由器或网络,不能对接口、路由 协议进行配置。提示符为:Router#;进入方式为:Router>enable。 ③全局配置模式。主要用于配置路由器的全局性参数。提示符为:Router(config)#; 进入方式为:Router#config ter。 ④全局模式下的子模式。包括:接口、路由协议、线路等。其进入方式和提示符如下: Router(config)#ineterface e0 //进入接口模式 Router(config-if)#//接口模式提示符 Router(config)#rip //进入路由协议模式 Router(config-router)# //路由协议模式 Router(config)#line con 0 //进入线路模式

思科交换机配置维护手册

思科交换机配置维护手册

目录

一、端口配置 1.1 配置一组端口 当使用interface range命令时有如下的规则: ?有效的组范围: o vlan从1 到4094 o fastethernet槽位/{first port} - {last port}, 槽位为0 o gigabitethernet槽位/{first port} - {last port},槽位为0 o port-channel port-channel-number - port-channel-number, port-channel号从1到64 ?端口号之间需要加入空格,如:interface range fastethernet 0/1 – 5是有效的,而interface range fastethernet 0/1-5是无效的. ?interface range命令只能配置已经存在的interface vlan ?所有在同一组的端口必须是相同类别的。

见以下例子: Switch# configure terminal Switch(config)# interface range fastethernet0/1 - 5 Switch(config-if-range)# no shutdown 以下的例子显示使用句号来配置不同类型端口的组: Switch# configure terminal Switch(config)# interface range fastethernet0/1 - 3, gigabitethernet0/1 - 2 Switch(config-if-range)# no shutdown 1.2 配置二层端口 1.2.1 配置端口速率及双工模式

思科基本配置命令详解

思科交换机基本配置实例讲解

目录 1、基本概念介绍............................................... 2、密码、登陆等基本配置....................................... 3、CISCO设备端口配置详解...................................... 4、VLAN的规划及配置........................................... 4.1核心交换机的相关配置..................................... 4.2接入交换机的相关配置..................................... 5、配置交换机的路由功能....................................... 6、配置交换机的DHCP功能...................................... 7、常用排错命令...............................................

1、基本概念介绍 IOS: 互联网操作系统,也就是交换机和路由器中用的操作系统VLAN: 虚拟lan VTP: VLAN TRUNK PROTOCOL DHCP: 动态主机配置协议 ACL:访问控制列表 三层交换机:具有三层路由转发能力的交换机 本教程中“#”后的蓝色文字为注释内容。 2、密码、登陆等基本配置 本节介绍的内容为cisco路由器或者交换机的基本配置,在目前版本的cisco交换机或路由器上的这些命令是通用的。本教程用的是cisco的模拟器做的介绍,一些具体的端口显示或许与你们实际的设备不符,但这并不影响基本配置命令的执行。 Cisco 3640 (R4700) processor (revision 0xFF) with 124928K/6144K bytes of memory. Processor board ID 00000000 R4700 CPU at 100MHz, Implementation 33, Rev 1.2

思科交换机配置命令大全

思科交换机配置命令大全 switch> 用户模式 1:进入特权模式 enable switch> enable switch# 2:进入全局配置模式 configure terminal switch> enable switch#configure terminal switch(conf)# 3:交换机命名 hostname aptech2950 以aptech2950为例 switch> enable switch#configure terminal switch(conf)#hostname aptch-2950 aptech2950(conf)# 4:配置使能口令 enable password cisco 以cisco为例 switch> enable switch#configure terminal switch(conf)#hostname aptch2950 aptech2950(conf)# enable password cisco 5:配置使能密码 enable secret ciscolab 以cicsolab为例 switch> enable switch#configure terminal switch(conf)#hostname aptch2950 aptech2950(conf)# enable secret ciscolab 6:设置虚拟局域网vlan 1 interface vlan 1 switch> enable switch#configure terminal switch(conf)#hostname aptch2950 aptech2950(conf)# interface vlan 1 aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0 配置交换机端口ip 和子网掩码 aptech2950(conf-if)#no shut 是配置处于运行中aptech2950(conf-if)#exit aptech2950(conf)#ip default-gateway 192.168.254 设置网关地址 7:进入交换机某一端口 interface fastehernet 0/17 以17端口为例switch> enable switch#configure terminal

思科交换机型号解释

思科交换机型号解释 1. CISCO开头的产品都是路由器; 2. RSP开头的都是CISCO7500系列产品的引擎; 3. VIP开头的产品都是CISCO 7500系列产品的多功能接口处理器模块 4. PA开头的产品都是CISCO 7500/7200系列产品的模块. 5. NPE开头的都是CISCO7200系列产品的引擎; 6. NM开头的都是CISCO低端路由器模块; 7. WIC开头的都是CISCO低端路由器的广域网接口模块; 8. VWIC开头的都是CISCO低端路由器的语音接口模块; 9. WS-C开头的产品都是交换机; 10. WS-X开头的产品是交换机的引擎或模块; 11. WS-G开头的产品是交换机的千兆光纤模块. 12.NN 是交换机的系列号, XX 对于固定配置的交换机来说是端口数,对于模块化交换机来说是插槽数,有 -C 标志表明带光纤接口, -M 表示模块化, - WS-C2960-24TT-L ,WS 表示什么? 解: W代表支持IPSEC 40位加密 S代表Switchboard 交换机 WS就是代表支持支持IPSEC 40位加密的Switchboard 交换机型号 WS-C是有两种一个是C一个是X,C代表固化交换机或者机箱,X代表的是模块。 A 和 -EN 分别是指交换机软件是标准板或企业版。 eg:WS-C3750G-48TS-S C3750表明这款产品属于3750这个系列,也就是产品的型号。 G----表明其所有接口都是支持千兆或以上,如果没有这个就表明其主要端口都是10/100M 的或者100M的 48----表明其拥有主要的端口数量为48个 T----表明其主要端口是电口(也就是所谓的Twirst Pair的端口 P----表明其主要端口是电口,同时支持PoE以太网供电 S----表明其带的扩展的接口为SFP类型的接口 最后部分的S表明交换机带的软件是SMI标准影像的 E----表明是EMI影像的 二、型号后面的字母解释,如:WS-C3750G-48TS-S 中的G的位置 ?空-表示其主要端口都是10/100M的或100M的 ?G----全千兆及以上,2950G除外,他的G表示GBIC上行

Cisco交换机常用配置命令

Cisco交换机常用配置命令 CISCO交换机基本配置 switch>ena 進入特权模式 switch#erasenvram 全部清除交换机的所有配置 switch#reload 重新启动交换机(初始提示符为switch> ) ------------------------------------------------------------------------------------ CISCO交换机基本配置:Console端口连接 用户模式hostname>; 特权模式hostname(config)# ; 全局配置模式hostname(config-if)# ; 交换机口令设置: switch>enable ;进入特权模式 switch#config;进入全局配置模式 switch(config)#hostname cisco ;设置交换机的主机名 switch(config)#enable secret csico1 ;设置特权加密口令 switch(config)#enable password csico8 ;设置特权非密口令 switch(config)#line console 0 ;进入控制台口 switch(config-line)#line vty 0 4 ;进入虚拟终端 switch(config-line)#login ;虚拟终端允许登录 switch(config-line)#password csico6 ;设置虚拟终端登录口令csico6 switch#write 保存配置設置 switch#copy running-config startup-config 保存配置設置,與write一樣switch#exit;返回命令 配置终端过一会时间就会由全局配置模式自动改为用户模式,将超时设置为永不超时 switch#conf t switch(config)#line con 0 switch(config-line)#exec-timeout 0 --------------------------------------------------------------------------------- 交换机显示命令: switch#write;保存配置信息 switch#showvtp;查看vtp配置信息 switch#show run ;查看当前配置信息 switch#showvlan;查看vlan配置信息 switch#showvlan name vlan2 switch#show interface ;查看端口信息

思科路由器基本配置与常用配置命令

思科路由器基本配置与常用配置命令(simple for CCNA) 启动接口,分配IP地址: router> router> enable router# router# configure terminal router(config)# router(config)# interface Type Port router(config-if)# no shutdown router(config-if)# ip address IP-Address Subnet-Mask router(config-if)# ^z 配置RIP路由协议:30秒更新一次 router(config)# router rip router(config-if)# network Network-Number router(config-if)# ^z 配置IGRP路由协议:90秒更新一次 router(config)# router igrp AS-Number router(config-if)# network Network-Number router(config-if)# ^z配置Novell IPX路由协议:Novell RIP 60秒更新一次 router(config)# ipx routing [node address] router(config)# ipx maximum-paths Paths router(config)# interface Type Port router(config-if)# ipx network Network-Number [encapsulation encapsulation-type] [secondary] router(config-if)# ^z配置DDR: router(config)# dialer-list Group-Number protocol Protocol-Type permit [list ACL-Number] router(config)# interface bri 0 router(config-if)# dialer-group Group-Number router(config-if)# dialer map Protocol-Type Next-Hop-Address name Hostname Telphone-Number router(config-if)# ^z配置ISDN: router(config)# isdn swith-type Swith-Type router(config-if)# ^z 配置Frame Relay: router(config-if)# encapsulation frame-relay [cisco | ietf ] router(config-if)# frame-relay lmi-type [ansi | cisco | q933a ] router(config-if)# bandwidth kilobits router(config-if)# frame-relay invers-arp [ Protocol ] [dlci ] router(config-if)# ^z配置标准ACL: router(config)# access-list Access-List-Number [ permit | deny ] source [ source-mask ] router(config)# interface Type Port router(config-if)# ip access-group Access-List-Number [ in | out ] router(config-if)# ^z配置扩展ACL: router(config)# access-list Access-List-Number [ permit | deny ] [ Protocol | Protocol-Number ] source source-wildcard [ Source-Port ] destination destination-wildcard [ Destination-Port ] [ established ]

cisco交换机常用配置命令

3、常用配置命令 3.1 把端口加入到vlan Switch>en Password: Switch #conf t /*进入配置模式*/ Enter configuration commands, one per line. End with CNTL/Z. Switch (config)#inter f 0/1 /*进入端口*/ Switch (config-if)#switchport access vlan X /*把端口加入到vlan X*/ Switch (config-if)#end Switch #wr /*保存*/ Building configuration... [OK] Switch # 3.2 添加新vlan(在核心交换机上写) Switch>en Password: Switch #conf t /*进入配置模式*/ Enter configuration commands, one per line. End with CNTL/Z. Switch (config)#Vlan X /*添加新Vlan*/ Switch (config-vlan)#inter vlan X /*进入Vlan*/ Switch (config-if)#ip address x.x.x.x 255.255.255.0/*设置vlan ip地址*/ Switch (config-if)#no shut 3.3 配置trunk,透传vlan Switch>en Password: Switch #conf t /*进入配置模式*/ Enter configuration commands, one per line. End with CNTL/Z. Switch (config)#inter fast 0/x /*进入级联端口*/ Switch (config-if)#switchport mode trunk /*修改端口模式*/ Switch (config-if)# switchport trunk allowed vlan all /*设置允许通过的vlan*/ 保存 删除命令:所有的命令前面加no。

CISCO 常用命令解释

视图模式介绍: 普通视图 router> 特权视图 router# /在普通模式下输入enable 全局视图 router(config)# /在特权模式下输入config t 接口视图 router(config-if)# /在全局模式下输入int 接口名称例如int s0或int e0 路由协议视图 router(config-route)# /在全局模式下输入router 动态路由协议名称 1、基本配置: router>enable /进入特权模式 router#conf t /进入全局配置模式 router(config)# hostname xxx /设置设备名称就好像给我们的计算机起个名字 router(config)#enable password /设置特权口令 router(config)#no ip domain lookup /不允许路由器缺省使用DNS解析命令 router(config)# Service password-encrypt /对所有在路由器上输入的口令进行暗文加密router(config)#line vty 0 4 /进入设置telnet服务模式 router(config-line)#password xxx /设置telnet的密码 router(config-line)#login /使能可以登陆 router(config)#line con 0 /进入控制口的服务模式 router(config-line)#password xxx /要设置console的密码 router(config-line)#login /使能可以登陆 2、接口配置: router(config)#int s0 /进入接口配置模式 serial 0 端口配置(如果是模块化的路由器前面加上槽位编号,例如serial0/0 代表这个路由器的0槽位上的第一个接口) router(config-if)#ip add xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx /添加ip 地址和掩码router(config-if)#enca hdlc/ppp 捆绑链路协议 hdlc 或者 ppp 思科缺省串口封装的链路层协议是HDLC所以在show run配置的时候接口上的配置没有,如果要封装为别的链路层协议例如PPP/FR/X25就是看到接口下的enca ppp或者enca fr router(config)#int loopback /建立环回口(逻辑接口)模拟不同的本机网段 router(config-if)#ip add xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx /添加ip 地址和掩码给环回口 在物理接口上配置了ip地址后用no shut启用这个物理接口反之可以用shutdown管理性的关闭接口 3、路由配置: (1)静态路由 router(config)#ip route xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx 下一条或自己的接口router(config)#ip route 0.0.0.0 0.0.0.0 s 0 添加缺省路由 (2)动态路由 rip协议 router(config)#router rip /启动rip协议 router(config-router)#network xxx.xxx.xxx.xxx /宣告自己的网段 router(config-router)#version 2 转换为rip 2版本 router(config-router)#no auto-summary /关闭自动汇总功能,rip V2才有作用 router(config-router)# passive-int 接口名 /启动本路由器的那个接口为被动接口

思科交换机基本配置(非常详细)

cisco交换机基本配置 1.Cisco IOS简介 Cisco Catalyst系列交换机所使用的操作系统是IOS(Internetwork Operating System,互联网际操作系统)或COS(Catalyst Operating System),其中以IOS使用最为广泛,该操作系统和路由器所使用的操作系统都基于相同的内核和shell。 IOS的优点在于命令体系比较易用。利用操作系统所提供的命令,可实现对交换机的配置和管理。Cisco IOS操作系统具有以下特点: (1)支持通过命令行(Command-Line Interface,简称CLI)或Web界面,来对交换机进行配置和管理。 (2)支持通过交换机的控制端口(Console)或Telnet会话来登录连接访问交换机。 (3)提供有用户模式(user level)和特权模式(privileged level)两种命令执行级别,并提供有全局配置、接口配置、子接口配置和vlan数据库配置等多种级别的配置模式,以允许用户对交换机的资源进行配置。 (4)在用户模式,仅能运行少数的命令,允许查看当前配置信息,但不能对交换机进行配置。特权模式允许运行提供的所有命令。 (5)IOS命令不区分大小写。 (6)在不引起混淆的情况下,支持命令简写。比如enable通常可简约表达为en。 (7)可随时使用?来获得命令行帮助,支持命令行编辑功能,并可将执行过的命令保存下来,供进行历史命令查询。 1.搭建交换机配置环境 在对交换机进行配置之前,首先应登录连接到交换机,这可通过交换机的控制端口(Console)连接或通过Telnet登录来实现。 (1)通过Console口连接交换机 对于首次配置交换机,必须采用该方式。对交换机设置管理IP地址后,就可采用Telnet登录方式来配置交换机。 对于可管理的交换机一般都提供有一个名为Console的控制台端口(或称配置口),该端口采用RJ-45接口,是一个符合EIA/TIA-232异步串行规范的配置口,通过该控制端口,可实现对交换机的本地配置。 交换机一般都随机配送了一根控制线,它的一端是RJ-45水晶头,用于连接交换机的控制台端口,另一端提供了DB-9(针)和DB-25(针)串行接口插头,用于连接PC机的COM1或COM2串行接口。Cisco的控制线两端均是RJ-45水晶头接口,但配送有RJ-45到DB-9和RJ-45到DB-25的转接头。 通过该控制线将交换机与PC机相连,并在PC上运行超级终端仿真程序,即可实现将PC机仿真成交换机的一个终端,从而实现对交换机的访问和配置。 Windows系统一般都默认安装了超级终端程序,对于Windows 2000 Server系统,该程序位于【开始】菜单下【程序】中【附件】的【通讯】群组下面,若没有,可利用控制面板中的【添加/删除程序】来安装。单击【通讯】群组下面的【超级终端】,即可启动超级终端。 首次启动超级终端时,会要求输入所在地区的电话区号,输入后将显示下图所示的连接创建对话框,在【名称】输入框中输入该连接的名称,并选择所使用的示意图标,然后单击确定按钮。 图9-2 超级终端连接创建对话框

CISCO基本命令

端口速度:设置端口速度为:100Mbps/s 半双工模式 Switch# configure terminal Switch(config)# interface range gigabitethernet0/1 - 2 Switch(config-if-range)# speed 100 Switch(config-if)# duplex half 定义端口聚合并存储到NVRAM:定义名称为enet_list的端口组。 Switch# configure terminal Switch(config)# define interface-range enet_list gigabitethernet0/1 - 2 Switch(config)# end Switch# show running-config | include define Switch# define interface-range enet_list gigabitethernet0/1 – 2 Switch# configure terminal Switch(config)# no define interface-range enet_list Switch(config)# end Switch# show run | include define Switch# 设置端口类型: Switch(config-if)media-type auto-select | rj45 | sfp Switch#show interfaces interface-id transceiver properties

相关文档
最新文档