思科三层交换机配置命令
思科网络交换机配置命令详细总结归纳

使用`switchport access vlan`命令将接口 分配到指定VLAN,如`switchport access vlan 10`将接口分配到VLAN 10。
使用`switchport mode access`命令将接 口设置为访问模式。
使用`name`命令为VLAN设置名称,如 `name Sales`为VLAN 10设置名称为 Sales。
使用`interface`命令进入接口配置模式, 如`interface FastEthernet 0/1`进入 FastEthernet 0/1接口。
VLAN间路由配置
01 02 03 04
使用`interface`命令进入三层接口配置模式,如`interface vlan 10`进入 VLAN 10的三层接口。
配置Root Guard
在接入层交换机上启用Root Guard功能,防止非法设备成为网 络根节点。
STP故障排除技巧
查看STP状态
使用命令`show spanning-tree vlan vlan-id`查看指定 VLAN的STP状态,包括根交换机、根端口、指定端口等信 息。
抓包分析
使用网络抓包工具(如Wireshark)抓取并分析STP协议报 文,以深入了解STP交互过程和故障原因。
将ACL应用到三层接口或VLAN接口上,以实现对 VLAN间通信的控制。
使用`interface`命令进入接口配置模式,然后使用 `ip access-group`命令将ACL应用到接口上,如`ip access-group 101 in`将ACL 101应用到接口的入 方向。
VLAN安全性设置
01
表不稳定等问题。
链路备份
STP在消除环路的同时,保留了一条 或多条备份链路,以在网络故障时提
思科三层交换机配置实例及命令

思科三层交换机配置实例及命令 交换机的命名⼀般是WS开头这个是固定的,再下⼀个字母有两种⼀个是C⼀个是X,C代表固化交换机或者机箱,X代表的是模块。
下⾯是店铺精⼼整理的思科三层交换机配置实例及命令,仅供参考,希望能够帮助到⼤家。
三层交换机是不是经常让你机器不好使,看看下⾯的三层交换机配置⽂章,⼀切问题都能解决。
本⽂详细介绍实例讲解:全⾯的三层交换机配置⽐较全⾯的三层交换机配置实例,带命令解释哟! 三层交换机配置: Enable //进⼊私有模式 Configure terminal //进⼊全局模式 service password-encryption //对密码进⾏加密 hostname Catalyst 3550-12T1 //给三层交换机定义名称 enable password 123456. //enable密码 Enable secret 654321 //enable的加密密码(应该是乱码⽽不是654321这样) Ip subnet-zero //允许使⽤全0⼦⽹(默认都是打开的) Ip name-server 172.16.8.1 172.16.8.2 //三层交换机名字Catalyst 3550-12T1对应的IP地址是172.16.8.1 Service dhcp //提供DHCP服务 ip routing //启⽤三层交换机上的路由模块 Exit 三层交换机配置: Vtp mode server //定义VTP⼯作模式为sever模式 Vtp domain centervtp //定义VTP域的名称为centervtp Vlan 2 name vlan2 //定义vlan并给vlan取名(如果不取名的话,vlan2的名字应该是vlan002) Vlan 3 name vlan3 Vlan 4 name vlan4 Vlan 5 name vlan5 Vlan 6 name vlan6 Vlan 7 name vlan7 Vlan 8 name vlan8 Vlan 9 name vlan9 Exit 三层交换机配置: interface Port-channel 1 //进⼊虚拟的以太通道组1 switchport trunk encapsulation dot1q //给这个接⼝的trunk封装为802.1Q的帧格式 switchport mode trunk //定义这个接⼝的⼯作模式为trunk switchport trunk allowed vlan all //在这个trunk上允许所有的vlan通过 Interface gigabitethernet 0/1 //进⼊模块0上的吉⽐特以太⼝1 switchport trunk encapsulation dotlq //给这个接⼝的trunk封装为802.1Q的帧格式 switchport mode trunk //定义这个接⼝的⼯作模式为trunk switchport trunk allowed vlan all //在这个trunk上允许所有的vlan通过 channel-group 1 mode on //把这个接⼝放到快速以太通道组1中 Interface gigabitethernet 0/2 //同上 switchport trunk encapsulation dotlq switchport mode trunk switchport trunk allowed vlan all channel-group 1 mode on 三层交换机配置: port-channel load-balance src-dst-ip //定义快速以太通道组的负载均衡⽅式(依*源和⽬的IP的⽅式) interface gigabitethernet 0/3 //进⼊模块0上的.吉⽐特以太⼝3 switchport trunk encapsulation dotlq //给trunk封装为802.1Q switchport mode trunk //定义这个接⼝的⼯作模式为trunk switchport trunk allowed vlan all //允许所有vlan信息通过 interface gigabitethernet 0/4 //同上 switchport trunk encapsulation dotlq switchport mode trunk switchport trunk allowed vlan all interface gigbitethernet 0/5 //同上 switchport trunk encapsulation dotlq switchport mode trunk switchport trunk allowed vlan all interface gigbitethernet 0/6 //同上 switchport trunk encapsulation dotlq switchport mode trunk switchprot trunk allowed vlan all 三层交换机配置: interface gigbitethernet 0/7 //进⼊模块0上的吉⽐特以太⼝7 Switchport mode access //定义这个接⼝的⼯作模式为访问模式 switchport access vlan 9 //定义这个接⼝可以访问哪个vlan(实际就是分配这个接⼝到vlan) no shutdown spanning-tree vlan 6-9 cost 1000 //在⽣成树中,vlan6-9的开销定义为10000 interface range gigabitethernet 0/8 – 10 //进⼊模块0上的吉⽐特以太⼝8,9,10 switchport mode access //定义这些接⼝的⼯作模式为访问模式 switchport access vlan 8 //把这些接⼝都分配到vlan8中 no shutdown 三层交换机配置: spanning-tree portfast //在这些接⼝上使⽤portfast(使⽤portfast以后,在⽣成树的时候不参加运算,直接成为转发状态) interface gigabitethernet 0/11 //进⼊模块0上的吉⽐特以太⼝11 switchport trunk encapsulation dotlq //给这个接⼝封装为802.1Q switchport mode trunk //定义这个接⼝的⼯作模式为trunk switchport trunk allowed vlan all //允许所有vlan信息通过 interface gigabitethernet 0/12 //同上 switchport trunk encapsulation dotlq switchport mode trunk switchport trunk allowed vlan all interface vlan 1 //进⼊vlan1的逻辑接⼝(不是物理接⼝,⽤来给vlan做路由⽤) ip address 172.16.1.7 255.255.255.0 //配置IP地址和⼦⽹掩码 no shutdown 三层交换机配置: standby 1 ip 172.16.1.9 //开启了冗余热备份(HSRP),冗余热备份组1,虚拟路由器的IP地址为172.16.1.9 standby 1 priority 110 preempt //定义这个三层交换机在冗余热备份组1中的优先级为110,preempt是⽤来开启抢占模式 interface vlan 2 //同上 ip address 172.16.2.252 255.255.255.0 no shutdown standby 2 ip 172.16.2.254 standby 2 priority 110 preempt ip access-group 101 in //在⼊⽅向上使⽤扩展的访问控制列表101 interface vlan 3 //同上 ip address 172.16.3.252 255.255.255.0 no shutdown 三层交换机配置: standby 3 ip 172.16.3.254 standby 3 priority 110 preempt ip access-group 101 in interface vlan 4 //同上 ip address 172.16.4.252 255.255.255.0 no shutdown standby 4 ip 172.16.4.254 standby 4 priority 110 preempt ip access-group 101 in interface vlan 5 ip address 172.16.5.252 255.255.255.0 no shutdown standby 5 ip 172.16.5.254 standby 5 priority 110 preempt ip access-group 101 in interface vlan 6 ip address 172.16.6.252 255.255.255.0 no shutdown 三层交换机配置: standby 6 ip 172.16.6.254 standby 6 priority 100 preempt interface vlan 7 ip address 172.16.7.252 255.255.255.0 no shutdown standby 7 ip 172.16.7.254 standby 7 priority 100 preempt interface vlan 8 ip address 172.16.8.252 255.255.255.0 no shutdown standby 8 ip 172.16.8.254 standby 8 priority 100 preempt interface vlan 9 ip address 172.16.9.252 255.255.255.0 no shutdown 三层交换机配置: standby 9 ip 172.16.9.254 standby 9 priority 100 preempt access-list 101 deny ip any 172.16.7.0 0.0.0.255 //扩展的访问控制列表101 access-list 101 permit ip any any Interface vlan 1 //进⼊vlan1这个逻辑接⼝ Ip helper-address 172.16.8.1 //可以转发⼴播(helper-address的作⽤就是把⼴播转化为单播,然后发向172.16.8.1) Interface vlan 2 Ip helper-address 172.16.8.1 Interface vlan 3 ip helper-address 172.16.8.1 interface vlan 4 ip helper-address 172.16.8.1 interface vlan 5 ip helper-address 172.16.8.1 interface vlan 6 ip helper-address 172.16.8.1 interface vlan 7 ip helper-address 172.16.8.1 interface vlan 9 ip helper-address 172.16.8.1 router rip//启⽤路由协议RIP version 2//使⽤的是RIPv2,如果没有这句,则是使⽤RIPv1 network 172.16.0.0//宣告直连的⽹段 exit 三层交换机配置: ip route 0.0.0.0 0.0.0.0 172.16.9.250//缺省路由,所有在路由表中没有办法匹配的数据包,都发向下⼀跳地址为172.16.9.250这个路由器 line con 0 line aux 0 line vty 0 15//telnet线路(路由器只有5个,是0-4) password 12345678//login密码 login end copy running-config startup-config 保存配置。
CISCO三层交换机VLAN配置说明

CISCO三层交换机VLAN配置说明CISCO三层交换机VLAN配置说明。
实验目标:(1) 第一步实现划分4个vlan,将相应port置入到vlan号中(2) 第二步实现4个vlan间可以相互ping(3) 第三步实现sales,tech,manage不可以相互通讯,但允许和server通讯实现过程:第一步划分vlan如下:Switch#vlan dataSwitch(vlan)#vlan 10 name salesVLAN 10 added:Name: salesSwitch(vlan)#vlan 20 name techVLAN 20 added:Name: techSwitch(vlan)#vlan 30 name manageVLAN 30 added:Name: manageSwitch(vlan)#vlan 40 name serverVLAN 40 added:Name: serverSwitch(vlan)#Switch(config)#int range fa 0/0 - 3Switch(config-if-range)#switchport access vlan 10 Switch(config-if-range)#exitSwitch(config)#int range fa 0/4 - 6Switch(config-if-range)#switchport access vlan 20 Switch(config-if-range)#exitSwitch(config)#int range fa 0/7 - 8Switch(config-if-range)#switchport access vlan 30 Switch(config-if-range)#exitSwitch(config)#int fa 0/9Switch(config-if)#switSwitch(config-if)#switchport acceSwitch(config-if)#switchport access vlan 40 Switch(config-if)#exit查看Switch#sh vlan-switchVLAN Name Status Ports---- -------------------------------- --------- -------------------------------1 default active Fa0/10, Fa0/11, Fa0/12, Fa0/13 Fa0/14, Fa0/1510 sales active Fa0/1, Fa0/2, Fa0/320 tech active Fa0/4, Fa0/5, Fa0/630 manage active Fa0/7, Fa0/840 server active Fa0/91002 fddi-default active第二步实现4个vlan内的服务器互相pingSwitch(config)#int fa 0/0Switch(config-if)#switchport mode trunkRouter(config-if)#exitRouter(config)#int fa 0/0Router(config-if)#no shutRouter(config-if)#no ip addressRouter(config-if)#exitRouter(config)#int fa0/0.1Router(config-subif)#encapsulation dot1Q 10Router(config-subif)#ip addreRouter(config-subif)#ip address 192.168.33.1 255.255.255.0 Router(config-subif)#exitRouter(config)#int fa0/0.2Router(config-subif)#encapsulation dot1Q 20 Router(config-subif)#ip address 192.168.34.1 255.255.255.0 Router(config-subif)#exitRouter(config)#int fa0/0.3Router(config-subif)#encapsulation dot1Q 30 Router(config-subif)#ip address 192.168.35.1 255.255.255.0 Router(config-subif)#exitRouter(config)#int fa0/0.4Router(config-subif)#encapsulation dot1Q 40 Router(config-subif)#ip address 192.168.36.1 255.255.255.0 Router(config-subif)#查看路由器:interface FastEthernet0/0no ip addressduplex autospeed auto!interface FastEthernet0/0.1 encapsulation dot1Q 10ip address 192.168.33.1 255.255.255.0 !interface FastEthernet0/0.2 encapsulation dot1Q 20ip address 192.168.34.1 255.255.255.0 !interface FastEthernet0/0.3 encapsulation dot1Q 30ip address 192.168.35.1 255.255.255.0!interface FastEthernet0/0.4encapsulation dot1Q 40ip address 192.168.36.1 255.255.255.0!测试:VPCS 1 >shNAME IP/CIDR GATEWAY LPORT RPORT PC1 192.168.33.2/24 192.168.33.1 10001 21001PC2 0.0.0.0/0 0.0.0.0 10002 21002PC3 0.0.0.0/0 0.0.0.0 10003 21003PC4 192.168.34.2/24 192.168.34.1 10004 21004PC5 0.0.0.0/0 0.0.0.0 10005 21005PC6 0.0.0.0/0 0.0.0.0 10006 21006PC7 192.168.35.2/24 192.168.35.1 10007 21007PC8 0.0.0.0/0 0.0.0.0 10008 21008PC9 192.168.36.2/24 192.168.36.1 10009 21009 VPCS 1 >ping 192.168.34.2192.168.34.2 icmp_seq=1 timeout192.168.34.2 icmp_seq=2 time=45.000 ms192.168.34.2 icmp_seq=3 time=47.000 ms192.168.34.2 icmp_seq=4 time=43.000 ms192.168.34.2 icmp_seq=5 time=8.000 msVPCS 1 >ping 192.168.35.2192.168.35.2 icmp_seq=1 time=43.000 ms192.168.35.2 icmp_seq=2 time=14.000 ms192.168.35.2 icmp_seq=3 time=8.000 ms192.168.35.2 icmp_seq=4 time=10.000 ms192.168.35.2 icmp_seq=5 time=12.000 msVPCS 1 >ping 192.168.36.2192.168.36.2 icmp_seq=1 timeout192.168.36.2 icmp_seq=2 time=47.000 ms192.168.36.2 icmp_seq=3 time=6.000 ms192.168.36.2 icmp_seq=4 time=10.000 ms192.168.36.2 icmp_seq=5 time=43.000 msOK,这一步也成功了。
思科(三层)交换机

1.switch(config)# hostname hostname在基于CLI的交换机上设置主机名/系统名:switch(enable) set system name name-string2.在基于IOS的交换机上设置登录口令:switch(config)# enable password level 1 password在基于CLI的交换机上设置登录口令:switch(enable) set passwordswitch(enable) set enalbepass3.在基于IOS的交换机上设置远程访问:switch(config)# interface vlan 1switch(config-if)# ip address ip-address netmaskswitch(config-if)# ip default-gateway ip-address在基于CLI的交换机上设置远程访问:switch(enable) set interface sc0 ip-address netmask broadcast-address switch(enable) set interface sc0 vlanswitch(enable) set ip route default gateway4.在基于IOS的交换机上启用和浏览CDP信息:switch(config-if)# cdp enableswitch(config-if)# no cdp enable为了查看Cisco邻接设备的CDP通告信息:switch# show cdp interface [type modle/port]switch# show cdp neighbors [type module/port] [detail]在基于CLI的交换机上启用和浏览CDP信息:switch(enable) set cdp {enable disable} module/port为了查看Cisco邻接设备的CDP通告信息:switch(enable) show cdp neighbors[module/port] [vlan duplex capabilities detail]5.基于IOS的交换机的端口描述:switch(config-if)# description description-string基于CLI的交换机的端口描述:switch(enable)set port name module/number description-string6.在基于IOS的交换机上设置端口速度:switch(config-if)# speed{10100auto}在基于CLI的交换机上设置端口速度:switch(enable) set port speed moudle/number {10100auto}switch(enable) set port speed moudle/number {416auto}7.在基于IOS的交换机上设置以太网的链路模式:switch(config-if)# duplex {auto full half}在基于CLI的交换机上设置以太网的链路模式:switch(enable) set port duplex module/number {full half}8.在基于IOS的交换机上配置静态VLAN:switch# vlan databaseswitch(vlan)# vlan vlan-num name vlaswitch(vlan)# exitswitch# configure teriminalswitch(config)# interface interface module/numberswitch(config-if)# switchport mode accessswitch(config-if)# switchport access vlan vlan-numswitch(config-if)# end在基于CLI的交换机上配置静态VLAN:switch(enable) set vlan vlan-num [name name]switch(enable) set vlan vlan-num mod-num/port-list9. 在基于IOS的交换机上配置VLAN中继线:switch(config)# interface interface mod/portswitch(config-if)# switchport mode trunkswitch(config-if)# switchport trunk encapsulation {isl dotlq}switch(config-if)# switchport trunk allowed vlan remove vlan-listswitch(config-if)# switchport trunk allowed vlan add vlan-list在基于CLI的交换机上配置VLAN中继线:switch(enable) set trunk module/port [on off desirable auto nonegotiate] Vlan-range [isl dotlq dotl0lane negotiate]10.在基于IOS的交换机上配置VTP管理域:switch# vlan databaseswitch(vlan)# vtp domain domain-name在基于CLI的交换机上配置VTP管理域:switch(enable) set vtp [domain domain-name]11.在基于IOS的交换机上配置VTP 模式:switch# vlan databaseswitch(vlan)# vtp domain domain-nameswitch(vlan)# vtp {sever cilent transparent}switch(vlan)# vtp password password在基于CLI的交换机上配置VTP 模式:switch(enable) set vtp [domain domain-name] [mode{ sever cilent transparent }][password password] 12. 在基于IOS的交换机上配置VTP版本:switch# vlan databaseswitch(vlan)# vtp v2-mode在基于CLI的交换机上配置VTP版本:switch(enable) set vtp v2 enable13. 在基于IOS的交换机上启动VTP剪裁:switch# vlan databaseswitch(vlan)# vtp pruning在基于CL I 的交换机上启动VTP剪裁:switch(enable) set vtp pruning enable14.在基于IOS的交换机上配置以太信道:switch(config-if)# port group group-number [distribution {source destination}]在基于CLI的交换机上配置以太信道:switch(enable) set port channel moudle/port-range mode{on off desirable auto}15.在基于IOS的交换机上调整根路径成本:switch(config-if)# spanning-tree [vlan vlan-list] cost cost在基于CLI的交换机上调整根路径成本:switch(enable) set spantree portcost moudle/port costswitch(enable) set spantree portvlancost moudle/port [cost cost][vlan-list]16.在基于IOS的交换机上调整端口ID:switch(config-if)# spanning-tree[vlan vlan-list]port-priority port-priority在基于CLI的交换机上调整端口ID:switch(enable) set spantree portpri {mldule/port}priorityswitch(enable) set spantree portvlanpri {module/port}priority [vlans]17. 在基于IOS的交换机上修改STP时钟:switch(config)# spanning-tree [vlan vlan-list] hello-time secondsswitch(config)# spanning-tree [vlan vlan-list] forward-time secondsswitch(config)# spanning-tree [vlan vlan-list] max-age seconds在基于CLI的交换机上修改STP时钟:switch(enable) set spantree hello interval[vlan]switch(enable) set spantree fwddelay delay [vlan]switch(enable) set spantree maxage agingtiame[vlan]18. 在基于IOS的交换机端口上启用或禁用Port Fast 特征:switch(config-if)#spanning-tree portfast在基于CLI的交换机端口上启用或禁用Port Fast 特征:switch(enable) set spantree portfast {module/port}{enable disable}19. 在基于IOS的交换机端口上启用或禁用UplinkFast 特征:switch(config)# spanning-tree uplinkfast [max-update-rate pkts-per-second]在基于CLI的交换机端口上启用或禁用UplinkFast 特征:switch(enable) set spantree uplinkfast {enable disable}[rate update-rate] [all-protocols off on]20. 为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个IP地址,然后使用下列命令: switch(config)# cluster enable cluster-name21. 为了从一条中继链路上删除VLAN,可使用下列命令:switch(enable) clear trunk module/port vlan-range22. 用show vtp domain 显示管理域的VTP参数.23. 用show vtp statistics显示管理域的VTP参数.24. 在Catalyst交换机上定义TrBRF的命令如下:switch(enable) set vlan vlan-name [name name] type trbrf bridge bridge-num[stp {ieee ibm}]25. 在Catalyst交换机上定义TrCRF的命令如下:switch (enable) set vlan vlan-num [name name] type trcrf{ring hex-ring-num decring decimal-ring-num} parent vlan-num26. 在创建好TrBRF VLAN之后,就可以给它分配交换机端口.对于以太网交换,可以采用如下命令给VLAN 分配端口:switch(enable) set vlan vlan-num mod-num/port-num27. 命令show spantree显示一个交换机端口的STP状态.28. 配置一个ELAN的LES和BUS,可以使用下列命令:ATM (config)# interface atm number.subint multiointATM(config-subif)# lane serber-bus ethernet elan-name29. 配置LECS:ATM(config)# lane database database-nameATM(lane-config-databade)# name elan1-name server-atm-address les1-nsap-addressATM(lane-config-databade)# name elan2-name server-atm-address les2-nsap-addressATM(lane-config-databade)# name …30. 创建完数据库后,必须在主接口上启动LECS.命令如下: ATM(config)# interface atm numberATM(config-if)# lane config database database-nameATM(config-if)# lane config auto-config-atm-address31. 将每个LEC配置到一个不同的A TM子接口上.命令如下: ATM(config)# interface atm number.subint multipointATM(config)# lane client ethernet vlan-num elan-num32. 用show lane server 显示LES的状态.33. 用show lane bus显示bus的状态.34. 用show lane database显示LECS数据库可内容.35. 用show lane client显示LEC的状态.36. 用show module显示已安装的模块列表.37. 用物理接口建立与VLAN的连接:router# configure terminalrouter(config)# interface media module/portrouter(config-if)# description description-stringrouter(config-if)# no shutdown38. 用中继链路来建立与VLAN的连接:router(config)# interface module/port.subinterfacerouter(config-ig)# encapsulation[isl dotlq] vlan-numberrouter(config-if)# ip address ip-address subnet-mask39. 用LANE 来建立与VLAN的连接:router(config)# interface atm module/portrouter(config-if)# no ip addressrouter(config-if)# atm pvc 1 0 5 qsaalrouter(config-if)# atm pvc 2 0 16 ilnirouter(config-if)# interface atm module/port.subinterface multipointrouter(config-if)# ip address ip-address subnet-maskrouter(config-if)# lane client ethernet elan-numrouter(config-if)# interface atm module/port.subinterface multipointrouter(config-if)# ip address ip-address subnet-namerouter(config-if)# lane client ethernet elan-namerouter(config-if)# …40. 为了在路由处理器上进行动态路由配置,可以用下列IOS命令来进行: router(config)# ip routingrouter(config)# router ip-routing-protocolrouter(config-router)# network ip-network-numberrouter(config-router)# network ip-network-number41. 配置默认路由:switch(enable) set ip route default gateway42. 为一个路由处理器分配VLANID,可在接口模式下使用下列命令: router(config)# interface interface numberrouter(config-if)# mls rp vlan-id vlan-id-num43. 在路由处理器启用MLSP:router(config)# mls rp ip44. 为了把一个外置的路由处理器接口和交换机安置在同一个VTP域中:router(config)# interface interface numberrouter(config-if)# mls rp vtp-domain domain-name45. 查看指定的VTP域的信息:router# show mls rp vtp-domain vtp domain name46. 要确定RSM或路由器上的管理接口,可以在接口模式下输入下列命令:router(config-if)#mls rp management-interface47. 要检验MLS-RP的配置情况:router# show mls rp48. 检验特定接口上的MLS配置:router# show mls rp interface interface number49. 为了在MLS-SE上设置流掩码而又不想在任一个路由处理器接口上设置访问列表:set mls flow [destination destination-source full]50. 为使MLS和输入访问列表可以兼容,可以在全局模式下使用下列命令:router(config)# mls rp ip input-acl51. 当某个交换机的第3层交换失效时,可在交换机的特权模式下输入下列命令:switch(enable) set mls enable52. 若想改变老化时间的值,可在特权模式下输入以下命令:switch(enable) set mls agingtime agingtime53. 设置快速老化:switch(enable) set mls agingtime fast fastagingtime pkt_threshold54. 确定那些MLS-RP和MLS-SE参与了MLS,可先显示交换机引用列表中的内容再确定:switch(enable) show mls include55. 显示MLS高速缓存记录:switch(enable) show mls entry56. 用命令show in arp显示ARP高速缓存区的内容。
思科交换机配置命令

Cmd1. switch配置命令(1)模式转换命令用户模式----特权模式,使用命令"enable"特权模式----全局配置模式,使用命令"config t"全局配置模式----接口模式,使用命令"interface+接口类型+接口号" 全局配置模式----线控模式,使用命令"line+接口类型+接口号"注:用户模式:查看初始化的信息.特权模式:查看所有信息、调试、保存配置信息全局模式:配置所有信息、针对整个路由器或交换机的所有接口接口模式:针对某一个接口的配置线控模式:对路由器进行控制的接口配置(2)配置命令show running config 显示所有的配置show versin 显示版本号和寄存器值shut down 关闭接口no shutdown 打开接口ip add +ip地址配置IP地址secondary+IP地址为接口配置第二个IP地址show interface+接口类型+接口号查看接口管理性show controllers interface 查看接口是否有DCE电缆show history 查看历史记录show terminal 查看终端记录大小hostname+主机名配置路由器或交换机的标识config memory 修改保存在NVRAM中的启动配置exec timeout 0 0 设置控制台会话超时为0service password-encryptin 手工加密所有密码enable password +密码配置明文密码ena sec +密码配置密文密码line vty 0 4/15 进入telnet接口password +密码配置telnet密码line aux 0 进入AUX接口password +密码配置密码line con 0 进入CON接口password +密码配置密码bandwidth+数字配置带宽no ip address 删除已配置的IP地址show startup config 查看NVRAM中的配置信息copy run-config atartup config 保存信息到NVRAMwrite 保存信息到NVRAMerase startup-config 清除NVRAM中的配置信息show ip interface brief 查看接口的谪要信息banner motd # +信息+ # 配置路由器或交换机的描素信息description+信息配置接口听描素信息vlan database 进入VLAN数据库模式vlan +vlan号+ 名称创建VLANswitchport access vlan +vlan号为VLAN为配接口interface vlan +vlan号进入VLAN接口模式ip add +ip地址为VLAN配置管理IP地址vtp+service/tracsparent/client 配置SW的VTP工作模式vtp +domain+域名配置SW的VTP域名vtp +password +密码配置SW的密码switchport mode trunk 启用中继no vlan +vlan号删除VLANshow spamming-tree vlan +vlan号查看VLA怕生成树议2. 路由器配置命令ip route+非直连网段+子网掩码+下一跳地址配置静态/默认路由show ip route 查看路由表show protocols 显示出所有的被动路由协议和接口上哪些协议被设置show ip protocols 显示了被配置在路由器上的路由选择协议,同时给出了在路由选择协议中使用的定时器等信息router rip 激活RIP协议network +直连网段发布直连网段interface lookback 0 激活逻辑接口passive-interface +接口类型+接口号配置接口为被动模式debug ip +协议动态查看路由更新信息undebug all 关闭所有DEBUG信息router eigrp +as号激活EIGRP路由协议network +网段+子网掩码发布直连网段show ip eigrp neighbors 查看邻居表show ip eigrp topology 查看拓扑表show ip eigrp traffic 查看发送包数量router ospf +process-ID 激活OSPF协议network+直连网段+area+区域号发布直连网段show ip ospf 显示OSPF的进程号和ROUTER-IDencapsulation+封装格式更改封装格式no ip admain-lookup 关闭路由器的域名查找ip routing 在三层交换机上启用路由功能show user 查看SW的在线用户clear line +线路号清除线路3. 三层交换机配置命令配置一组二层端口configure terminal 进入配置状态nterface range {port-range} 进入组配置状态配置三层端口configure terminal 进入配置状态interface {{fastethernet | gigabitethernet} interface-id} | {vlan vlan-id} | {port- channel port-channel-number} 进入端口配置状态no switchport 把物理端口变成三层口ip address ip_address subnet_mask 配置IP地址和掩码no shutdown 激活端口例:Switch(config)# interface gigabitethernet0/2Switch(config-if)# no switchportSwitch(config-if)# ip address 192.20.135.21 255.255.255.0Switch(config-if)# no shutdown配置VLANconfigure terminal 进入配置状态vlan vlan-id 输入一个VLAN号, 然后进入vlan配态,可以输入一个新的VLAN 号或旧的来进行修改。
思科设备三层交换机的vlan间通信配置

本次主要讲解三层交换实现 vian 间的相互通信:本例配置模型图命令行:swA 配置命令:Switch>e nableSwitch#vlandatabase // 进入 vian 配置模式% Warning: It is recomme nded to con figure VLAN from config mode, asVLAN database mode is being deprecated. Please con sult user documentati on for con figuri ng VTP/VLAN in config mode.Switch(vlan)#vlan 2 name TztA// 在 swA 上创建 vlan 2 名为 TztAVLAN 2 added:Name: TztA Switch(vlan)#vlan 3 name TztB // 在 swA 上创建 vlan 3 名为 TztB VLAN 3added:Name: TztBSwitch(vla n)#exitAPPLY completed.Exit in g....Switch#co nf tEn ter con figurati on comma nds, one per line. End with CNTL/Z.Switch(co nfig)#i nt fO/2Switch(c on fig-if)#switchport mode access3560-2^PSM SwLaptop-PT192.168-2.2'24%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state todown %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up Switch(config-if)#switchport trunk allowed vlan all // 允许所有 vlan 通过 f0/1 端口 Switch(config-if)#exitSwitch(config)#exitSwitch#%SYS-5-CONFIG_I: Configured from console by consoleSwitch#wrBuilding configuration...[OK]Switch#(三层交换机) M sw 命令配置:Switch>Switch>enableSwitch#vlandatabase // 进入 vlan 配置模式% 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. Switch(vlan)#vlan 2 name TztA // 在 Msw 上创建 vian 2 名为 TztA VLAN 2 added:Name: TztASwitch(vlan)#vlan 3 name TztB // 在 Msw 上创建 vian 2 名为 TztAVLAN 3 added:Name: TztBSwitch(vla n)#exitAPPLY completed.Switch(config-if)#switchport access vlan 2Switch(config-if)#exit Switch(config)#int f0/3Switch(config-if)#switchport mode access Switch(config-if)#switchport access vlan 3 Switch(config-if)#exitSwitch(config)#int f0/1 Switch(config-if)#switchport mode trunk// 将 f0/2 划分给 vlan 2 // 将 f0/3 划分给 vlan 3// 配置与三层设备连接的 f0/1 为 trunk 模式Exit in g....Switch#co nf tEn ter con figurati on comma nds, one per line. End with CNTL/Z.Switch(co nfig)#i nt fO/1Switch(config-if)# switchport mode trunk // 配置三层设备与二层设备连接的fO/1 为trunk模式Comma nd rejected: An in terface whose trunk en capsulati on is "Auto" can not becon figured to "tr unk" mode.Switch(config-if)# switchport trunk allowed vlan all // 允许所有vlan 通过f0/1 端口Switch(config-if)#no shutdown //激活端口Switch(c on fig-if)#exitSwitch(config)# ip routing //使用三层设备的路由功能Switch(config)#intvlan 2 // 进入vlan 2 配置模式虚拟端口%LINK-5-CHANGED: In terface Vla n2, cha nged state to upSwitch(co nfig-if)#%LINEPROTO-5-UPDOWN: Line protocol on In terface Vla n2, changed state to upSwitch(config-if)#ip address 192.168.1.1 255.255.255.0 // 配置vlan 2 的ip 地址Switch(config-if)#no shutdown //激活端口Switch(c on fig-if)#exitSwitch(config)#intvlan 3 // 配置vlan 3 虚拟端口Switch(co nfig-if)#%LINK-5-CHANGED: In terface Vla n3, cha nged state to up%LINEPROTO-5-UPDOWN: Line protocol on In terface Vla n3, changed state to upSwitch(config-if)#ip address 192.168.2.1 255.255.255.0Switch(c on fig-if)# no shutdow nSwitch(c on fig-if)#exitSwitch(c on fig)#do show ip routeCodes: C - conn ected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF in ter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS in ter area * - can didate default, U - per-user static route, o - ODR P - periodic dow nl oaded static routeGateway of last resort is not setC 192.168.1.0/24 is directly connected, Vlan2 //C 192.168.2.0/24 is directly conn ected, Vla n3 Switch(co nfig)#Switch(c on fig)#exit Switch# %SYS-5-CONFIG_l: Con figured from con sole by con soleSwitch#wrBuildi ng con figurati on...[OK]注意:通信基础需要配置网关本次讲解结束! 以上配置结束完成后,两台 PC 能够相互通信(如图)上述的配置成果。
思科交换机路由器命令大全

思科交换机路由器命令大全思科交换机和路由器命令大全本文档为思科交换机和路由器命令的最新最全范本,供参考使用。
以下是详细的命令列表,包括每个命令的说明和用法。
一、接口配置命令1、ip address:设置接口的IP地质示例:ip address 192.168.1.1 255.255.255:02、no shutdown:启用接口示例:no shutdown3、duplex:设置接口的双工模式示例:duplex auto4、speed:设置接口的速度示例:speed 1005、exit:退出接口配置模式示例:exit二、VLAN命令1、vlan database:进入VLAN数据库模式示例:vlan database2、vlan id name:创建VLAN并设置名称示例:vlan 10 name VLAN-103、vlan id:删除VLAN示例:no vlan 104、show vlan:显示VLAN信息示例:show vlan5、exit:退出VLAN数据库模式示例:exit三、路由命令1、ip route:设置静态路由示例:ip route 192.168.2:0 255.255.255:0 192.168.1.22、router rip:启用RIP路由协议示例:router rip3、network:将网络添加到RIP路由表中示例:network 10:0:0:04、redistribute:将静态路由或其他路由协议添加到RIP路由表中示例:redistribute static5、exit:退出路由配置模式示例:exit四、ACL命令1、access-list:创建标准或扩展ACL示例:access-list 10 permit 192.168.1:0 0:0:0.2552、ip access-group:应用ACL到接口示例:ip access-group 10 in3、show access-lists:显示ACL信息示例:show access-lists4、exit:退出ACL配置模式示例:exit五、SNMP命令1、snmp-server community:设置SNMP团体字符串示例:snmp-server community public RO2、snmp-server enable traps:启用SNMP陷阱示例:snmp-server enable traps3、snmp-server host:配置SNMP陷阱接收主机示例:snmp-server host 192.168.1.1004、exit:退出SNMP配置模式示例:exit六、SSH命令1、ip ssh version:设置SSH协议版本示例:ip ssh version 22、crypto key generate rsa:RSA密钥对示例:crypto key generate rsa3、username:创建新的本地用户示例:username admin privilege 15 password password1234、exit:退出SSH配置模式示例:exit七、其他命令1、show running-config:显示当前配置示例:show running-config2、copy running-config startup-config:将当前配置保存到启动配置中示例:copy running-config startup-config3、reload:重新启动设备示例:reload4、exit:退出CLI命令行模式示例:exit本文档涉及附件:1、无附件本文所涉及的法律名词及注释:1、ACL(Access Control List):访问控制列表,用于控制网络流量的进出。
Cisco3560三层交换机VLAN的配置案例

3、网络拓扑图
4、配置三层交换机 本例以思科三层交换机为例,具体配置命令如下所示:
1)、创建5个vlan 3560(config)#vlan 10 3560(config-vlan)#vlan 20 3560(config-vlan)#vlan 30 3560(config-vlan)#vlan 40 3560(config-vlan)#vlan 50 3560(config-vlan)#exit
2、各机房IP地址分配
机房一、二: IP:192.168.7.X/24,网关:192.168.7.254 机房三、四: IP:192.168.8.X/24,网关:192.168.8.254 机房五、六: IP:192.168.10.X/24,网关:192.168.10.254 机房七: IP:192.168.11.X/24,网关:192.168.11.254 服务器: IP:192.168.12.X/24 网关:192.168.12.254
2)、将端口划分到相应的VLAN
3560(config)#int range f0/1-5 3560(config-if-range)#switchport mode access 3560(config-if-range)#switchport access vlan10 3560(config-if-range)#exit 3560(config)#int range f0/6-10 3560(config-if-range)#switchport mode access 3560(config-if-range)#switchport access vlan20 3560(config-if-range)#exit 3560(config)#int range f0/11-15 3560(config-if-range)#switchport mode access 3560(config-if-range)#switchport access vlan30 3560(config-if-range)#exit 3560(config)#int range f0/16-20
思科交换机配置命令大全

思科交换机配置命令大全前几天我们了解了华为交换机的配置命令,有朋友问到思科,那么今天我们来了解思科交换机的配置方式。
一、基本配置命令switch> 用户模式1:进入特权模式 enableswitch> enableswitch#2:进入全局配置模式 configure terminalswitch> enableswitch#c onfigure terminalswitch(conf)#3:交换机命名 hostname aptech2950 以 aptech2950 为例switch> enableswitch#c onfigure terminalswitch(conf)#hostname aptch-2950aptech2950(conf)#4:配置使能口令 enable password cisco 以 cisco 为例switch> enableswitch#c onfigure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# enable password cisco5:配置使能密码 enable secret ciscolab 以 cicsolab 为例switch> enableswitch#c onfigure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# enable secret ciscolab6:设置虚拟局域网 vlan 1 interface vlan 1switch> enableswitch#c onfigure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# interface vlan 1aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0 配置交换机端口 ip 和子网掩码aptech2950(conf-if)#no shut 是配置处于运行中aptech2950(conf-if)#exitaptech2950(conf)#ip default-gateway 192.168.254 设置网关地址7:进入交换机某一端口 interface fastehernet 0/17 以 17 端口为例switch> enableswitch#c onfigure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# interface fastehernet 0/17aptech2950(conf-if)#8:查看命令 showswitch> enableswitch# show version 察看系统中的所有版本信息show interface vlan 1 查看交换机有关 ip 协议的配置信息show running-configure 查看交换机当前起作用的配置信息show interface fastethernet 0/1 察看交换机 1 接口具体配置和统计信息show mac-address-table 查看 mac 地址表show mac-address-table aging-time 查看 mac 地址表自动老化时间9:交换机恢复出厂默认恢复命令switch> enableswitch# erase startup-configureswitch# reload10:双工模式设置switch> enableswitch#c onfigure terminalswitch2950(conf)#hostname aptch-2950aptech2950(conf)# interface fastehernet 0/17 以 17 端口为例aptech2950(conf-if)#duplex full/half/auto 有 full , half, auto 三个可选项11:cdp 相关命令switch> enableswitch# show cdp 查看设备的 cdp 全局配置信息show cdp interface fastethernet 0/17 查看 17 端口的 cdp 配置信息show cdp traffic 查看有关 cdp 包的统计信息show cdp nerghbors 列出与设备相连的 cisco 设备12:csico2950 的密码恢复拔下交换机电源线。
鸿鹄论坛_思科锐捷三层交换机配置DHCP

需求:vlan 10中的PC能自动获取到192.168.10.0网段,vlan 20中的PC能自动获取到192.168.20.0的网段。
预配:Switch>enSwitch#conf tEnter configuration commands, one per line. End with CNTL/Z.Switch(config)#no ip domain loSwitch(config)#lin con 0Switch(config-line)#exeSwitch(config-line)#exec-timeout 0 0Switch(config-line)#loggSwitch(config-line)#logging sSwitch(config-line)#logging synchronous第一步:在三层交换机上配置VLAN并配IP地址作为网关Switch(config)#vlan 10Switch(config-vlan)#name banggongSwitch(config-vlan)#exitSwitch(config)#vlan 20Switch(config-vlan)#name shengchangSwitch(config-vlan)#exitSwitch(config)#intvlan 10Switch(config-if)#ip add 192.168.10.1 255.255.255.0Switch(config-if)#no shSwitch(config-if)#exitSwitch(config)#intvlan 20Switch(config-if)#ip add 192.168.20.1 255.255.255.0Switch(config-if)#no sh第二步:在三层交换机上配置DHCP服务Switch(config)#ipdhcp excluded-address 192.168.10.1Switch(config)#ipdhcp excluded-address 192.168.20.1排除作为网关的地址Switch(config)#ipdhcp pool vlan10Switch(dhcp-config)#network 192.168.10.0 255.255.255.0Switch(dhcp-config)#default-router 192.168.10.1有DNS服务器的话还要填写DNS服务器的地址Switch(dhcp-config)#dns-serverx.x.x.xSwitch(dhcp-config)#exitSwitch(config)#ipdhcp pool vlan20Switch(dhcp-config)#network 192.168.20.0 255.255.255.0Switch(dhcp-config)#default-router 192.168.20.1第三步:在二层交换机上创建VLAN 10和VLAN 20Switch(config)#vlan 10Switch(config-vlan)#exitSwitch(config)#vlan 20Switch(config-vlan)#exitSwitch(config)#int range f0/2 - 4Switch(config-if-range)#switchport mode accessSwitch(config-if-range)#switchport access vlan 10Switch(config-if-range)#exitSwitch(config)#int range f0/5 - 7Switch(config-if-range)#switchport mode accessSwitch(config-if-range)#switchport access vlan 20锐捷系列与思科配置完全一样,但是要注意配置前一定要开启DHCP服务service dhcp上次在配置的时候忘了配置这条命令,结果怎么也获取不到IP。
cisco三层交换机命令

R1(config)# line console 0 R1(config-line)# login R1(config-line)# password Lisbon R1(config)# enable password Lilbao R1(config)# login local R1(config)# username student password cisco R1(config)# line console 0 R1(config-line)# exec-timeout 5 10 R1(config)# line vty 0 4 R1(config-line)# exec-timeout 5 2 R1(config)# privilege configure level 3 username R1(config)# privilege configure level 3 copy run start R1(config)# privilege configure level 3 ping R1(config)# privilege configure level 3 show run R1(config)# enable secret level 3 cisco router(config)# privilege mode level level command
switch(enable) set trunk module/port [on|off|desirable|auto|nonegotiate] Vlan-range [isl|dotlq|dotl0|lane|negotiate] switch(enable) clear trunk module/port vlan-range(中继链路上删除VLAN)
思科三层交换命令

思科三层交换机配置命令2008-07-08 13:32思科三层交换机配置命令2007-08-05 15:19Enable //进入私有模式Configure terminal //进入全局模式service password-encryption //对密码进行加密hostname Catalyst 3550-12T1 //给三层交换机定义名称enable password 123456. //enable密码Enable secret 654321 //enable的加密密码(应该是乱码而不是654321这样)Ip subnet-zero //允许使用全0子网(默认都是打开的)Ip name-server 172.16.8.1 172.16.8.2 //三层交换机名字Catalyst 3550-12T1对应的IP地址是172.16.8.1Service dhcp //提供DHCP服务ip routing //启用三层交换机上的路由模块ExitVtp mode server //定义VTP工作模式为sever模式Vtp domain centervtp //定义VTP域的名称为centervtpVlan 2 name vlan2 //定义vlan并给vlan取名(如果不取名的话,vlan2的名字应该是vlan002)Vlan 3 name vlan3Vlan 4 name vlan4Vlan 5 name vlan5Vlan 6 name vlan6Vlan 7 name vlan7Vlan 8 name vlan8Vlan 9 name vlan9Exitinterface Port-channel 1 //进入虚拟的以太通道组1 Interface gigabitethernet 0/1 //进入模块0上的吉比特以太口1 channel-group 1 mode on //把这个接口放到快速以太通道组1中Interface gigabitethernet 0/2 //同上channel-group 1 mode onport-channel load-balance src-dst-ip //定义快速以太通道组的负载均衡方式(依靠源和目的IP的方式)interface gigabitethernet 0/3 //进入模块0上的吉比特以太口3interface gigabitethernet 0/4 //同上interface gigbitethernet 0/5 //同上interface gigbitethernet 0/6 //同上interface gigbitethernet 0/7 //进入模块0上的吉比特以太口7 no shutdownspanning-tree vlan 6-9 cost 1000 //在生成树中,vlan6-9的开销定义为10000interface range gigabitethernet 0/8 – 10 //进入模块0上的吉比特以太口8,9,10no shutdownspanning-tree portfast //在这些接口上使用portfast(使用portfast以后,在生成树的时候不参加运算,直接成为转发状态)interface gigabitethernet 0/11 //进入模块0上的吉比特以太口11 interface gigabitethernet 0/12 //同上interface vlan 1 //进入vlan1的逻辑接口(不是物理接口,用来给vlan做路由用)ip address 172.16.1.7 255.255.255.0 //配置IP地址和子网掩码no shutdownstandby 1 ip 172.16.1.9 //开启了冗余热备份(HSRP),冗余热备份组1,虚拟路由器的IP地址为172.16.1.9standby 1 priority 110 preempt //定义这个三层交换机在冗余热备份组1中的优先级为110,preempt是用来开启抢占模式interface vlan 2 //同上ip address 172.16.2.252 255.255.255.0no shutdownstandby 2 ip 172.16.2.254standby 2 priority 110 preemptip access-group 101 in //在入方向上使用扩展的访问控制列表101interface vlan 3 //同上ip address 172.16.3.252 255.255.255.0no shutdownstandby 3 ip 172.16.3.254standby 3 priority 110 preemptip access-group 101 ininterface vlan 4 //同上ip address 172.16.4.252 255.255.255.0no shutdownstandby 4 ip 172.16.4.254standby 4 priority 110 preemptip access-group 101 ininterface vlan 5ip address 172.16.5.252 255.255.255.0no shutdownstandby 5 ip 172.16.5.254standby 5 priority 110 preemptip access-group 101 ininterface vlan 6ip address 172.16.6.252 255.255.255.0no shutdownstandby 6 ip 172.16.6.254standby 6 priority 100 preemptinterface vlan 7ip address 172.16.7.252 255.255.255.0no shutdownstandby 7 ip 172.16.7.254standby 7 priority 100 preemptinterface vlan 8ip address 172.16.8.252 255.255.255.0no shutdownstandby 8 ip 172.16.8.254standby 8 priority 100 preemptinterface vlan 9ip address 172.16.9.252 255.255.255.0no shutdownstandby 9 ip 172.16.9.254standby 9 priority 100 preemptaccess-list 101 deny ip any 172.16.7.0 0.0.0.255 //扩展的访问控制列表101access-list 101 permit ip any anyInterface vlan 1 //进入vlan1这个逻辑接口Ip helper-address 172.16.8.1 //可以转发广播(helper-address 的作用就是把广播转化为单播,然后发向172.16.8.1)Interface vlan 2Ip helper-address 172.16.8.1Interface vlan 3ip helper-address 172.16.8.1interface vlan 4ip helper-address 172.16.8.1interface vlan 5ip helper-address 172.16.8.1interface vlan 6ip helper-address 172.16.8.1interface vlan 7ip helper-address 172.16.8.1interface vlan 9ip helper-address 172.16.8.1router rip //启用路由协议RIPversion 2 //使用的是RIPv2,如果没有这句,则是使用RIPv1 network 172.16.0.0 //宣告直连的网段exitip route 0.0.0.0 0.0.0.0 172.16.9.250 //缺省路由,所有在路由表中没有办法匹配的数据包,都发向下一跳地址为172.16.9.250这个路由器line con 0line aux 0line vty 0 15 //telnet线路(路由器只有5个,是0-4)password 12345678 //login密码loginendcopy running-config startup-config 保存配置。
2、思科模拟器 实验二(三层交换机VLAN配置)hao

思科模拟器三层交换机VLAN配置一、实验拓扑图:交换机switch 1的端口fei_0/1和交换机switch 2的端口fei_0/1属于VLAN 10;交换机switch 1的端口fei_0/2和交换机switch 2的端口fei_0/2属于VLAN 20,均为Access端口。
两台交换机通过端口fei_0/16以Trunk方式连接,两端口为Trunk端口。
二、操作步骤:1、在switch 1上配置VLAN10和VLAN20,VLAN10的成员包括fei_0/1和上行端口fei_0/16,VLAN20的成员包括fei_0/2上行端口fei_0/16。
2、在switch 2上配置VLAN10和VLAN20,VLAN10的成员包括fei_0/1和上行端口fei_0/16,VLAN20的成员包括fei_0/2和上行端口fei_0/16。
switch 1配置命令如下:ZXR10>enableZXR10#vlan database------在特权模式下配置VLAN数据库ZXR10(vlan)#vlan 10-------创建VLAN 10ZXR10(vlan)#vlan 20------创建VLAN 20ZXR10(vlan)#exitZXR10#configure terminalZXR10(config)#1、进入端口fei_0/1,把端口fei_0/1加入vlan 10,fei_0/1模式为access;ZXR10(config)#interface fastethernet 0/1ZXR10(config-if)#switchport mode accessZXR10(config-if)#switchport access vlan 10ZXR10(config-if)#exit2、进入端口fei_0/2,把端口fei_0/2加入vlan 20,fei_0/2模式为access;ZXR10(config)#interface fastethernet 0/2ZXR10(config-if)#switchport mode accessZXR10(config-if)#switchport access vlan 20ZXR10(config-if)#exit3、进入fei_0/16端口,将该端口设置成trunk模式,并且把端口fei_0/16以trunk模式加入vlan10,vlan 20ZXR10(config)#interface fastethernet 0/16ZXR10(config-if)#switchport mode trunkZXR10(config-if)#switchport trunk allowed vlan 10,20ZXR10(config-if)#endZXR10#write---------保存文件(备注:switch 2配置命令同switch 1一样)三、验证方法:1. PC-1和PC-2不能互通,PC-3和PC-4不能互通2. PC-1和PC-3互通,PC-2和PC-4互通。
Cisco三层交换机配置命令及解释

Cisco三层交换机配置命令及解释1、2、DEBUG命令3、思科交换机⽇志管理查看⽇志:show loggingCisco交换机 SNMP配置——————————————————————————————————————基本配置S> enable 进⼊特权模式S# configure terminal 进⼊全局配置模式S(config)# hostname name 改变交换机名称S(config)# enable password level level_# password 设置⽤户⼝令(level_#=1)或特权⼝令(level_#=15)S(config)# line console 0 进⼊控制台接⼝S(config-line)# password console_password 接上⼀条命令,设置控制台⼝令S(config)# line vty 0 15 进⼊虚拟终端S(config-line)# password telnet_password 接上⼀条命令,设置Telnet⼝令S(config-line)# login 允许Telnet登录S(config)# enable password|secret privilege_password 配置特权⼝令(加密或不加密)S(config)# interface ethernet|fastethernet|gigabitethernet slot_#/port_# 进⼊接⼝⼦配置模式S(config-if)# [no] shutdown 关闭或启⽤该接⼝(默认启⽤)S(config)# ip address IP_address sunbet_mask 指定IP地址S(config)# ip default-gateway router's_IP_address 指定哪台路由器地址为默认⽹关S# show running-config 查看当前的配置S# copy running-config startup-config 将RAM中的当前配置保存到NVRAM中S> show interface [type slot_#/port_#] 查看所有或指定接⼝的信息S> show ip 显⽰交换机的IP配置(只在1900系列上可⽤)S> show version 查看设备信息S# show ip interface brief 验证IP配置S(config-if)# speed 10|100|auto 设置接⼝速率S(config-if)# duplex auto|full|half 设置接⼝双⼯模式S> show mac-address-table 查看CAM表S# clear mac-address-table 清除CAM表中的动态条⽬1900(config)# mac-address-table permanent MAC_address type [slot_#/]port_# 在CAM表中创建静态条⽬2950(config)# mac-address-table static MAC_address vlan VLAN_# interface type [slot_#/] port_# 在CAM表中创建静态条⽬1900(config)# mac-address-table restricted static MAC_address source_port list_of_allowed_interface 设置静态端⼝安全措施1900(config-if)# port secure 启⽤粘性学习1900(config-if)# port secure max-mac-count value 设置粘性学习特性能够学到的地址数量(默认132,取值范围是1-132)1900(config)# address-violation suspend|ignore|disable 改变安全选项1900> show mac-address-table security 验证端⼝安全措施2950(config)# switchport mode access 定义接⼝为主机端⼝⽽不是中继端⼝2950(config)# switchport port-security 启⽤端⼝安全措施2950(config)# switchport port-security maximum value 指定可与此接⼝相关的设备的最⼤数量2950(config)# switchport port-security violation protect|restrict|shutdown 指定出现安全违规时应该发⽣的事2950(config)# switchport port-security mac-address MAC_address 指定允许与此接⼝相关的确切的MAC地址2950(config)# switchport port-security mac-address sticky 启⽤粘性学习特性2950(config)# show port interface type [slot_#/] port_# 验证接⼝配置2950(config-if) description name 设置接⼝描述信息2950# show buffers 查看系统缓存的⼤⼩1900# copy nvram tftp:// IP_address_of_TFTP_server/ file_name 将配置⽂件备份到TFTP服务器上1900# copy tftp:// IP_address_of_TFTP_server/ file_name nvram 从TFTP服务器上恢复配置到NVRAM1900# delete nvram 删除配置⽂件2950# erase startup-config 删除配置⽂件3550# show tcam qos TCAM_ID statistics 查看TCAM剩余容量4000> enable 进⼊特权模式4000>(enable) set password 设置⽤户模式密码4000>(enable) set enablepass 设置授权密码4000>(enable) set interface sc0 IP_address mask 配置IP地址4000>(enable) set port enable|disable slot_#/port_# 启⽤/禁⽤接⼝4000>(enable) show port [slot_#/port_#] 显⽰接⼝信息4000>(enable) set port name slot_#/port_# name 设置交换机接⼝描述信息4000>(enable) set port speed slot_#/port_# 4|10|16|100|auto 设置交换机接⼝速率4000>(enable) set port duplex slot_#/port_# full|half 设置交换机接⼝双⼯模式4000>(enable) clear config all 删除NVRAM中的配置信息4000>(enable) erase all 删除FLASH中的内容4000>(enable) show flash 显⽰FLASH中的内容4000>(enable) show cam [count] dynamic|static|permanent|system [vlan_#] 显⽰CAM表VLAN 1900(config)# vtp domain VTP_domain_name 定义交换机域名1900(config)# vtp server|client|transparent 定义交换机VTP模式(默认服务器)1900(config)# vtp password VTP_password 配置VTP⼝令1900(config)# vtp pruning enable|disable 启⽤/禁⽤修剪(默认启⽤)1900(config)# vtp trap enable 启⽤SNMP陷阱(默认启⽤)1900# show vtp 验证VTP配置2950# vtp database 访问VLAN和VTP配置(以下均是在IOS12.1前⽤,12.1后全是在全局配置模式下)2950(vlan)# vtp domain VTP_domain_name 定义交换机域名2950(vlan)# vtp server|client|transparent 定义交换机VTP模式(默认服务器)2950(vlan)# vtp password VTP_password 配置VTP⼝令2950(vlan)# vtp pruning 启⽤/禁⽤修剪(默认启⽤)2950(config)# snmp-server enable traps vtp 启⽤SNMP陷阱(默认启⽤)2950# show vtp status 检查VTP配置2950# show vtp counters 显⽰与VTP消息发送与接收相关的VTP统计信息1900(config-if)# trunk on|off|desirable|auto 指定中继类型1900# show trunk A|B 验证接⼝中继(A是fa0/26,B是fa0/27)2950(config-if)# switchport mode trunk|dynamic desirable|dynamic auto|nonegotiate 指定中继类型(默认⾃动协商)2950(config-if)# switchport trunk native|allowed|pruning vlan VLAN_# 配置中继2950(config-if)# switchport trunk pruning vlan remove VLAN_# 清除不希望消减的VLAN2950# show interfaces [type 0/port_#] switchport|trunk 验证接⼝中继1900(config)# vlan VLAN_# [name VLAN_name] 创建VLAN1900(config-if)# vlan-membership static VLAN_# 将该接⼝静态地分配给⼀个VLAN1900# show vlan 验证VLAN1900# show vlan-membership 查看VLAN成员关系1900# show spantree [VLAN_#] 查看VLAN的STP信息2950# vlan database 进⼊VLAN数据库(ISO12.1前⽤)2950(vlan)# vlan VLAN_# [name VLAN_name] 创建VLAN2950(config)# vlan VLAN_# 进⼊VLAN数据库(ISO12.1后⽤)2950(config-vlan)# name VLAN_name 创建VLAN2950(config-if)# switchport mode access 指定连接是接⼊链路连接2950(config-if)# switchport access vlan VLAN_# 指定VLAN是接⼊链路连接4000>(enable) set vlan VLAN_# name VLAN_name 配置VLAN4000>(enable) set vlan VLAN_# slot_#/port_#-port_# 为VLAN分配端⼝4000>(enable) set trunk slot_#/port_# [on|off|desirable|auto|nonegotiate] [VLAN_#] [isl|dot1q|dot10|lane|negotiate] 配置中继4000>(enable) clear trunk slot_#/port_# VLAN_# 删除VLAN4000>(enable) show trunk slot_#/port_# 验证中继端⼝4000>(enable) set vtp v2 enable 配置VTPv24000>(enable) set vtp [domain name] [mode client|server|transparent] [passwd password] [pruning enable|disable] [v2 enable|disable] 设置VTP4000>(enable) show vtp domain 验证VTP域的信息4000>(enable) show vtp statistics 显⽰发出或收到的VTP通告信息的摘要内容4000>(enable) set vtp pruneeligible VLAN_# 设置VTP消减4000>(enable) clear vtp pruneeligible VLAN_# 清除不希望消减的VLANSTP 4000>(enable) set spantree enable|disable VLAN_# 启⽤/禁⽤STP(默认启⽤)2950(config)# [no] spanning-tree vlan VLAN_# 启⽤/禁⽤STP(默认启⽤)4000>(enable) show spantree [VLAN_#] 验证STP状态2950# show spanning-tree 验证STP状态4000>(enable) set spantree root [secondary] VLAN_# [dia network_diameter] [hello hello_time] 设置主根节点桥、备份节点桥、最⼤桥数量(2-7)、持续时间(1-10,默认2)4000>(enable) set spantree portcost slot_#/port_# cost_# 设置端⼝开销2950(config-if)# spanning-tree cost cost_# 设置端⼝开销4000>(enable) set spantree portpri slot_#/port_# priority_# 设置端⼝优先级4000>(enable) set spantree portvlanpri slot_#/port_# priority_# [VLAN_#] 改变VLAN的优先级设置2950(config-if)# spanning-tree vlan VLAN_# port-priority priority_# 设置端⼝优先级4000>(enable) set spantree fwddelay delay_# [VLAN_#] 设置从侦听状态到学习状态再到转发状态的时间间隔(默认15秒,取值范围是4-30秒)4000>(enable) set spantree hello interval_time [VLAN_#] 设置根节点交换机发送BPDU的时间间隔(默认2秒,取值范围是1-10秒)4000>(enable) set spantree maxage agingtime [VLAN_#] 设置交换机持有BPDU的时间(默认20秒,取值范围是6-40秒)2950(config)# spanning-tree vlan VLAN_# forward-time forward_time 设置从侦听状态到学习状态再到转发状态的时间间隔(默认15秒,取值范围是4-30秒)2950(config)# spanning-tree vlan VLAN_# hello-time hello_time 设置根节点交换机发送BPDU的时间间隔(默认2秒,取值范围是1-10秒)2950(config)# spanning-tree vlan VLAN_# max-age maxage 设置交换机持有BPDU的时间(默认20秒,取值范围是6-40秒)4000>(enable) set port channel slot_#/port_# on 建⽴以太通道集合4000>(enable) show port capabilities slot_#/port_# 查看端⼝的配置4000>(enable) show port channel 验证以太通道集合的配置2950(config-if)# channel-group group_number mode auto|desirable|on 建⽴以太通道集合2950# show etherchannel group_number|brief|detail|load-balance|port|port-channel|summary 验证以太通道集合的配置4000>(enable) set spantree portfast slot_#/port_# enable 配置PortFast2950(config-if)# spanning-tree portfast 配置PortFast4000>(enable) set spantree uplinkfast enable|disable [rate station_update_rate] [all-protocols off|on] 启⽤/禁⽤UplinkFast4000>(enable) show spantree uplinkfast 验证UplinkFast配置2950(config)# spanning-tree uplinkfast [max_update_rate] 启⽤/禁⽤UplinkFast2950# show spanning-tree uplinkfast 验证UplinkFast配置4000>(enable) set spantree backbonefast enable|disable 启⽤/禁⽤BackboneFast4000>(enable) show spantree backbonefast 验证BackboneFast配置2950(config)# spanning-tree backbonefast 启⽤BackboneFast虚拟⽹间路由2600(config)# interface type slot_#/port_#.subint_number 配置⼦接⼝2600(config-subif)# encapsulation dot1q|isl|sde|tr-isl VLAN_# 配置封装类型4000>(enable) show module 查看交换机的硬件配置4000>(enable) session module_# 访问L3SML3SM(config-if)# mac-address mac_address 分配MAC地址MLS 2600(config)# mls rp ip 启动MLS2600(config-if)# mls rp vtp-domain domain_name 分配路由器接⼝到VTP域中2600(config-if)# mls rp vlan-id VLAN_# 向接⼝分配VLAN2600(config-if)# mls rp management-interface 指定该接⼝为管理接⼝2600# show mls rp 提供全局MLS信息2600# show mls rp interface type slot_#/port_# 提供指定接⼝的MLS信息2600# show mls rp vtp-domain domain_name 提供VTP域的MLS信息6500>(enable) set mls enable 在MLS-SE上启动MLS6500>(enable) set mls include rp_ip_address 告诉交换机哪⼀个IP地址是正确的6500>(enable) show mls include 显⽰外部路由处理器的IP地址列表6500>(enable) set mls flow [destination|destination-source|full] 告诉MLS交换机要缓存候选数据包的哪些信息6500>(enable) show mls entry 显⽰第三层缓存表6500>(enable) set mls agingtime aging_time 改变缓存的衰⽼时间(默认256秒,取值范围是8-2032秒中的8的倍数值)6500>(enable) set mls agingtime fast fast_aging_time pkt_threshold 改变快速衰⽼周期和数据包门限值6500>(enable) show mls ip 验证MLS-SE的配置6500>(enable) clear mls entry [destination IP_address] [source IP_address] [flow protocol] [source_port] [destination_port] [all] 删除所有或指定MLS缓存记录3550(config)# ip routing 启动IP路由3550(config)# ip cef 启动CEF3550(config-if)# no switchport 将第⼆层接⼝转换为第三层接⼝3550(config-if)# ip route-cache cef 在接⼝上启动CEF3550# show ip cef 验证CEF组播3640(config)# ip multicast-routing 启动路由器上的组播服务3640(config-if)# ip pim dense-mode 将接⼝设置为PIM密集模式3640(config-if)# ip pim sparse-mode 将接⼝设置为PIM稀疏模式3640(config-if)# ip pim sparsed-dense-mode 将接⼝设置为PIM稀疏-密集模式3640(config)# ip pim rp-address IP_address group_ACL_# [override] ⼿⼯配置RP3640(config)# ip pim send-rp-announce type slot_#/port_# scope ttl_value group-list ACL_# 通告RP组的分配3640(config)# ip pim send-rp-discovery scope ttl_value 配置RP映射代理3640(config-if)# ip multicast ttl-threshold ttl_value 设置TTL门限值3640(config-if)# ip igmp join-group group_address 加⼊组播组3640# show ip mroute 查看组播信息3640# ping 验证RP之间或其他组播路由器之间的连接3640# mtrace source_IP_address [destination_IP_address] [group] 组播traceroute3640(config-if)# ip cgmp 配置CGMP路由器4000>(enable) set cgmp enable 启动CGMP4000>(enable) show cgmp statistics 查看CGMP统计信息4000>(enable) show multicast group cgmp 查看交换机了解到的组播组信息4000>(enable) set cgmp leave enable 检查由客户端产⽣的IGMPv2的离开信息4000>(enable) set igmp enable 启动IGMP4000>(enable) ip igmp snooping 启动IGMP探听4000>(enable) set igmp fastleave enable 启动快速离开过程4000>(enable) show igmp statistics 显⽰交换机上IGMP探听的状态信息QoS 2950(config)# wrr-queue cos-map queue_ID cos_value 建⽴队列2950(config)# wrr-queue bandwidth bandwidth_value 设置队列门限2950(config)# class-maps name 定义对信息传输分类时的匹配标准2950(config-cmap)# match access-group ACL_# 识别被分类的信息传输2950(config)# policy-map name 确定为接⼊信息传输所设置的分类标准2950(config-pmap)# class name2950(config-pmap-c)# set ip dscp number2950(config-if)# service-policy input name 对该接⼝应⽤策略3550(config)# mls qos 启动QoS3550(config-if)# auto qos voip 在接⼝上启动⾃动服务质量3550(config)# priority-list priority_queue_# protocol protocol high|medium|normal|low [list ACL_#] 为优先级队列定义信息流3550(config)# priority-list priority_queue_# queue-limit limit_# 定义特定优先级队列的最⼤队列空间3550(config-if)# priority-group priority_queue_# 向特定输出接⼝分配优先级队列3550(config)# queue-list queue_list_# interface type slot_#/port_# queue_number 为⼀个特定的定制队列定义信息流3550(config)# queue-list queue_list_# queue queue_number byte-count size_in_bytes [limit number_of_queue] 为特定的定制队列定义队列的最⼤空间3550(config-if)# custom-queue-list custom_queue_number 为特定的输出接⼝分配优先级队列4840(config)# ip slb serverfarm serverfarm_name 配置SLB冗余4840(config-slb-sfarm)# real IP_address [port_#] 指定虚拟IP地址4840(config-slb-sfarm)# inservice 启动服务器4840(config)# virtual IP_address [network_mask] tcp|udp [port_number|wsp|wsp-wtp|wsp-wtls|wsp-wtp-wtls] [service service_name] 建⽴虚拟服务器IP地址h。
(整理)思科交换机配置命令

switch(config-if)#sw a v 30
switch(config-if)#switchport access vlan 30
24
验证VLAN配置信息
验证VLAN配置信息
switch#sh vlan b
switch#show vlan brief
switch(config)#ip default-gateway 192.168.0.1
16
查看交换机的MAC地址表
查看交换机的MAC地址表
switch#sh mac-a
switch#show mac-address-table
17
查看思科交换机相邻设备的详细信息
查看思科交换机相邻设备的详细信息
switch#sh cdp nei de
benet(config)#
7
配置进入特权模式的明文口令
配置进入特权模式的明文口令
switch(config)#en pass 123
switch(config)#enable password 123
8
删除进入特权模式的明文口令
删除进入特权模式的明文口令
switch(config)#no ena pass
30
验证接口模式(检查中断端口允许的VLAN列表)
验证接口模式(检查中断端口允许的VLAN列表)
switch#sh int f0/15 switchp
switch#show interface f0/15 switchport
31
查看用过的命令
查看用过的命令
switch#sh hi
switch#show history
思科三层交换机配置命令

思科三层交换机配置命令1. 交换机支持的命令:交换机基本状态:switch: ;ROM状态,路由器是rommon> hostname> ;用户模式hostname# ;特权模式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 ;查看指定端口信息补充:3层交换机多出的就是路由能力,体现在vlan的互相通信功能和端口的路由能力,下面介绍:开启路由功能:ip routing进入vlan 配置网段网关与路由配置接口相同interface vlan 1ip 192.168.1.1 255.255.255.0路由配置与路由器配置相同只是把接口换为VLAN+VLAN 号,开启接口路由功能,进入接口配置:no swichport。
思科三层交换机配置

思科三层交换机配置思科三层交换机配置为解决vlan间的路由问题,我们引进三层交换概念,它被大家称为二层交换+三层转发。
三层交换机相当于多个专门处理vlan间路由的多个单臂路由和交换的集成。
三层交换机的转发原理三层交换机通过硬件来交换和路由选择数据包。
为处理数据包的高层信息,三层交换有两种体系结构:1> 传统的MLS(Multilayer Switching)依靠ASIC(Application-Specific Integrated Circuit)对数据流的第一个数据包进行路由处理后,第三层引擎对硬件交换组件进行程序处理为后续数据包提供路由。
产生MLS条目记录,一次路由多次交换。
2> 基于CEF(Cisco Express Forwarding)的MLSCEF是基于拓扑的转发模型,它预先将所有路由信息加入到转发信息库(FIB),方便快速路由。
基本概念有:转发信息库(FIB):类似路由表,记录IP与vlan的对应关系邻接关系表:类似mac地址表,记录相邻接口所连接主机的'mac 地址虚接口:不依赖物理接口的子接口,开启vlan配置网关,属于该vlan的物理接口即可动态充当vlan的网关三层交换机配置三层交换机的接口默认是二层接口,命令switchport 转换为三层接口,相反no switchport将路由接口转为交换接口。
以下面模拟图配置为例。
配置步骤:1>在二层交换机上创建vlan,并分配端口,f0/0端口配置trunk(命令略)2>在三层交换机上创建vlan,并配置trunk指定接口封装方式SW_3L(config)# int f0/0SW_3L(config-if)# switchport trunk encapsulation dot1qSW_3L(config-if)# switchport mode trunk3> 在三层交换机上配置各vlan的ip地址SW_3L(config)# int vlan 10SW_3L(config-if)# ip add 192.168.1.1 255.255.255.0SW_3L(config-if)# no shvlan20和vlan30略4> 三层交换机启用路由,配置接口ipSW_3L(config)# ip routingSW_3L(config)# int f1/0SW_3L(config-if)# no switchportSW_3L(config-if)# ip add 10.1.1.1 255.255.255.248SW_3L(config-if)# no sh5> 为三层交换机配置默认路由SW_3L(config)# ip route 0.0.0.0 0.0.0.0 10.1.1.2经过上面配置,在对客户机设置ip和网关,不同vlan间已经可以正常通信。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
交换机显示命令:
switch#write ;保存配置信息
switch#show vtp ;查看vtp配置信息
switch#show run ;查看当前配置信息
switch#show vlan ;查看vlan配置信息
switch#show interface ;查看端口信息
switch(config)#line console 0 ;进入控制台口
switch(config-line)#line vty 0 4 ;进入虚拟终端
switch(config-line)#login ;允许登录
switch(config-line)#password xx ;设置登录口令xx
switch>enable ;进入特权模式
switch#config terminal ;进入全局配置模式
switch(config)#hostname ;设置交换机的主机名
switch(config)#enable secret xxx ;设置特权加密口令
switch(config)#enable password xxa ;设置特权非密口令
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#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#show int f0/0 ;查看指定端口信息
补充 :
3层交换机多出的就是路由能力,体现在vlan的互相通信功能和端口的路由能力,下面介绍:
开启路由功能:ip routing
进入vlan 配置网段网关与路由配置接口相同
interface vlan 1
ip 192.168.1.1 255.255.255.0
路由配置与路由器配置相同只是把接口换为VLAN+VLAN号,开启接口路由功能,进入接口配置:no swichport
1. 交换机支持的命令:
交换机基本状态:
switch: ;ROM状态, 路由器是rommon>
hostname> ;用户模式
hostname# ;特权模式
hostname(config)# ;全局配置模式
hostname(config-if)# ;接口状态
交换机口令设置:
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 ;设置默认网关