Static and Dynamic vlan configuration code for Switches

Source: Internet
Author: User



For static and dynamic vlan configuration code instances of  switches, there are many methods for configuring vlan of switches. Below is a sample code for vlan configuration of  switches, I hope it will be helpful to the fans. either static or dynamic must be selected, followed by the vlan configuration number of the switch just now.

After configuring the vlan name of a  switch, we need to enter each port to configure the vlan of the  switch. In a vswitch, to enter a port such as port 4th, use the interface Ethernet 0/4. Okay. Combined with the figure above, let's make ports 2, 3, 4, and 5 belong to VLAN2, port 17---22 belongs to VLAN3. The command is the vlan-membership static/dynamic VLAN number. Either static or dynamic must be selected, followed by the vlan configuration number of the  switch. Okay. Let's see the result:
1900 Switch (config) # interface ethernet 0/2
1900 Switch (config-if) # vlan-membership static 2
1900 Switch (config-if) # int e0/3
1900 Switch (config-if) # vlan-membership static 2
1900 Switch (config-if) # int e0/4
1900 Switch (config-if) # vlan-membership static 2
1900 Switch (config-if) # int e0/5
1900 Switch (config-if) # vlan-membership static 2
1900 Switch (config-if) # int e0/17
1900 Switch (config-if) # vlan-membership static 3
......
1900 Switch (config-if) # int e0/22
1900 Switch (config-if) # vlan-membership static 3
1900 Switch (config-if )#

Okay. We have defined all vlan configurations of the switch on the port of the switch. Here, we only configure static data. We will mention dynamic data later. So far, we have configured the  switch vlan for the switch. How is it? It's not as complicated as you think :). To verify our configuration, we use the show vlan command in privileged mode. The output is as follows:
1900 Switch (config) # show vlan
VLAN Name Status Ports
1 default Enabled-16, 22-24, AUI, A, B
2 acconting Enabled 2-5
3 marketing Enabled 17-22
1002 fddi-default suincluded
1003 token-ring-defau Suspended
1004 fddinet-default suincluded
1005 trnet-default suincluded

This is A 24-port switch with AUI and two 100 m ports A and B. We can see that our settings are working properly. What should we do if we want to save the running configure? Of course, no, the switch is saved automatically in real time, so we don't need to use commands to save the settings. Of course, you can also use the show vlan number command to view vlan configurations of A switch, such as show vlan 2 and show vlan 3.

You can also use the show vlan-membership command to display the switch vlan configuration of which each port on the vswitch belongs statically or dynamically. The above is the process of configuring the vlan of the static  switch. Let's take a look at the dynamic vlan configuration of the switch. Dynamic v l a n is easy to form. When the port determines which v l a n it belongs to, dynamic v l a n is formed.

However, this does not mean that the layer remains unchanged. It is just a simple ing, which depends on the database created by the network administrator. After the port allocated to dynamic v l a n is activated, the switch caches the source m a c Address of the initial frame. Then, the switch sends A request to an external server called vmps v l a n management policy server. The v m p s contains A text file, the file contains the m a c Address mapped to v l a n.

The switch downloads the file and verifies the m a c Address in the file. If the m a c address is found in the file list, the switch assigns the port to v l a n in the list. If the m a c address is not in the list, the switch assigns the port to the default v l a n. Assume that the default v l a n is defined ).

If the m a c address is not in the list and the default v l a n is not defined, the port is not activated. This is a very good way to maintain network security. On the surface, dynamic v l a n has many advantages, but it also has A fatal disadvantage, that is, it is very difficult and tedious to create A database.

If there are thousands of workstations on the network, there will be a lot of input work to do. Even if someone is competent for the job, there will be many problems related to dynamic v l a n. In addition, it is time-consuming to keep the database up-to-date. So it is not often used. Here we will not explain it in detail. You can refer to the relevant CISCO documentation.

This is not as complicated as you think. We have already configured the vlan of the switch, so another part of the VLAN should not be ignored is the preliminary network planning. That is to say, which machines are allocated their respective IP addresses, subnet masks, and communication between vlan configurations of  switches in the vlan configuration of a switch. Only after the plan is planned can you easily save trouble in the configuration and future use and maintenance process.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.