Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Configure switch VLAN

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Problems with LAN:

A LAN belongs to a broadcast domain, in which the network device-switch

While realizing the interconnection of end devices, you can isolate the collision domain, but not

Isolate the broadcast domain.

Solution:

VLAN-Virtual Local area Network, virtual lan

The isolation of broadcast domain is realized by VLAN technology on the switch.

In common with LAN:

1. Devices in the same VLAN all belong to the same network segment

2. Any VLAN belongs to a broadcast domain

Goal:

PC1 and PC2 can be connected, PC3 and PC4 can be connected. But 1 and 3, 1 and 4, 2 and 3, 2 and 4 are not connected.

PC1:192.168.1.1 / 24 PC2:192.168.1.2 / 24

PC3:192.168.1.3 / 24 PC4:192.168.1.4 / 24

How to configure VLAN?

Train of thought:

Create VLAN, assign ports, verify configuration, test connectivity

1. Create a VLAN

Switch > enable enters privileged mode

Switch#config terminal enters global configuration mode

Switch (config) # no ipdomain lookup turns off the domain name query function

Switch (config) # hostname SW1

SW1 (config) # vlan 14 / / create VLAN 14

SW1 (config-vlan) # name A / / change the name for VLAN

SW1 (config-vlan) # exit

SW1 (config) # vlan 23 / / create VLAN 23

SW1 (config-vlan) # name B / / change the name for VLAN

SW1 (config-vlan) # exit

2. Put the ports of the switch into different VLAN

SW1 (config) # interface fas0/1

SW1 (config-if) # no shutdown

SW1 (config-if) # switchport mode access / / sets the port mode

SW1 (config-if) # swtichport access vlan 14 / / put the port into vlan 14

SW1 (config) # interface fas0/4

SW1 (config-if) # no shutdown / / Open the port

SW1 (config-if) # switchport mode access / / sets the port mode

SW1 (config-if) # swtichport access vlan 14 / / put the port into vlan 14

SW1 (config) # interface range fas0/2-fas0/3 / / enter multiple ports simultaneously

SW1 (config-if-range) # no shutdown

SW1 (config-if-range) # switchport mode access / / sets the port mode

SW1 (config-if-range) # swtichport access vlan 23 / / put the port into vlan 23

3. Verify the command:

SW1# show vlan brief / / View the VLAN information owned by the switch

4. Test commands:

@ configure the IP address of the same network segment for hosts with different VLAN

@ Test-same VLAN host that can access each other

Different VLAN hosts cannot access each other

How do I delete a VLAN?

1. First remove the member ports of VLAN

SW1 (config) # interface fas0/1

SW1 (config-if) # no switchport access vlan 14

SW1 (config) # interface fas0/4

SW1 (config-if) # no switchport access vlan 14

Delete member ports fas0/1 and fas0/4 from vlan14

At this time, the port should be back to the default vlan 1.

2. Secondly, delete VLAN id

SW1 (config) # no vlan 14

3. Verify:

SW1# show vlan brief

VLAN Port Mode-access/trunk/dynamic

Trunk:

This type of link can carry multiple VLAN traffic at the same time

Each VLAN traffic will be labeled with the corresponding vlan tag (vlan number)

The switch is usually connected using the Trunk port

Configuration commands for Trunk:

SW1 (config) # interface fas0/23

SW1 (config-if) # switchport mode trunk

Verification commands for Trunk:

SW1#show interface trunk / / shows all trunk links on the switch

Access:

This type of link can only belong to one VLAN.

Usually a "non-switch" is connected using the access port

Note:

Final mode of member ports in VLAN:

Access

Trunk

Each port of the switch is in dynamic (dynamic) mode by default

The data sent out by the Trunk link is tagged with vlan

This kind of label can only be recognized by network devices such as switches and routers.

PC is not recognized, so "the port connecting to PC cannot be configured as Trunk"

The data sent out by the Access link is untagged.

There is a special VLAN in Trunk-- native VLAN, local / native VLAN

The traffic in this vlan is untagged; the default value is vlan 1

Therefore

When the Trunk link receives a packet without a label, it is forwarded to the local switch

The member port in the native vlan on the, will not be discarded

Note:

The switch never loses packets.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report