1. First create a VLAN
Switch> enable to enter System Mode
Switch # configure terminal enters the configuration status
Switch (config) # create a VLAN 2
Switch (config-VLAN) # name jisuanji: jisuanji
Interface range fastethernet0/1-10 Select Port 1-10
Switchport access VLAN 2 adds Port 1-10 to V2.
/*
No VLAN 10 Delete VLAN 10
Delete a port from a VLAN:
Interface range fasetethernet0/0/100 // starting
No switchport access VLAN 100 // Delete
*/
In the LAN. A lan can be divided into several VLANs (Virtual LAN). Generally, there are three methods:
1. By Port
2. By IP Address
3. By user
The above is divided by port. Only two computers in the same virtual LAN can communicate.
Example:
There is a LAN 192.168.1.1-192.168.1.254
It is now divided into three VLANs
Vlan1 default
Vlan2 jisuanijixi
Vlan3 yishuxi
VLAN4 shenghuaxi
Each VLAN has two PCs whose IP addresses are:
Vlan2:
192.168.1.1
192.168.1.2
Vlan3:
192.168.1.101
192.168.1.102
VLAN4:
192.168.1.201
192.168.1.202
Before establishing a VLAN, all the computers in the LAN can communicate with each other. However, after establishing a VLAN, we can see that only
The two PCs can communicate with each other, but the computers in the outer VLAN cannot communicate.
Packets sent by the PC in a VLAN network are as follows:
1. The PC first checks whether the ARP table has a MAC address of the target PC. If yes, the PC sends an ICMP packet directly.
Then, use ARP to send the ARP packet
2. Send the ARP packet to the switch. The switch records the IP address and MAC address of the source PC.
Then it is directly forwarded to the target PC. If yes, record the ing between the MAC address and the IP address, write it to the MAC address table of the switch, and set its ARP
Packets are broadcast to all the PCs with the same VLAN.
3. If a PC receives an ARP packet, compare the IP address in the packet with its own IP address. If the packet is the same, encapsulate the MAC address.
Return to the source PC in the ARP packet. If they are inconsistent, discard
4. If you know the MAC address in the Peer PC, the ICMP packet will pass.
This is the ARP and ICMP protocols in the General Lan, but they are actually the same in the VLAN. A little different
VLAN reduces the number of broadcasts and divides a LAN into several small ones.
These small LAN networks cannot communicate with each other. When forwarding packets, ARP broadcasts the packets to its own VLAN instead of other VLANs.
No communication
Note: If the LAN is divided by VLAN, data transmission only recognizes whether it is the same VLAN.
Communication. If not, communication is not allowed, even if two PCs are in the same switch,
If they are not in the same VLAN, they cannot communicate. If they are in the same VLAN
Not in the same switch, they can communicate
(This is only the conclusion of the experiment. It is not necessarily correct. If there is any error, please point it out. Thank you)