Configuration Guide
VLAN Configuration Guide
9 min
introduction introduction ethernet is a data network communication technology based on csma/cd (carrier sense multiple access/collision detection), which utilizes a shared communication medium when the number of hosts increases, it can lead to severe issues like collisions, broadcast storms, performance degradation, and even network unavailability although using devices to interconnect local area networks (lans) can mitigate collision problems, it still fails to isolate broadcast messages and enhance network quality in response to these challenges, virtual local area network (vlan) technology emerged vlan logically divides a physical lan into multiple broadcast domains, allowing direct communication between hosts within the same vlan while preventing direct communication between different vlans this containment of broadcast messages within their respective vlans improves network isolation and performance explanation of principles explanation of principles interface type interface type different types of interfaces on a device handle vlan tagging differently when forwarding packets based on their vlan tagging behavior, interfaces can be categorized into three types access, trunk, and hybrid interfaces access interface this interface adds the interface's port vlan id (pvid) to untagged incoming packets it only allows tagged packets with vlan ids matching the interface's pvid to pass through outgoing packets from this interface are always untagged, making it suitable for connecting user terminals trunk interface it permits multiple vlan tags to pass through outgoing packets from this interface have no vlan tag if their vlan matches the interface's default vlan other vlans must have a vlan tag trunk interfaces are often used for interconnecting network transmission equipment hybrid interface this interface type is not supported by the current device and is not further described interface default vlan interface default vlan in addition to configuring the vlans allowed to traverse a port, you can also define a default vlan for the port, known as the port vlan id (pvid) when an untagged packet is received on the port, it is assumed to belong to the default vlan for access ports, the default vlan corresponds to the vlan the interface has been configured to join in access mode packet transmission and reception rules packet transmission and reception rules 86,99,248 3099421677446,227 6900578322554#4283c7 unhandled content type #4283c7 2 1 unhandled content type #4283c7 unhandled content type 1 2 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type configuring interface vlan configuring interface vlan true 286,241 07482993197277,133 92517006802723#4283c7 unhandled content type #4283c7 unhandled content type #4283c7 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type display and maintenance display and maintenance true 331,188 62585034013605,141 37414965986395#4283c7 unhandled content type #4283c7 unhandled content type #4283c7 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type unhandled content type unhandled content type unhandled content type configuration example configuration example configuring vlan assignment based on interfaces for intra vlan communication configuring vlan assignment based on interfaces for intra vlan communication network requirements suppose user 1 and user 3 of a company belong to the same department but access the network through different devices, user 2 and user 4 belong to the same department and access the network through different devices but belong to different vlans, where department a uses vlan 100 and department b uses vlan 200 procedure 1 configure device a \# create vlan and add the interface to the vlan sonic(config)# vlan 100 sonic(config)# vlan 200 sonic(config)# interface ethernet 1 sonic(config if 1)# switchport access vlan 200 sonic(config)# interface ethernet 2 sonic(config if 2)# switchport access vlan 100 sonic(config)# interface ethernet 3 sonic(config if 3)# switchport trunk vlan 100 sonic(config if 3)# switchport trunk vlan 200 2 device b and devicea configuration is the same verify configuration 1 user 1 and user 3 can ping each other, but neither can ping user 2 and user 4, and user 2 and user 4 can ping each other, but not user 1 and user 3 2 view vlan configuration information sonic# show vlan summary
