2009_3560交换机自学命令
作者:红盟过客CCIE理论RHCE
QQ:369136929
msn:ccieyc@https://www.360docs.net/doc/0e14440536.html,
籍贯:湖北宜昌。有宜昌的朋友可以一起聊聊技术。
杭州杭州CCIE联盟群40576311
时间:2008年七月
地点:浙江杭州
软件:Visio2007CorelDRAW12WPS2005
说明:一般情况下三台路由器。模拟器为原版的Dynamips i
顺序:R1的F0/0接R2的F0/0,R2的F1/1接R3的F1/1。在这里用lookback接口来模拟不同网段。路由器都为最小配置cisco2501.IOS是12.0以上。提醒一下:现在可以用Dynamips软件完全模拟所有的实验。为了使实验更有价值,所写实验均在真实路由器上完成。
说明:设备为思科3560交换机。版本为Version12.2(40)SE C3560-ADVIPSERVICESK9-M
第一版前言
这份实验笔记是自己很早以前在学习3560交换机写的笔记。
里面的一些配置很简单,但是很实用,在考ccie时,对3560交换机的要求是精通,在实际工作中更是要求对35交换达到非常精通的要求。35是思科中端交换机的基础,如果35不能很好的掌握,那么后面的45,65,也就很难搞精通。这些实验配置很简单,但是命令需要花大量时间在上面。所有的命令在3560上测试通过。适合3560等中型交换机。
说明一下自己对交换机的理解,工作中常常遇到的是4565交换机。其实当上到45及以上的时候,交换机的作用与路由器就没有多大的区别,像45有自己的处理器,自己的板卡。能在上面配置动态路由协议.在45上面除了不能配置isis以外,基本上能运行所有的路由协议。当然了,其实只要把最底端的三层35学好,所以的命令都是通用的,只不过在65上面是比较复杂的是一些模块,只是65将所有的功能综合起来,所以显示的比较复杂。
对于交换机的命令,我想说的是,一定要精通,只要有设备,一定要反复的学习命令,只有这样,就算你没有做过工程,你也不会感觉到心虚。交换机常用的命令也不是很多了,所以把常用命令透彻理解应当不是很大的问题。
当交换机加电启动之后,它会自动实行POST程序来确认交换机运转正常.当交换机开始POST检测的时候,端口的LED变绿,而系统LED闪烁绿光,RPS LED熄灭;接下来最前两个
端口LED熄灭.当POST检测完成后,端口LED恢复到它所显示的模式的状态,系统LED变绿.如果POST检测失败,那么系统LED和相关的端口变为暗黄.
这份实验中如果有错误与不当之处,希望朋友指出。
当然,如果有朋友有兴趣加入一些交换的更高级的东东,大家可以联系,一起写一些交换的实验,让更多喜欢思科交换的朋友学习。
2008年于杭州
已完工的作品
《2009mpls vpn自学命令配置排错》第一版《20093560交换机自学命令与配置》第一版《2008vpn自学命令与配置》第一版
《2008ospf命令与配置手册实验笔记》第二版《2008bgp命令与配置手册实验笔记》第二版《2009ISIS命令与配置手册实验笔记》第一版《2008三层交换与路由综合配置案例》《RHCE5.0实验手册》
《华为3600交换机实验笔记》
《BGP设计与实现笔记》
《JUNIPER NETSCREEN防火墙基础实验》《杭州某中学断网解决办法》
设置主机名
Switch(config)#ho s3560
设置密码
s3560(config)#en pass cisco
s3560(config)#en sec cisco
配置用户名与密码
s3560(config)#username cisco pass cisco
设置交换机命令历史数量
s3560#terminal history size20
设置线路历史命令数量
s3560(config)#line c0
s3560(config-line)#history size20
s3560(config-line)#end
显示所有活动会话
s3560#sh sessions
设置当前会话的屏幕大小
s3560#terminal length100
s3560#terminal width100
设置所有的会话屏幕大小
s3560(config)#line c0
s3560(config-line)#length100
s3560(config-line)#width100
s3560(config-line)#end
设置超时时间为0
s3560(config)#line c0
s3560(config-line)#no exec-ti
s3560(config-line)#line vty04
s3560(config-line)#no exec-t
s3560(config-line)#end
全局关闭查询命令
s3560(config)#no ip domain-lo
设置时间
s3560#clock set13:57:1026february2008
设置dns服务器地址
s3560(config)#ip name-server192.168.1.1
设置解析的主机名与地址
s3560(config)#ip host r2192.168.1.2
设置只充许192.168.1.0网段访问
s3560(config)#access-list1per192.168.1.00.0.0.255 s3560(config)#line vty04
s3560(config-line)#access-class1in
s3560(config-line)#end
只充许本主主机用户名与密码为cisco的主机访问http s3560(config)#int vlan1
s3560(config-if)#ip add192.168.1.110255.255.255.0 s3560(config-if)#access-li2per192.168.1.00.0.0.255 s3560(config)#ip http ser
s3560(config)#ip http port3333
s3560(config)#ip http access-cla2
s3560(config)#ip http authen local
s3560(config)#user cisco pass cisco
s3560(config)#end
Ssh配置
s3560(config)#user cisco pass cisco
s3560(config)#line vty04
s3560(config-line)#login local
s3560(config-line)#transport input telnet
s3560(config-line)#end
设置管理vlan地址
s3560(config)#int vlan1
s3560(config-if)#ip add192.168.1.110255.255.255.0
设置默认网关
s3560(config)#ip default-gateway192.168.1.1
配置实例网关与管理地址。
s3560(config)#int vlan1
s3560(config-if)#ip add192.168.1.2
s3560(config-if)#ip
s3560(config)#ip name-ser
s3560(config)#no ip http ser
s3560(config)#end
恢复交换机2900/3500xl29503550交换机密码
1连接到交换机,并拔出电源
2按住mode,然后接上电源,在led灯亮二秒后放开mode灯。
3在提示命令下键入命令flash_init
4键入命令load-helper
5dir flash:列示清单
6用命令先保存配置
rename将文件名改为
7命令boot引导过程
8对setup模式按n
9按enter进到用户模式,使用enable
10用命令copy flash:config.text system:running-config把配置文件复制
到内存中
11用config ter进到配置模式
12设置密码重启。
实例
s3560##
Base ethernet MAC Address:00:1e:4a:0a:20:00
Xmodem file system is available.
The password-recovery mechanism is enabled.
The system has been interrupted prior to initializing the
flash filesystem.The following commands will initialize
the flash filesystem,and finish loading the operating
system software:
flash_init
load_helper
boot
s3560:
s3560:flash_init
Initializing Flash...
s3560:flash_init
Initializing Flash...
flashfs[0]:6files,1directories
flashfs[0]:0orphaned files,0orphaned directories
flashfs[0]:Total bytes:32514048
flashfs[0]:Bytes used:16745984
flashfs[0]:Bytes available:15768064
flashfs[0]:flashfs fsck took13seconds.
...done Initializing Flash.
Boot Sector Filesystem(bs)installed,fsid:3
Setting console baud rate to9600...
s3560:load_helper
s3560:boot
Loading"flash:c3560-advipservicesk9-mz.122-40.SE.bin"...@@@
删除所有的配置文件
s3560#sh flash:
Directory of flash:/
2-rwx9860621Mar1199300:18:13+00:00c3560-advipservicesk9-mz.122-40.SE.bin
3-rwx6875865Mar1199300:20:43+00:00c3560-ipbase-mz.122-35.SE5.bin
4-rwx24Mar1199300:11:01+00:00private-config.text
6-rwx1048Mar1199300:11:01+00:00multiple-fs
7-rwx616Mar1199300:10:30+00:00vlan.dat
8-rwx1422Mar1199300:11:01+00:00config.text
32514048bytes total(15771136bytes free)
s3560#del config.text
Delete filename[config.text]?config.text
Delete flash:config.text?[confirm]
s3560#del vlan.dat
Delete filename[vlan.dat]?vlan.dat
Delete flash:vlan.dat?[confirm]
s3560#rel
Proceed with reload?[confirm]
查看硬件结构
s3560##sh hardware
访问模块
s3560###session slot
s3560##session mod
模块断电
s3560#(config)#no power enable module slot
模块加电
s3560#(config)#power enable module slot
查看系统文件
s3560##sh file systems
查看mac地址
s3560#sh lacp sys-id
32768,001e.4a0a.2000
显示acl的设置
ra#sh mac access-group
查看当前路径
s3560#pwd
flash:
查看flash信息
s3560#show file information flash:?
flash:c3560-advipservicesk9-mz.122-40.SE.bin
flash:c3560-ipbase-mz.122-35.SE5.bin flash:config.text
flash:multiple-fs flash:private-
config.text flash:y
将配置文件考贝到引导文件
s3560#copy run startup-config
Destination filename[startup-config]?
Building configuration...
[OK]
从另外一个ios启动
s3560#sh flash
Directory of flash:/
2-rwx9860621Mar1199300:18:13+00:00c3560-
advipservicesk9-mz.122-40.SE.bin
3-rwx6875865Mar1199300:20:43+00:00c3560-ipbase-
mz.122-35.SE5.bin
4-rwx1313Mar1199300:25:51+00:00config.text
5-rwx24Mar1199300:25:51+00:00private-
config.text
6-rwx3167Mar1199300:00:52+00:00y
7-rwx1048Mar1199300:37:10+00:00multiple-fs
s3560(config)#boot system c3560-ipbase-mz.122-35.SE5.bin
s3560(config)#end
s3560#rel
查看系统启动文件
s3560#sh boot
BOOT path-list:c3560-ipbase-mz.122-35.SE5.bin
Config file:flash:/config.text
Private Config file:flash:/private-config.text
Enable Break:no
Manual Boot:no
HELPER path-list:
Auto upgrade:yes
Auto upgrade path:
设置ntp系统时钟
s3560(config)#ntp peer192.168.1.2ver3key2source f0/10prefer
ntp peer ip address设置服务器地址
ver设置ntp版本默认为3从1到3
key标明验证密码
source指定源地址
prefer强制提供时钟同步
设置接收客户端时间
s3560(config)#ntp broadcastdelay3000
启用ntp验证
s3560(config)#ntp authenticate
创建md5验证密码
s3560(config)#ntp authentication-key2md5cisco
将验证应用到ntp
s3560(config)#ntp trusted-key2
cdp配置
全局启用cdp
s3560(config)#cdp run
设置cdp更新时间
s3560(config)#cdp timer10
设置cdp保持时间
s3560(config)#cdp holdtime30
设置cdp版本
s3560(config)#cdp advertise-v2
关闭cdp
全局关闭cdp
s3560(config)#no cdp run
接口关闭cdp
s3560(config)#int f0/1
s3560(config-if)#no cdp run
全局查看cdp
s3560#sh cdp neighbors
接口查看cdp
s3560#sh cdp int f0/1
FastEthernet0/1is down,line protocol is down
Encapsulation ARPA
Sending CDP packets every10seconds
Holdtime is30seconds
访问mspf与rsfc
注意,在1槽里的msfc是152槽是16
复位模块
shutdown no shutdown可以用来复位端口
实验
设置两个验证,密码source1key来验证172.17.76.247,另外一个source2key来验证172.31.31.1
s3560(config)#ntp authenticate
s3560(config)#ntp authentication-key1md5sourceA
s3560(config)#ntp authentication-key2md5sourceB
s3560(config)#ntp trusted-key1
s3560(config)#ntp trusted-key2
s3560(config)#ntp peer172.17.76.247key1
s3560(config)#ntp peer172.31.31.1key2
二层etherchanel
s3560(config)#int f0/1
s3560(config-if)#channel-group1mode?
active Enable LACP unconditionally
auto Enable PAgP only if a PAgP device is detected desirable Enable PAgP unconditionally
on Enable Etherchannel only
passive Enable LACP only if a LACP device is detected on使用二层组但是不发送pagp分组
desirable主动形成一个组,并发送pagp分组
auto交换机被动形成一个组,默认配置
active主动形成一个lacp组,并发lacp分组
passive被动形成一个分组只有在接收到lacp分组时才形成
non-silent要求在形成组之间先进行pagp的协商。
s3560(config-if)#channel-group1mode auto non-silent Creating a port-channel interface Port-channel1
配置二层信道
s3560(config)#int f0/4
s3560(config-if)#channel-group1mode on
Creating a port-channel interface Port-channel1
实例
s3560(config)#int f0/3
s3560(config-if)#channel-group1mode on
s3560(config)#int f0/4
s3560(config-if)#channel-group2mode auto
Creating a port-channel interface Port-channel2
s3560(config-if)#int f0/5
Creating a port-channel interface Port-channel3
s3560(config-if)#int f0/6
s3560(config-if)#channel-group4mode active
Creating a port-channel interface Port-channel4
s3560(config-if)#int f0/7
s3560(config-if)#channel-group5mode desirable
s3560(config)#port-channel load-balance src-dst-ip
查看二层组
s3560#sh etherchannel
查看二号组
s3560#sh etherchannel2detail
s3560#sh etherchannel detail
查看端口
s3560#sh etherchannel port
s3560#sh etherchannel port-channel
查看组协议
s3560#sh etherchannel protocol
查看组的摘要
s3560#sh etherchannel summary
配置三层接口
三层组
etherchannel将多个特理接口聚合成一个特理接口,其中一个端口叫端口通道。如果其中一个端口出错,端口组能够通过其它的链路通行。3560能创建48个
创建三层组
s3560(config)#interface port-channel2
配置三层组的地址
s3560(config-if)#no swi
s3560(config-if)#ip add192.168.2.2255.255.255.0
选择分配三层组的接口
s3560(config-if)#int f0/3
将接口分配给三层组
s3560(config-if)#channel-group1mode on
删除分配到三层组接口地址
s3560(config-if)#no ip add
实例
s3560(config)#int f0/4
s3560(config-if)#no sh
s3560(config-if)#no ip add
s3560(config-if)#no swi
s3560(config-if)#channel-group2mode on
Command rejected(Port-channel2,Fa0/4):Either port is L2and port-channel is L3, or vice
s3560(config)#interface port-channel1
s3560(config-if)#no sh
s3560(config-if)#no swi
s3560(config-if)#ip add192.168.2.1255.255.255.0
s3560(config-if)#end
设备要执行三层,必要有三层处理器,三层是基于协议寻址
RSM路由交换模块
RSFC路由交换物性卡
MSM多层交换模块
MSFC多层交换特性卡
三层服务模块,或是交换机里集成硬件.
启用路由功能
s3560(config)#ip routing
第三层ethernet接口
每个第三层接口都定义一个广播区域,因些每个接口都定义一个独立的网络。主要作用是,可以将三层接口作为一个网络的网关。
起用三层接口,35系列默认为交换端口,45,65默认为路由模式
配置三层接口
s3560(config)#int f0/3
s3560(config-if)#no switchport
设置地址,做为一个网络的网关
s3560(config-if)#ip add192.168.2.2255.255.255.0
s3560(config-if)#end
实例3560接2950做网关
s3560(config)#int g0/1
s3560(config-if)#no switchport
s3560(config-if)#ip add192.168.10.1255.255.255.0
s3560(config-if)#no sh
s3560(config-if)#end
设置根路径成本
s3560(config)#int f0/2
s3560(config-if)#spanning-tree vlan2cost100
设置端口优先级
s3560(config)#int f0/2
s3560(config-if)#spanning-tree port-priority16
s3560(config-if)#end
在接口下启用快速接口
s3560(config)#int f0/2
s3560(config-if)#spanning-tree portfast
%Warning:portfast should only be enabled on ports connected to a single
host.Connecting hubs,concentrators,switches,bridges,etc...to this
interface when portfast is enabled,can cause temporary bridging loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/2but will only
have effect when the interface is in a non-trunking mode.
s3560(config-if)#end
修改log缓存大小。
s3560(config)#logging buffered5000
查看日志信息;
s3560#sh buffers
s3560#sh log
清除日志
s3560#cle log
Clear logging buffer[confirm]
设置交换机的端口速度
s3560(config)#int f0/1
s3560(config-if)#speed100
s3560(config-if)#int f0/1
s3560(config-if)#sp auto
s3560(config-if)#sp10
s3560(config-if)#sp100
用来查看端口情况
s3560#sh ip int bri f0/1
Interface IP-Address OK?Method Status Protocol
FastEthernet0/1unassigned YES unset down
down
s3560#sh ip int f0/1
FastEthernet0/1is down,line protocol is down
Inbound access list is not set
3550交换机设置多个端口注意中间是空格
rs3560(config)#int range f0/1-5
设置描绘信息
s3560(config)#int f0/1
s3560(config-if)#description home t0
验证端口描绘
s3560#sh int f0/3des
Interface Status Protocol Description
Fa0/3down down
显示一系列端品的状态与错误
s3560#sh int f0/1status
Port Name Status Vlan Duplex Speed Type
Fa0/1home t0notconnect1full100 10/100BaseTX
s3560#sh int f0/1stat
FastEthernet0/1
Switching path Pkts In Chars In Pkts Out Chars Out
Processor0000
Route cache0000
Total0000
显示二层还是三层端口
s3560#sh int f0/2swi
Name:Fa0/2
Switchport:Disabled
显示端口可用状态
s3560#sh ip int f0/1
FastEthernet0/1is down,line protocol is down
Inbound access list is not set
显一系列端口的状态
s3560#sh int status
清除端口状态
s3560#cle counters f0/2
Clear"show interface"counters on this interface[confirm]
重设端口的硬件
s3560#cle int f0/2
创建vlan命名vlan
s3560(config)#vlan2
s3560(config-vlan)#name2
s3560(config-vlan)#exit
创建vlan命名
s3560#vlan da
%Warning:It is recommended to configure VLAN from config mode,
as VLAN database mode is being deprecated.Please consult user documentation for configuring VTP/VLAN in config mode.
s3560(vlan)#vlan2name3
VLAN2modified:
Name:3
验证vlan
s3560#sh vlan
查看vlan id所用情况
s3560#sh vlan int usage
充许通过的vlan过滤vlan
s3560(config)#int f0/1
s3560(config-if)#switchport trunk all vlan2,3,4
s3560(config-if)#end
switchport trunk allowed vlan{add|all|execept|remove}vlan-list
s3560(config)#int f0/1
s3560(config-if)#switchport trunk all vlan4-5
s3560(config-if)#end
验证vlan
s3560#sh vlan name3
s3560#sh vlan id3
s3560#sh vlan b
注意:当删除一个处于vtp服务器的交换机上的vlan时,则此vlan年在的所有相同的vtp 交换机删除当在透明下,则只删除当前的vlan消息。当删除一个vlan时,则端口是非激活状态,只到一个新的vlan分配置
删除一个vlan
s3560#conf t
Enter configuration commands,one per line.End with CNTL/Z.
s3560(config)#no vlan3
s3560(config)#end
设置vlan优先级
s3560(config)#spanning-tree vlan2priority?
%Bridge Priority must be in increments of4096.
%Allowed values are:
0409681921228816384204802457628672 3276836864409604505649152532485734461440
s3560(config)#spanning-tree vlan2priority0
定义端口
s3560(config)#int f0/3
s3560(config-if)#swi mode acc
s3560(config-if)#end
将端口分到特定的vlan
s3560(config)#int f0/5
s3560(config-if)#swi acc vlan2
s3560(config-if)#end
定封装方式
s3560(config)#int f0/2
s3560(config-if)#swi trunk en?
dot1q Interface uses only802.1q trunking encapsulation when trunking
isl Interface uses only ISL trunking encapsulation when trunking
negotiate Device will negotiate trunking encapsulation with peer on
interface
s3560(config-if)#swi trunk en isl
s3560(config-if)#swi trunk en dot1q
s3560(config-if)#swi trunk en negotiate
指定8021q的native vlan号
s3560(config)#int f0/3
s3560(config-if)#switchport trunk en dot
s3560(config-if)#swi trunk native vlan2
s3560(config-if)#end
trunk技术
trunk的意思是在单个链路上复用多个链路。
trunk默认情况是是充许所有的vlan通过。trunk通承载所有的流量,所以要区分不同的vlan流量,就要用到打标记,这个标记就是isl或是802.1Q.如果启用,交换机两边都要使用同一种协议。
DTp:思科交换机使用一DTP的自动trunking机制,DTP动态链路聚集协。主要是用来自动
的配置trunk链路。
被动接到消息,并在具备的链路上形成trunk.
定义trunk
s3560(config)#int f0/1
s3560(config-if)#swi trunk en dot
s3560(config-if)#swi mode trunk
s3560(config-if)#end
封装802.1q的trunk端口可以接受带有标签和不带标签的数据流。交换机向native vlan 传送不带票签的数据流。默认情况下native vlan1
配置native vlan号
r1(config-if)#swi trunk native vlan2
使用负载可以使用流量分流到其它的平行的trunk上增。交换机了为了避免环路,stp通常是阻断所有的端口交换机这间只有一个路。使用负载后,可以把不同的vlan流量分到不的的trunk上去。可以通过配置stp端口权值stp路径值来实现负载。如果使用stp端口权值来配置那么二条负载的trunk必联现一台交换机。使用路径值可以联相同的换机机与不不同的交换机
s3560(config-if)#swi mode dynamic auto
主动建立trunk并发送消息。
s3560(config-if)#swi mode dynamic desirable
指定trunk注意,对于35交换机,先指定封装方式,然后指定trunk.
s3560(config)#int f0/23
s3560(config-if)#switchport mode trunk
指定封装方式isl是思科自有有协议,802.1Q是公有协议,其它交换机都支持。2900xl3500xl 默认情况是isl.如果要用公
有,必用switchport trunk encapsulation dot1q改变。2950与4000等只支持802.1Q。
s3560(config)#int f0/22
s3560(config-if)#switchport trunk?
allowed Set allowed VLAN characteristics when interface is in trunking mode
encapsulation Set trunking encapsulation when interface is in trunking mode native Set trunking native characteristics when interface is in
trunking mode
pruning Set pruning VLAN characteristics when interface is in trunking
mode
指定协议为公有
s3560(config-if)#switchport trunk encapsulation dot1q
指定为思科专用。
s3560(config-if)#switchport trunk encapsulation isl
negotiate主要用在两边交换机的trunk配置为auto与desirable上面。自动协商。
s3560(config-if)#switchporttrunk encapsulation negotiate
指定native vlan。802.1q两边的native vlan一定要匹配,不然链路不能正常工作。
对VLAN进行封装有两种协议.一种是思科专有的协议,叫做ISL.另一种是RFC公有的协议叫做802.1Q.两种协议都是针对TRUNK承载不同VLAN为防止混乱而产生的.默认情况下.交换机上所有的接口都位于VLAN1下.也就是NATIVE VLAN.事实上,本地VLAN中不仅仅有着接口,还有STP信息,比如BPDU桥接协议数据单元,VLAN ID的信息等等都要通过native vlan来传输.ISL协议和802.1Q的区别在于针对native vlan是否打标.ISL是全部都打,有几个VLAN打几个标记,而802.1Q协议除了VLAN1也就是native vlan不打标记之外其他的VLAN都打标记,作用都是一样的,都能让TRUNK识别不同的VLAN.那为什么不对VLAN1打标记呢.就是因为VLAN1中承载着许多信息.对native vlan标记是相当不利的
s3560(config)#int f0/21
s3560(config-if)#switchport trunk native vlan2
指定trunk中的vlan.默认情况下,trunk将充许所有的vlan通过。可以指定只充许通过的vlan号。
s3560(config)#int f0/19
s3560(config-if)#no sh
s3560(config-if)#swi trunk en isl
s3560(config-if)#swi mode trunk
s3560(config-if)#swi trunk allowed vlan remove2允许除vlan2以外的所有的vlan.
删除vlan.Dat
s3560#del vlan.dat
Delete filename[vlan.dat]?vlan.dat
Delete flash:vlan.dat?[confirm]
显示trunk信息
s3560#sh int trunk
验证配置
s3560#sh int f0/1
s3560#sh ip int f0/1
s3560#sh run int f0/1
查看trunk数量
s3560#sh interfaces counters trunk
保存
s3560#copy run start
vtp
vtp用来管理vlan的,是思科专用的协议,vtp有三种模式。服务器,透明,与客户机模式。
设置vtp区域
s3560(config)#vtp domain cisco
Changing VTP domain name from NULL to cisco
设置vtp模式服务器
s3560(config)#vtp mode ser
Device mode already VTP SERVER.
设置成透明模式
s3560(config)#vtp mode transparent
Setting device to VTP TRANSPARENT mode.
设置成客户机模式
s3560(config)#vtp mode client
Setting device to VTP CLIENT mode.
设置区域密码
s3560(config)#vtp password cisco
Setting device VLAN database password to cisco
取消密码
s3560(config)#no vtp pass
Clearing device VLAN database password.
启用vtp裁剪功能,将不用的vlan消息去除。
s3560(config)#vtp pruning
Pruning s3560ed on
基于端口的有选择性的消除裁剪。
s3560(config)#int f0/4
s3560(config-if)#switchporttrunk pruning vlan remove3
在f0/4中除了vlan3以外都可以裁剪。
改变vtp版本,默认情况下都是在版本1中,但是多数交换机支持版本2.版本2支持以下几
思科交换机-常用命令及配置
思科交换机-常用命令及配置 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> (2)特权模式Switch>enable Switch# (3)特权模式退回到用户模式:disable (4)下一级模式退回到上一级:exit (5)某个模式直接退回到特权模式:end (6)配置交换机名称命令hostname <交换机> (7)进入交换机端口模式命令 模式:switch(config)# 命令:interface <端口类型> <端口号> 交换机常见的端口类型:ethernet、fastethernet、gigabitethernet以及VLAN 接口等。端口号一般采用插槽号/端口号,如0/1。 (8)进入交换机的某个端口模式switch(config-if)# 显示交换机端口状态命令switch# show interface <端口类型> <端口号> (9)进入控制台线路模式模式:switch(config)# 命令:line console <编号> 参数:编号是配置口的编号,从0开始编号。结果:进入控制台模式 switch(config-line)#。 (10)配置控制台口令模式:switch(config-line)# 命令:password <密码> 参数:密码支持字母和数字。 启用密码认证模式:switch(config-line)# 命令:login (11)配置进入特权模式口令模式:switch(config)# 命令:enable password|secret <密码> 参数:password表示密码以明文形式存放,secret表示密码以密文形式存放。密码支持字母和数字。 (12)为之前设置的口令加密模式:switch(config)# 命令:service password-encryption 结果:将之前设置的所有口令加密。 (13)配置交换机的登录标语模式:switch(config)# 命令:banner motd %<标语>%参数:标语应该是警示性的文字,不识别中文。结果:下次进入某个需要输入密码的模式时将会显示该提示。 (14)禁止干扰信息模式:控制台模式命令:logging synchronous 结果:下次弹出日志信息时会强制回车。 2、交换机系统帮助命令 (1)显示系统信息命令Switch> show version (2)显示交换机当前配置命令show running-config (3)显示交换机已保存的配置命令show startup-config (4)保存现有配置命令copy running-configu startup-config (5)清除已保存的配置erase startup-config (6)了解在某模式下有哪些命令时,可以输入“?” (7)某个命令只记得一部分时,可以在记得的部分后输入“?”(无空格)(8)清楚某单词后可输入的命令时,可在此单词后输入“? ”(中间有空格)。(9)将命令补充完整。输入能唯一识别某个命令关键字的一部分后,可以按键盘上的TAB键可以将该关键字补充完整。
锐捷交换机常用配置基础命令
一、交换机基本配置 1、交换机命名: 在项目实施的时候,建议为处于不同位置的交换机命名,便于记忆,可提高后期管理效率。 switch(config)#hostname ruijie //ruijie为该交换机的名字 2、交换机配置管理密码: 配置密码可以提高交换机的安全性,另外,telnet登录交换机的时候,必须要求有telnet管理密码。 switch (config)#enable secret level 1 0 rg //配置telnet管理密码为rg,其中1表示telnet密码,0表示密码不加密 switch (config)#enable secret level 15 0 rg //配置特权模式下的管理密码rg,其中15表示为特权密码3、交换机配置管理IP switch (config)#interface vlan 1 //假设管理VLAN为VLAN 1 switch (config-if)#ip address 192.168.1.1 255.255.255.0 //给管理VLAN配置管理IP地址 switch (config-if)#no shutdown //激活管理IP,养成习惯,无论配置什么设备,都使用一下这个命令 4、交换机配置网关: switch(config)#ip default-gateway 192.168.1.254 //假设网关地址为192.168.1.254,此命令用户二层设备。通过以上几个命令的配置,设备便可以实现远程管理,在项目实施时(尤其是设备位置比较分散)特别能提高效率。 二、接口介质类型配置 锐捷为了降低SME客户的总体拥有成本,推出灵活选择的端口形式:电口和光口复用接口,方便用户根据网络环境选择对应的介质类型。 但光口和电口同时只能用其一,如图1,如使用了光口1F,则电口1不能使用。 1、接口介质类型的转换: Switch(config)#interface gigabitethernet 0/25-28
H3C自学笔记及常用命令
H3C自学笔记 进入管理模式
192.168.1.253 24 Web界面配置:(默认开启web界面,关闭 undo ip http enable 开启 ip http enable) [H3C]local-user admin 创建本地用户admin [H3C-]password simple password123 密码设置为明文密码:password123 [H3C-]service-type telnet level 3 配置本地用户的服务类型为telnet且命令级别为3级 [H3C-]quit [H3C]user-interface vty 0 4 进入vty0 4用户界面视图 [H3C-]authentication-mode scheme VTY用户界面登陆交换机的用户进行scheme认证 [H3C-]quit
思科交换机命令大全
思科交换机常用命令大全 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
实验二 交换机配置方式及基本命令的熟悉
实验二交换机的配置方式及基本命令的熟悉 【实验目的】 通过对交换机设备的几种配置手段、配置模式和基本配置命令的认识,获得交换机的基本使用能力。 【实验任务】 1、认识交换机的的配置方式; 2、按照给出的参考拓扑图构建逻辑拓扑图; 3、按照给出的配置参数表配置各个设备; 4、练习交换机的一些基本命令。 【实验背景】 在前面的实验中我们已经接触了Cisco的路由器运行的Cisco互联网络操作系统(ISO,Internetwork Operating System),熟悉了Cisco ISO软件内置的命令行界面(CLI,command-line interface )。同样,交换机可以通过一个菜单驱动程序的界面,或者通过命令行界面〔CLI〕,或者在交换机配置了IP地址后通过Telnet远程登录、web登录的方式对交换机来进行配置。 交换机除了可以通过Console端口与计算机直接连接外还可以通过交换机的普通端口进行连接。如果是堆叠型的,也可以把几台交换机一起进行配置,因为实际上这个时候它们是一个整体,这时通过普通端口对交换机进行管理时,就不再使用超级终端了,而是以Telnet 虚拟终端或Web浏览器的方式实现与被管理交换机的通信。前提是在本地配置方式中已为交换机配置好了IP地址,我们可通过IP地址与交换机进行通信,不过要注意,只有是网管型的交换机才具有这种管理功能。实际上最常用的Catalyst交换机OS被称为Catalyst OS、Catos,其最大的特点是基于set命令。但我们常用的是与路由器的IOS相类似的基于IOS的Catalyst OS。下面简单介绍交换机的各种命今模式以及各种常用的命令。 表3.1 交换机的各种命令模式的访问方式、提示符、退出方法及其描述
华为交换机基本配置命令29908
华为交换机基本配置命令 一、单交换机VLAN划分 命令命令解释 system 进入系统视图 system-view 进入系统视图 quit 退到系统视图 undo vlan 20 删除vlan 20 sysname 交换机命名 disp vlan 显示vlan vlan 20 创建vlan(也可进入vlan 20) port e1/0/1toe1/0/5 把端口1-5放入VLAN 20 中 5700系列 单个端口放入VLAN [Huawei]intg0/0/1 [Huawei]port link-typeaccess(注:接口类型access,hybrid、trunk) [Huawei]port default vlan 10 批量端口放入VLAN [Huawei]port-group 1 [Huawei-port-group-1]group-member ethernet G0/0/1 to ethernet G0/0/20 [Huawei-port-group-1]port hybrid untagged vlan 3 删除group(组)vlan 200内的15端口 [Huawei]intg0/0/15 [Huawei-GigabitEthernet0/0/15]undo port hybrid untagged vlan 200 通过group端口限速设置 [Huawei]Port-group 2 [Huawei]group-member g0/0/2 to g0/0/23 [Huawei]qos lr outbound cir 2000 cbs 20000 disp vlan 20 显示vlan里的端口20 int e1/0/24 进入端口24 undo port e1/0/10 表示删除当前VLAN端口10 disp curr 显示当前配置 return 返回 Save 保存 info-center source DS channel 0 log state off trap state off通过关闭日志信息命令改变DS模块来实现(关闭配置后的确认信息显示) info-center source DS channel 0 log state on trap state on 通过打开日志信息命令改变DS模块来实现(打开配置后的确认信息显示)
交换机维护常用show命令
1.查看交换机的版本信息 通过show ver命令可以查看交换机具体型号、软件版本、硬件版本、交换机序列号等信息 2.查看交换机CPU利用率 通过show cpu进行查看,可以查看5分钟、1分钟、5秒钟的CPU利用率。
说明:健康状态下,“CPU utilization in five minutes”应该维持在30%以下;承载业务的压力越大,CPU会越高,也属正常现象,但超出60%时就务必引起注意 3.查看交换机内存利用率 通过show memory进行查看,可以查看总的内存大小,可用内存大小及当前内存利用率 4.查看交换机的电源信息 通过show power命令可以查看交换机的电源供电状态 5.查看交换机的风扇信息 通过show fan命令可以查看交换机的风扇是否正常
6.查看交换机的温度 通过show tem命令可以查看交换机的温度 7.查看交换机时间命令 在特权模式下使用showclock命令查看交换机的时间,如下:Ruijie#show clock ------>查看交换机的时间18:01:03 beijing Tue, Dec 3, 2013 8.查看交换机的log信息: 在特权模式下使用show log命令查看日志信息
2)通过more flash:xxx来查看保存到flash中的log信息 说明:需要用命令Ruijie(config)#logging file flash:syslog 131072来将缓存区的log保存到flash 9.查看交换机FLASH空间大小及文件 通过dir命令进行查看,可以查看主程序文件、配置文件、总FLASH空间大小及当前空闲的FLASH空间大小
思科交换机路由器命令大全
思科交换机路由器命令 大全 YUKI was compiled on the morning of December 16, 2020
1. 交换机支持的命令:交换机基本状态: 交换机口令设置: 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 ;设置登录口令 xxswitch#exit ;返回命令 交换机VLAN设置:
switch(vlan)#vlan 2 ;建VLAN 2switch(vlan)#no vlan 2 ;删vlan 2switch(config)#int f0/1 ;进入端 口1switch(config-if)#switchport access vlan 2 ; 当前端口加入vlan 2switch(config-if)#switchport mode trunk ;设置为干线switch(config- if)#switchport trunk allowed vlan 1,2 ;设置允许 的vlanswitch(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地址: 交换机显示命令:
华三华为交换机-路由器配置常用命令汇总
H3C交换机配置命令大全 1、system-view 进入系统视图模式 2、sysname 为设备命名 3、display current-configuration 当前配置情况 4、language-mode Chinese|English 中英文切换 5、interface Ethernet 1/0/1 进入以太网端口视图 6、port link-type Access|Trunk|Hybrid 设置端口访问模式 7、undo shutdown 打开以太网端口 8、shutdown 关闭以太网端口 9、quit 退出当前视图模式 10、vlan 10 创建VLAN 10并进入VLAN 10的视图模式 11、port access vlan 10 在端口模式下将当前端口加入到vlan 10中 12、port E1/0/2 to E1/0/5 在VLAN模式下将指定端口加入到当前vlan中 13、port trunk permit vlan all 允许所有的vlan通过 H3C路由器配置命令大全 1、system-view 进入系统视图模式 2、sysname R1 为设备命名为R1 3、display ip routing-table 显示当前路由表 4、language-mode Chinese|English 中英文切换 5、interface Ethernet 0/0 进入以太网端口视图 6、ip address 192.168.1.1 255.255.255.0 配置IP地址和子网掩码 7、undo shutdown 打开以太网端口 8、shutdown 关闭以太网端口
S5130系列交换机三层IP路由命令参考
H3C S5130-HI 系列以太网交换机 三层技术-IP 路由命令参考
前言 H3C S5130-HI 系列以太网交换机命令参考主要针对S5130-HI 系列交换机Release 1111 软件版本支持的命令进行了介绍。《三层技术-IP 路由命令参考》主要介绍各路由协议命令,包括IPv4、IPv6 网络的各种路由命令,以及影响路由选择或者路由表生成策略的命令。 前言部分包含如下内容: ?读者对象 ?本书约定 ?产品配套资料 ?资料获取方式 ?技术支持 ?资料意见反馈 读者对象 本手册主要适用于如下工程师: ?网络规划人员 ?现场技术支持与维护人员 ?负责网络配置和维护的网络管理员 本书约定 1. 命令行格式约定
2. 图形界面格式约定 3. 各类标志 本书还采用各种醒目标志来表示在操作过程中应该特别注意的地方,这些标志的意义如下: 4. 图标约定 本书使用的图标及其含义如下:
5. 端口编号示例约定 本手册中出现的端口编号仅作示例,并不代表设备上实际具有此编号的端口,实际使用中请以设备上存在的端口编号为准。 产品配套资料 H3C S5130-HI 系列以太网交换机的配套资料包括如下部分:
目录 1 IP路由基础·····································1-1 1.1 IP路由基础配置命令·································1-1 1.1.1 address-family ipv4 ····························································································1-1 1.1.2 address-family ipv6 ····························································································1-1 1.1.3 display ecmp mode ····························································································1-2 1.1.4 display ip routing-table ························································································1-2 1.1.5 display ip routing-table acl ···················································································1-5 1.1.6 display ip routing-table ip-address ·········································································1-8 1.1.7 display ip routing-table prefix-list ········································································· 1-10 1.1.8 display ip routing-table protocol ··········································································· 1-11 1.1.9 display ip routing-table statistics ·········································································· 1-13 1.1.10 display ipv6 rib attribute ··················································································· 1-14 1.1.11 display ipv6 rib graceful-restart ·········································································· 1-15 1.1.12 display ipv6 rib nib ·························································································· 1-15 1.1.13 display ipv6 route-direct nib ·············································································· 1-17 1.1.14 display ipv6 routing-table ················································································· 1-19 1.1.15 display ipv6 routing-table acl ············································································· 1-23 1.1.16 display ipv6 routing-table ipv6-address ·······························································1-24 1.1.17 display ipv6 routing-table prefix-list ···································································· 1-26 1.1.18 display ipv6 routing-table protocol ······································································ 1-28 1.1.19 display ipv6 routing-table statistics ····································································· 1-29 1.1.20 display max-ecmp-num ··················································································· 1-30 1.1.21 display rib attribute ························································································· 1-31 1.1.22 display rib graceful-restart ················································································ 1-32 1.1.23 display rib nib ································································································ 1-34 1.1.24 display switch-routing-mode status ···································································· 1-38 1.1.25 display route-direct nib ···················································································· 1-38 1.1.26 ecmp mode enhanced ····················································································· 1-41 1.1.27 fib lifetime ····································································································· 1-41 1.1.28 max-ecmp-num ····························································································· 1-42 1.1.29 protocol lifetime ····························································································· 1-42 1.1.30 reset ip routing-table statistics protocol ······························································· 1-43 1.1.31 reset ipv6 routing-table statistics protocol ···························································· 1-44 i
交换机配置和设备常用命令
常用命令等 1、连接交换机并设置软件连接交换机/路由器等: 如果设备管理器里边没有端口选项则说明USB-COM驱动未安装好;到这里记录下COM口的端口号,我这里是COM4。 打开securecrt软件:打开crt解压到的目录点软件启动
在弹出的窗口中点击下图中的按钮 按照下图中选择选项:
选择完成后点击确定按钮后敲击回车,如窗口中显示XXXXX>则说明设备连接成功。 2、配置5750交换机步骤 A、第一步删除5750交换机现有配置,复制下边命令并粘贴到crt命令行内: en ruijie delete config.text y reload y B、重新配置5750交换机: en
conf t hos btjx-zhl-25750-2 vlan 101 exit int vlan 101 ip add 192.168.101.252 255.255.255.0 exit ip route 0.0.0.0 0.0.0.0 192.168.101.254 enable sec ruijie lin vty 0 4 pass ruijie exit rldp enable int r g0/1 – 22 sw mo acc sw acc vlan 101 rldp port loo shutdown-port exit int r g0/23 – 24 me fi sw mo tr int g0/24
des btjx-zhl-25750-1 exit err re int 1800 end wr wr 此配置是11日没有拆下来的交换机的配置: 此配置是11日拆除下来的5750交换机的配置(需要增加部分配置) 上边配置的5750交换机23口24口都是级联口5750-1-24口接86,5750-1-23连接5750-2-24口 3、2952交换机配置,修改级联口部分: en ruijie conf t int g0/49 sw mo tr int g0/51 sw mo tr
三层交换机基本配置
三层交换机基本配置 【实验名称】 三层交换机端口配置 【实验目的】 配置开启三层交换机的三层功能,实现路由作用。 【背景描述】 为了隔离广播域而划分了VLAN,但不同的VLAN之间需要通信,本实验将实现这一功能。即同一VLAN里的计算机能跨交换机通信,不同VLAN里的计算机系统也能互相通信。 【技术原理】 三层交换机是在二层交换的基础上实现了三层的路由功能。三层交换机基于“一次路由,多次交换”的特性,在局域网环境中转发性能远远高于路由器。而且三层交换机同时具备二层的功能,能和二层交换机进行很好的数据转发。三层交换机的以太网接口要比一般的路由器多很多,更加适合多个局域网段之间的互联。 三层交换机本身默认开启了路由功能,可利用IP Routing命令进行控制。 【实验设备】 S3350(一台),PC机(两台)。 【实验拓扑】
注意:先连线,在进行配置,注意连接线缆的接口编号。S3350为三层交换机。 【实验步骤】 步骤一 开启三层交换机的路由功能: Switch>enable //进程特权模式 Switch #configure terminal //进入全局模式 Switch (config)#hostname s3350-24 S3350-24 (config)#ip routing //开启三层交换机的路由功能 步骤二 配置三层交换机端口的路由功能: S3350-24>enable //进入特权模式 S3350-24#configure terminal //进入全局模式 S3350-241 (config)#interface fastethernet 0/2 //进入fa0/2端口 S3350-24 (config-if)#no switchport //开启端口的三层路由功能 S3350-24 (config-if)#ip address 192.168.5.254 255.255.255.0 //配置ip地址S3350-24 (config-if)#no shutdown //启用端口,使其转发数据
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 ;查看端口信息
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。
三层交换机基本配置
实验6(1)三层交换机基本配置 实验目标 ●理解三层交换机的基本原理; ●掌握三层交换机物理端口开启路由功能的配置方法; ● 实验背景 公司现有1台三层交换机,要求你进行测试,该交换机的三层功能是否工作正常。 技术原理 ?开启路由功能 Switch(config)#ip routing ?配置三层交换机端口的路由功能 Switch (config)#interface fastEthernet 0/5 Switch (config-if)#no switchport Switch (config-if)#ip address 192.168.1.1 255.255.255.0 Switch (config-if)#no shutdown Switch (config-if)#end 如果是三层交换机的话,可以用到no switchport此命令。 三层交换机是带有三层路由功能的交换机,也就是这台交换机的端口既有三层路由功能,也具有二层交换功能。三层交换机端口默认为二层口,如果需要启用三层功能就需要在此端口输入no switchport命令。如果是二层交换机就不会用到no switchport命令。 实验设备 交换机35601台,PC1台,直通线,配置线 PC0设置 192.168.1.2 255.255.255.0 PC0桌面上的终端 Switch>en Switch#config t Switch(config)#hostname S3550
S3550(config)#ip routing //开启路由功能 S3550(config)#interface fastEthernet 0/5 S3550(config-if)#no switchport //该端口启用三层路由功能 S3550(config-if)#ip address 192.168.5.1 255.255.255.0 //配置IP地址 S3550(config-if)#no shutdown //开启端口 S3550(config-if)#end S3550# 思考题:利用三层交换机的路由功能固定IP地址的方法实现不同vlan之间联通?