① 思科三层交换机配置实例及命令
三层交换机是不是经常让你机器不好使,看看下面的三层交换机配置文章,一切问题都能解决。本文详细介绍实例讲解:全面的三层交换机配置比较全面的三层交换机配置实例,带命令解释哟!
三层交换机配置:
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
running-config startup-config 保存配置
② 三层交换机配置及命令解释
三层交换机配置及命令解释
你对详细的命令熟悉了吗?本文详细介绍实例讲解:全面的三层交换机配置比较全面的三层交换机配置实例,带命令解释!
三层交换机配置:
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
running-config startup-config 保存配置
;③ 如何建立VTP
VTP(VLAN Trunking Protocol)
VTP通过网络(ISL帧或cisco私有DTP帧)保持VLAN配置统一性。VTP在系统级管理增加,删除,调整的VLAN,自动地将信息向网络中其它的交换机广播。此外,VTP减小了那些可能导致安全问题的配置。便于管理,只要在vtp server做相应设置,vtp client会自动学习vtp server上的vlan信息
* 当使用多重名字VLAN能变成交叉--连接。
* 当它们是错误地映射在一个和其它局域网,VLAN能变成内部断开。
VTP模式
当交换机是在VTP Server或透明的模式,能在交换机配置VLAN。当交换机配置在VTP Server或透明的模式,使用CLI、控制台菜单、MIB(当使用SNMP简单网络管理协议管理工作站)修改VLAN配置。
一个配置为VTP Server模式的交换机向邻近的交换机广播VLAN配置,通过它的Trunk从邻近的交换机学习新的VLAN配置。在Server模式下可以通过MIB,CLI,或者控制台模式添加、删除和修改VLAN。
例如:增加了一个VLAN,VTP将广播这个新的VLAN,Server和Client机的Trunk网络端口准备接收信息。
在交换机自动转到VTP的Client模式后,它会传送广播信息并从广播中学习新的信息。但是,不能通过MIB、CLI、或者控制台来增加、删除、修改VLAN。VTP Client端不能保持VLAN信息在非易失存储器中。当启动时,它会通过Trunk网络端口接受广播信息,学习配置信息。
在VTP透明的模式,交换不做广播或从网络学习VLAN配置。当一个交换机是在VTP透明的模式,能通过控制台、CLI、MIB来修改、增加、删除VLAN。
为使每一个VLAN能够使用,必须使VTP知道。并且包含在Trunk port 的准许列表中,一个快速以太网ISL Trunk自动为VLAN传输数据,并且从一个交换机到另一个交换机。
需要注意的是如果交换在VTP Server模式接收广播包含128多个VLAN,交换自动地转换向VTP Client模式。
更改交换机从VTP Client模式向VTP透明的模式,交换机保持初始、唯一128VLAN并删除剩余的VLAN。
传送VTP信息
每个交换机用VTP广播Trunk端口的管理域,定义特定的VLAN边界,它的配置修订号,已知VLAN和特定参数。在一个VTP管理域登记后交换机才能工作。
通过Trunk,VTP Server向其它交换机传输信息和接收更新。VTP Server也在NVRAM中保存本VTP管理域信息中 VLAN的列表。 VTP能通过统一的名字和内部的列表动态显示出管理域中的VLAN。
VTP信息在全部Trunk连接上传输,包括ISL、IEEE802.10、LANE。VTP MIB为VTP提供SNMP工具,并允许浏览VTP参数配置。
VTP建立共用的配置值和分布下列的共用的配置信息:
* VLAN IDs(ISL)
* 仿效LAN的名字(ATM LANE)
* IEEE802.10 SAID值(FDDI)
* VLAN中最大的传输单元(MTU)大小
* 帧格式
VTP协议用来确保配置的一致性,VTP的具体优点如下:
。保持了VLAN的一致性
。提供从一个交换机到另一个交换机在整个管理域中增加虚拟局域网的方法
VTP协议是思科的专用协议,大多数的Catalys交换机都支持该协议,VTP可以减少VLAN的相关管理任务。
在VTP域中有两个重要的概念:
。VTP域:也称VLAN管理域,由一个以上共享VTP域名的相互连接的交换机组成的。也就是说VTP域是一组域名相同并通过中继链路相互连接的交换机
。VTP通告:在交换机之间用来传递VLAN信息的数据包被成为VTP数据包
④ 华为三层交换机配置命令
华为三层交换机配置命令
你的三层交换机是不是经常让你机器不好使,看看下面的三层交换机配置文章,一切问题都能解决。详细介绍实例讲解:全面的三层交换机配置比较全面的三层交换机配置实例,带命令解释哟!快来get吧!
三层交换机配置:
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
running-config startup-config 保存配置
;⑤ 1.如何创建vtp管理域 2.划分vlan管理IP地址 3.配置Trunk,封装协议
vtp分为服务器与客户端,还有种角色叫透明代理。创建时所有交换机的VTP
的域名一定要相同。在一般企业中,很少有人使用。
VLAN管理地址,就是给VLAN配个IP地址,在三层交换机中,每个VLAN的地址都是接入终端设备的网关地址。二层中VLAN管理地址就是VLAN
1的地址,只能管理使用。
TRUNK的配置就是把交换机端口改为TRUNK模式,sw
mo
tr
命令即可,默认协议为DOT1Q,无需配置。注意,在两台交换机连接中其中一个是trunk接口那么另一个一定也要配成trunk接口。
⑥ 有VTP配置的简单命令吗
创建VTP 域
switch(config)# vtp domian domain_name
配置交换机的VTP模式
switch(config)# vtp mode server | client | transparent
配置VTP口令
switch(config)# vtp password password
配置VTP修剪
switch(config)# vtp pruning
VTP版本的配置
switch(config)# vtp version 2
查看VTP的配置
switch# show vtp status
⑦ 思科VTP(vlan truck 协议)创建
一、打开思科模拟器,先连接三台交换机(switch2、switch3、switch4)。
二、先配置服务器(switch2)
1、Switch(config)#host server
2、Switch(config)#interface range f0/1-2
3、Switch(config-if-range)#switchport mode truck
三、配置客服端(switch3)
1、Switch(config)#host client
2、Switch(config)#interface f0/1
3、Switch(config-if-range)#switchport mode truck
四、配置透明(switch4)
1、Switch(config)#host transparent
2、Switch(config)#interface f0/1
3、Switch(config-if-range)#switchport mode truck
五、查询vtp状态
show vtp status
六、分别进入两台交换机(switch3、switch4),配置客户端和透明
a、进入switch3
1、Switch(config)#host client
2、client(config)vtp mode client
b、进入switch4
1、Switch(config)#host client
2、client(config)vtp mode transparent
七、分配域名
a、在switch2下分配域名
server(config)#vtp domain ccna
备注:1、vlan同步是互传的,基于版本号,谁版本号大,就听谁的
2、透明模式只透传信息,它本身不发送,也不改变
3、vtp平均五分钟发送一次更新
4、若服务器修改,立刻触发更新
5、client端不能设置,不能修改
⑧ cisco交换机的vlan怎么设置
交换机管理主要通过命令行完成。交换机的命令行操作模式,主要包括:用户模式、特权模式、全局配置模式、端口模式等几种。下面是我给大家带来的cisco交换机的vlan设置方法,希望对您有所帮助!
步骤:
1.首先,安装cisco packet tracer软件,当前的版本应该是到了6点几了,我这边用的是6.0版本的,安装完成之后打开该软件,进入软件配置主界面!
2.接着,我们以cisco交换机3560为例讲述如何创建交换机的vlan。那么下一步就是添加cisco交换机3560了:逐步点击“交换机”分类,然后选择cisco3560交换机,用鼠标拖到工作区间就可以了。
3.然后,单击Cisco交换机3560进入“CLI”界面,输入“enable”命令进入特权配置模式。并输入“vlan database”命令进入vlan配置模式。
4.接着,进入vlan的配置模式后,输入命令“?”,可以查看当前模式下有哪些命令是可以使用的:
exit:退出vlan模式;
no:删除某项vlan配置;
vlan:vlan模式下更深入的配置;
vtp:vlan下面vtp域的配置;
5.然后,我们开始为cisco交换机添加一个vlan 300,那么直接运行命令”vlan 300“即可。
6.接着,我们执行”exit“命令退出vlan配置模式,执行命令”show vlan“在特权模式下查看cisco交换机的所有vlan信息。可以发现交换机已经添加了我们需要的vlan 300。
7.然后,vlan已经添加,但还没有任何交换机的.接口归属于这个vlan,也就是说这个vlan没有任何意义。所以,下一步就是添加一个交换机接口到这个vlan 300。
进入全局配置模式,把Fa0/1接口的模式配置为access,并归属于vlan 300,具体命令为:
Switch(config)#int fa0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 300
8.接着,回到特权模式,执行命令”show vlan“查看当前的vlan配置信息,可以发现,接口Fa0/1已经被划分到了vlan 300。
9.然后,就是配置vlan 300的IP地址信息了,执行命令:
Switch(config)#int vlan 300
Switch(config-if)#ip address 10.10.10.254 255.255.255.0
10.最后,在特权模式下,执行命令”show running-config“查看vlan的相关信息。到这里,整个vlan的配置过程就完成了。
拓展阅读
1.switch(config)#interface vlan 1 进入vlan 1
2.switch(config-if)#ip address 设置IP地址
3.switch(config-if)#ip default-gateway 设置默认网关
4.switch(config)#line vty 0 4 进入虚拟终端
5.switch(config-line)#login 允许登录
6.switch(config-line)#password xx 设置登录口令
7.switch#exit 返回命令
8.Cisco交换机命令之控制台口令
9.switch(config)#line console 0 进入控制台口
10.switch(config-line)#login 允许登录
11.switch(config-line)#password xx 设置登录口令
12.switch#exit 返回命令
13.Cisco交换机命令之基本接口配置
14.switch(config)#interface f0/1 进入f0/1接口
15.switch(config-if)#plex full 配置全双工模式
16.switch(config-if)#speed 100 配置速率
17.switch(config-if)#description to*****接口描述
18.switch(config)#ip domain-name***.com 设置或名服务器
19.switch(config)#mac-address-table aging-time 设置mac表超时时间
20.switch#write 保存配置信息
21.switch# running-config startup-config 保存当前配置nvram
22.switch#erase startup-config 清除配置文件
23.Cisco交换机命令之交换机VLAN设置:
24.#vlan database 进入VLAN设置
25.switch(vlan)#vlan 2 建VLAN 2
26.switch(vlan)#name 名字 建VLAN 2的名称
27.switch(vlan)#no vlan 2 删vlan 2
注:删除vlan时原属于此vlan的端口处于非激活状态,直到重新分配为止。
28.switch(config)#int f0/1 进入端口1
29.switch(config-if)#switchport mode access 当前端口工作莫试
30.switch(config-if)#switchport access vlan 2 当前端口加入vlan 2
31.switch(config-if)#switchport mode trunk 设置为干线
32.switch(config-if)#switchport trunk encapsulation dot1q 设置vlan 中继协议
33.switch(config-if)#no switchport mode 或 ( switchport mode access) 禁用干线
34.switch(config-if)#switchport trunk allowed vlan add 1,2 ; 从Trunk中添加vlans
35.switch(config-if)#switchport trunk allowed vlan remove 1,2 ;从Trunk中删除vlans
36.switch(config-if)#switchport trunk pruning vlan remove 1,2 ;从Trunk中关闭局部修剪
Cisco交换机命令之以太网通道配置
1.switch(config)#interface range fasternet0/1 - 2 将fasternet0/1和0/2 口捆绑
2.switch(config-if)#channel-group 1 mode on 配置以太通道模式
3.switch(config-if)#port-channel load-balance {dst-mac | src-mac}在链路间实现负载均衡
4.switch#show etherchannel 1 summary 查看通道信息
5.switch#show etherchannel load-balance 查看通道信息
6.Cisco交换机命令之vtp配置
7.switch(config)#vtp domain 设置vtp域名
8.switch(config)#vtp password 设置vtp密码
9.switch(config)#vtp mode server 设置vtp服务器模式
10.switch(config)#vtp mode client 设置vtp客户机模式
11switch(config)#vtp mode transparent 设置vtp 透明模式
12.switch(config)#vtp version 设置vtp版本
13.switch(config)#vtp pruning 启用vtp修解
14.switch(config)#no vtp pruning 关闭vtp修解
注:要想从vtp中减少一台交换机只需将该交换机vtp 名更改
Cisco交换机命令之生成树stp:
1.switch(config)#spanning-tree vlan 启用stp生成树(基于vlan)
2.switch(config)#spanning-tree vlan root primary 指定根交换机(基于vlan)
3.switch(config)#spanning-tree vlan root secondary 指定备用根交换机(基于vlan)
4.switch(config)#spanning-tree vlan priority 指定交换机优先级(基于vlan)
5.switch(config)#no spanning-tree vlan priority 将交换机的优先级恢复默认值(基于vlan)
6.switch(config-if)#spanning-tree vlan cost 指定端口成本(起用trunk的端口模式下)
7.switch(config-if)#spanning-tree vlan port-prioty 指定交换机端口优先级(基于vlan)
8.switch(config-if)#spanning-tree portfast 配置速端口(连接终端设备的端口状态)如pc机
9.switch(config)#spanning-tree uplinkfast 配置上行速端口
10.switch(config)#spanning-tree vlan hello-time 配置交换机hello时间(基于vlan)
11.switch(config)#spanning-tree vlan forward-time 修改转发延迟计时器(基于vlan)
12.switch(config)#spanning-tree vlan max-time 修改最大老化时间(基于vlan)
13.switch#show spanning-tree summery 检测vlan生成树配置
14.switch#show spanning-tree vlan detail 浏览详细生成树配置信息
15.switch#show spanning-tree interface detail 浏览详细生成树端口配置信息
16.Cisco交换机命令之交换机显示命令:
17.switch#show vtp status 查看vtp配置信息
18.switch#show running-config 查看当前配置信息
19.switch#show vlan 查看vlan配置信息
20.switch#show interface 查看端口信息
21.switch#show int f0/0 查看指定端口信息
22.switch#dir flash: 查看闪存
23.switch#show version 查看当前版本信息
24.switch#show mac-address-table aging-time 查看mac超时时间
25.switch#show cdp cisco设备发现协议 (可以查看聆接设备)
26.switch#show cdp traffic 杳看接收和发送的cdp包统计信息
27.switch#show cdp neighbors 查看与该设备相邻的cisco设备
28.switch#show interface f0/1 switchport 查看有关switchport的配置
29switch#show cdp neighbors 查看与该设备相邻的cisco设备
⑨ 如何配置VTP
方法/步骤
首先,打开思科模拟器软件,连接三台交换机的连接线,将所有交换机互相连接起来,一台当服务器,一台当客户机,另外一台当透明模式。