2024年4月26日发(作者:)

cisco三层交换机配置命令

比较全面的三层交换机配置实例

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