思科交换机划分Vlan

一、打开Cisco Packet Tracer

1.创建PC0,PC1,PC2,PC3和一台交换机,并用直通线连接

PC0---交换机fa0/1

PC1--交换机fa0/2

PC2---交换机fa0/3

PC3--交换机fa0/4

二、.进入交换机CLI

1.进入特权模式

Switch>enable
Switch#

2.进入配置模式

Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.

3.分别创建两个vlan (10,20)

Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#ex

4.配置fa0/1,fa0/2 并加入vlan 10

Switch(config)#int fa0/1
Switch(config-if)#switchport mode access
Switch(config-if)#sw acc vlan 10
Switch(config-if)#no sh
Switch(config-if)#ex
Switch(config)#int
Switch(config)#int fa0/2
Switch(config-if)#switchport mode access 
Switch(config-if)#sw acc vlan 10
Switch(config-if)#no sh
Switch(config-if)#ex

5.配置fa0/3,fa0/4加入vlan20

Switch(config)#int fa0/3
Switch(config-if)#switchport mode access 
Switch(config-if)#sw acc vlan 20
Switch(config-if)#no sh
Switch(config-if)#ex
Switch(config)#int fa0/4
Switch(config-if)#switchport mode access 
Switch(config-if)#sw acc vlan 20
Switch(config-if)#no sh 
Switch(config-if)#ex

6.配置vlan10,vlan20的ip地址

Switch(config)#int vlan 10
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up

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

Switch(config-if)#ip address 192.168.1.1 255.255.255.0
Switch(config-if)#int vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up

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

Switch(config-if)#ip address 192.168.2.1 255.255.255.0

三、进入PC进行配置

PC0:192.168.1.2 255.255.255.0  网关 192.168.1.1

PC1:192.168.1.3 255.255.255.0 网关 192.168.1.1

PC3:192.168.2.2 255.255.255.0  网关 192.168.2.1

PC4:192168.2.3 255.255.255.0  网关 192.168.2.1

这里只截图一张

四、测试

1.打开PC0控制台

C:\>ipconfig

FastEthernet0 Connection:(default port)

   Link-local IPv6 Address.........: FE80::203:E4FF:FE82:EC5D
   IP Address......................: 192.168.1.2
   Subnet Mask.....................: 255.255.255.0
   Default Gateway.................: 192.168.1.1

Bluetooth Connection:

   Link-local IPv6 Address.........: ::
   IP Address......................: 0.0.0.0
   Subnet Mask.....................: 0.0.0.0
   Default Gateway.................: 0.0.0.0

C:\>ping 192.168.1.3

Pinging 192.168.1.3 with 32 bytes of data:

Reply from 192.168.1.3: bytes=32 time<1ms TTL=128
Reply from 192.168.1.3: bytes=32 time<1ms TTL=128
Reply from 192.168.1.3: bytes=32 time=5ms TTL=128
Reply from 192.168.1.3: bytes=32 time<1ms TTL=128

Ping statistics for 192.168.1.3:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 5ms, Average = 1ms

C:\>ping 192.168.2.1

Pinging 192.168.2.1 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.2.1:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

2.打开PC2控制台

C:\>ipconfig

FastEthernet0 Connection:(default port)

   Link-local IPv6 Address.........: FE80::209:7CFF:FEE3:DAE6
   IP Address......................: 192.168.2.2
   Subnet Mask.....................: 255.255.255.0
   Default Gateway.................: 192.168.2.1

Bluetooth Connection:

   Link-local IPv6 Address.........: ::
   IP Address......................: 0.0.0.0
   Subnet Mask.....................: 0.0.0.0
   Default Gateway.................: 0.0.0.0

C:\>ping 192.168.2.3

Pinging 192.168.2.3 with 32 bytes of data:

Reply from 192.168.2.3: bytes=32 time<1ms TTL=128
Reply from 192.168.2.3: bytes=32 time<1ms TTL=128
Reply from 192.168.2.3: bytes=32 time<1ms TTL=128
Reply from 192.168.2.3: bytes=32 time<1ms TTL=128

Ping statistics for 192.168.2.3:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\>ping 192.168.1.2

Pinging 192.168.1.2 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.1.2:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

C:\>

完毕!个人原创,如有错误欢迎讨论,勿喷!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章