配置接口的基本参数.docx
《配置接口的基本参数.docx》由会员分享,可在线阅读,更多相关《配置接口的基本参数.docx(14页珍藏版)》请在冰豆网上搜索。
![配置接口的基本参数.docx](https://file1.bdocx.com/fileroot1/2023-2/6/ce936bfb-50db-4612-ba22-6266bea16ed0/ce936bfb-50db-4612-ba22-6266bea16ed01.gif)
配置接口的基本参数
作者:
风林
来源:
风林的家http:
//221.199.150.103/jsj/Html/net/book/Router/ppp.htm
日期:
2011/11/30
配置接口的基本参数
作者:
风林
来源:
风林的家
本部分包括以下内容:
交换机接口的类型
交换机接口的默认配置
交换机接口配置的一般方法
配置接口描述
配置接口速率
配置接口的双工模式
禁用/启用交换机接口
查看交换机接口信息
•交换机接口的类型
交换机的每个物理接口可处于以下模式中的一种:
类型
模式
描述
f
(此时应该把VLAN理解为一个接口)
或者是一个AggregatePort。
配置举例:
配置交换机的IP地址为
192.168.1.5,并把接口
设置为全双工模式。
fastethernetO/1和fastethernetO/2
Switch>enable
Switch#configureterminal
Switch(config)#interfacevlan1
Switch(config-if)#ipaddress192.168.1.5255.255.255.0
Switch(config-if)#interfacef0/1
Switch(config-if)#duplexfull
Switch(config-if)#interfacef0/2
Switch(config-if)#duplexfull
Switch(config-if)#end
Switch#
说明:
当交换机没有3层口时,所有接口都属于VLAN1所以VLAN1的IP地址就是交换机的IP地址。
成组配置接口:
如果有多个接口需要配置相同的参数时,可以成组配置这些接口。
Switch(config)#interfacerangeport-rangeSwitch(config-if)#配置接口参数
用逗号隔开。
注意:
在interfacerange中的接口必须是相同类型的接口。
的速度
配置举例:
配置交换机的接口fastethernet0/1~fastethernet0/12
丿JIVIJ丿IJLulUOlUrUIUrllilUrlIIUrlU丿w
fastethemet0/7~fastethemet0/10
分配给VLAN2
Switch>enable
Switch#configureterminal
Switch(config)#interfacerangefO/1-12
Switch(config-if)#speed100
Switch(config-if)#interfacerangef0/1-3,0/7-10
Switch(config-if)#switchportaccessvlan2
Switch(config-if)#end
Switch#
•配置接口描述
接口描述常用于标注一个接口的功能、用途等,有利于记录和了解网络拓扑。
模式:
在接口配置模式中配置。
配置命令:
Ruijie(config)#interfaceinterface-ID
Ruijie(config-if)#descriptionstring
interface命令用于指定要配置的接口。
参数interface-ID是接口的类型
和编号。
description命令用于设置此接口的描述文字。
说明:
接口描述的文字最多不得超过32个字符。
删除配置的描述:
Ruijie(config)#interfaceinterface-ID
IiitV^xtV/ti
配置举例:
Ruijie>enable
Ruijie#configureterminal
Ruijie(config)#interfacefO/1
Ruijie(config-if)#descriptionto-PC1
Ruijie(config-if)#interfacefO/2
Ruijie(config-if)#descriptionto-Switch1
Ruijie(config-if)#end
Ruijie#
本例为fastethernet0/1和fastethernet0/2配置了接口描述,这样可方便
了解它们所连接的设备。
配置的接口描述可以在配置文件中看到。
•配置接口速率
S3550的接口都是具有多种速率的自适应接口,10/100M两种速率,GigabitEthernet接口有情况下,他们用自协商方式确定他的工作速率。
一个固定速率。
FastEthernet接口有10/100/1000M三种速率,默认用配置可指定他们只使用某
模式:
在接口配置模式中配置。
配置命令:
Switch(config)#interfaceport-ID
Switch(config-if)#speed10|100|1000|auto
interface命令用于指定要配置的接口。
指定的接口可以是物理接口或
AggregatePort接口。
speed命令用于设置此接口的速率。
参数:
10——10Mbps100——100Mbps10001000Mbps(只能用于
GigabitEthernet接口),auto――使用自协商模式(默认值)。
说明:
当接口速率不是auto时,自协商过程被关闭,此时要求与该接口相
连的设备必须支持此速率。
删除配置的速率:
Switch(config)#interfaceport-ID
Switch(config-if)#nospeed
JT
配置举例:
配置交换机的fastethernet0/1口速率为100Mbps
Switch>enableSwitch#configureterminalSwitch(config)#interfacefO/1
Switch(config-if)#speed100
Switch(config-if)#endSwitch#
配置的接口速率可以在配置文件中看到。
•配置接口的双工模式
S3550的接口可工作于半双工模式或全双工模式,默认情况下,他们用自协商方式确定他的双工模式。
用配置可指定他们只使用某一种双工模式。
模式:
在接口配置模式中配置。
配置命令:
Switch(config)#interfaceport-ID
Switch(config-if)#dupiexauto|half|full
interface命令用于指定要配置的接口。
指定的接口可以是物理接口或
AggregatePort接口。
duplex命令用于设置此接口的双工模式。
参数:
auto――使用自协商模式(默认值),half――半双工模式,full
全双工模式。
说明:
当双工模式不是auto时,自协商过程被关闭,此时要求与该接口相
连的设备必须支持此双工模式。
删除配置的双工模式:
Switch(config)#interfaceport-ID
Switch(config-if)#noduplex
配置举例:
配置交换机的fastethernetO/1口双工模式为全双工模式。
Switch>enable
Switch#configureterminal
Switch(config)#interfacefO/1
Switch(config-if)#duplexfull
Switch(config-if)#end
Switch#
配置的接口双工模式可以在配置文件中看到。
•禁用/启用交换机接口
Up如果禁用了一个
Down
交换机的所有接口默认是启用的,此时接口的状态为接口,贝U该接口不能收发任何帧,此时接口的状态为
模式:
在接口配置模式中配置。
禁用指定接口:
Switch(config)#interfaceport-ID
Switch(config-if)#shutdown
启用指定接口:
Switch(config)#interfaceport-IDSwitch(config-if)#noshutdown
说明:
interface指定的接口可以是物理接口、VLAN或AggregatePort接
口。
口。
配置举例:
禁用交换机的fastethernetO/l
Switch>enableSwitch#configureterminalSwitch(config)#interfacefO/1Switch(config-if)#shutdown
Switch(config-if)#endSwitch#
查看交换机接口信息
在特权模式下,用showinterfaces命令可查看交换机指定接口的设置和
统计信息。
命令:
Switch#showinterfaces[port-ID][counters|description|status|switchport|trunk]
参数:
port-ID:
可选,指定要查看的接口,可以是物理接口、VLAN或AggregatePort接口。
counters:
可选,只查看接口的统计信息。
description:
可选,只查看接口的描述信息。
status:
可选,查看接口的各种状态信息,包括速率、双工等。
switchport:
可选,查看2层接口信息,只对2层口有效。
trunk:
可选,查看接口的Trunk信息。
说明:
如果未指定参数,则显示所有接口信息。
配置举例:
查看交换机的fastethernet0/1口的信息。
Switch>enable
Switch#showinterfacesfO/1
Interface:
FastEthemetO/1Description:
to-PC1AdminStatus:
up
OperStatus:
downMedium-type:
fiberHardware:
GBIC
Mtu:
1500
LastChange:
0d:
0h:
0m:
0sAdminDuplex:
Auto
OperDuplex:
UnknownAdminSpeed:
Auto
OperSpeed:
UnknownFlowControlAdminStatus:
AutoFlowControlOperStatus:
OffPriority:
Auto
单个接口的配置
作者:
风林
来源:
风林的家
交换机的接口默认是Access接口,此时它只能转发来自同一个VLAN勺帧,如果需要让它能够转发不同VLAN勺帧,需要设置为Trunk接口。
通常我们需要把交换机和交换机、交换机和路由器连接的接口设置为Trunk接口。
1、把接口配置为Trunk接口:
Switch(config)#interfaceport-id
Switch(config-if)#switchportmodetrunk
interface命令用于指定要修改的接口,这个接口只能是物理接口。
switchportmodetrunk命令用于把该接口设置为TrunkPort。
2、恢复Trunk接口为Access接口:
Switch(config)#interfaceport-id
Switch(config-if)#switchportmodeaccess
说明:
也可以使用noswitchportmode命令把接口模式恢复为默认值,而默认值就是AccessPort。
配置举例:
配置交换机的FastEthernetO/1为Trunk接口。
Switch>enable
Switch#configureterminal
Switch(config)#interfacefO/1
Switch(config-if)#switchportmodetrunk
Switch(config-if)#end
Switch#
2、把一个Routed接口还原为Access接口:
Switch(config)#interfaceport-id
Switch(config-if)#switchport
配置举例:
把FastEthernetO/l配置为3层RoutedPort,并设置IP地址。
Switch>enable
Switch#configureterminal
Switch(config)#interfacefO/1
Switch(config-if)#noswitchport
Switch(config-if)#ipaddress192.168.2.1255.255.255.0
Switch(config-if)#end
Switch#