当前位置:首页 » 电脑基础知识

一台3层交换机3台电脑,不在同一VLAN不在同一网段

2009-12-03 10:10 本站整理 浏览(6)

注意事项:1,网关必须设置

2.VLAN 的IP必须设置

拓扑图

Switch(vlan)#vlan 10

VLAN 10 added:

Name: VLAN0010

Switch(vlan)#vlan 20

VLAN 20 added:

Name: VLAN0020

Switch(vlan)#exit

APPLY completed.

Exiting....

Switch#config t

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#int vlan 10

Switch(config-if)#

%LINK-5-CHANGED: Interface Vlan10, changed state to up

Switch(config-if)#ip add

Switch(config-if)#ip address 192.168.1.6 255.255.255.0

Switch(config-if)#no shut

Switch(config-if)#int vlan 20

Switch(config-if)#

%LINK-5-CHANGED: Interface Vlan20, changed state to up

Switch(config-if)#ip add

Switch(config-if)#ip address 192.168.2.6 255.255.255.0

Switch(config-if)#no shut

Switch(config-if)#int f0/1

Switch(config-if)#sw

Switch(config-if)#switchport acc

Switch(config-if)#switchport access vlan 10

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to upSwitch(config-if)#int f0/2

Switch(config-if)#sw

Switch(config-if)#switchport ac

Switch(config-if)#switchport access vlan 20

Switch(config-if)#

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up

Switch(config-if)#int f0/3

Switch(config-if)#sw

Switch(config-if)#switchport ac

Switch(config-if)#switchport access vlan 20

Switch(config-if)#no shut

Switch(config-if)#int f0/1

Switch(config-if)#no shut

Switch(config-if)#int f0/2

Switch(config-if)#no shut

Switch(config-if)#exit

Switch(config)#ip routing

Switch#

PC0的IP 192.168.1.2 255.255.255.0 网关192.168.1.6

PC1的IP192.168.2.2 255.255.255.0网关192.168.2.6

PC2的IP192.168.2.3 255.255.255.0网关192.168.2.6

实验结果都可以PING通本文出自 “feifei3566” 博客,请务必保留此出处http://feifei888.blog.51cto.com/389554/238107