您的当前位置:首页正文

交换机划分vlan命令

2023-11-08 来源:客趣旅游网


vlan划分命令:交换机划分vlan命令

【网讯网络通信学院】一.中心交换的VLAN配置

(1)激活vlan路由

Switch1#config t

Switch1(config)#ip routing

(2)创建三个VLAN

Switch1#

Switch1#vlan database

Switch1(vlan)#vlan 2

Switch1(vlan)#vlan 3

Switch1(vlan)#vlan 10

Switch1(vlan)#exit

(3)给VLAN分配IP

Switch1#config t

Switch1(config)#config vlan2

Switch1(config-if)#ip address 192.168.2.1 255.255.255.0

Switch1(config-if)#no shutdown

Switch1#config t

Switch1(config)#config vlan3

Switch1(config-if)#ip address 192.168.3.1 255.255.255.0

Switch1(config-if)#no shutdown

Switch1#config t

Switch1(config)#config vlan10

Switch1(config-if)#ip address 192.168.10.1 255.255.255.0

Switch1(config-if)#no shutdown

(4)配VTP

Switch1#

Switch1#config t

Switch1(config)#vtp domain china_mobile

Switch1(config)#vtp mode server

Switch1(config)#end

(5)配Trunk

Switch1#

Switch1#config t

Switch1(config)#interface gigabitethernet0/1

Switch1(config-if)#switchport trunk encapsulation isl

Switch1(config-if)#switchport mode trunk

Switch1(config-if)#end

(6)给中心交换机通往路由器的接口配IP

Switch1#

Switch1#config t

Switch1(config)#interface fastethernet0/1

Switch1(config-if)#no switchport

Switch1(config-if)#ip address 200.1.1.1 255.255.255.0

Switch1(config-if)#no shutdown

(7)给中心交换机配置缺省路由

Switch1#

Switch1#config t

Switch(config)#ip route 0.0.0.0 0.0.0.0 200.1.1.2

(8)把VLAN号分配给IP接口

Switch1#

Switch1#config t

Switch1(config)#interface fastethernet0/2

Switch1(config-if)#switchport mode Access

Switch1(config-if)#switchport access vlan2

Switch1(config-if)#spanning-tree portfast

… …

Switch1#

Switch1#config t

Switch1(config)#interface fastethernet0/13

Switch1(config-if)#switchport mode access

Switch1(config-if)#switchport access vlan3

Switch1(config-if)#spanning-tree portfast

(其它同)

(9)配访问控制列表ACL禁VLAN3子网的客户机访问服务器

Switch1#

Switch1#config t

Switch1(config)#access-list 1 deny 192.168.3.0 0.0.0.255

Switch1(config)#access-list 1 permit any

Switch1(config)#interface fastethernet0/13 (此接口接服务器)

Switch1(config-if)#ip access-group 1 out

(10)检查上述配置

Switch1#show vlan

Switch1#show ip route

Switch1#show interface gigabitethernet0/1 switchport

Switch1#show run

Switch1#show vtp status

(11)存配置

Switch1#copy running-config startup-config

二.在接入层交换机Swith2上VLAN的配置

(1)配TRUNK

Switch2#

Swtich2#config t

Switch2(config)#interface gigabitethernet0/1

Switch2(config-if)#switchport trunk encapsulation isl

Switch2(config-if)#switchport mode trunk

Switch2(config-if)#end

Switch2#

Swtich2#config t

Switch2(config)#interface gigabitethernet0/2

Switch2(config-if)#switchport trunk encapsulation isl

Switch2(config-if)#switchport mode trunk

Switch2(config-if)#end

(2)配VTP

Switch2#

Switch2#config t

Switch2(config)#vtp mode client

Switch2(config)#vtp domain china_mobile

Switch2(config)#end

(3)给接口分配VLAN号

Switch2#

Switch2#config t

Switch2(config)#interface fastethernet0/1

Switch2(config-if)#switchport mode access

Switch2(config-if)#switchport access vlan2

Switch2(config-if)#spanning-tree portfast

… …

(其它端口配置同)

(4)存配置

Switch2#copy running-config startup-config

(其它交换机同)

因篇幅问题不能全部显示,请点此查看更多更全内容