How Do I Set Up and Test VLAN Function

Background: I need to test VLAN function in a server platform, so I need to know the following questions:

  1. What is VLAN?
  2. Why do we need VLAN?
  3. What is VLAN mechanism?
  4. How to enable and test VLAN function?

VLAN Basic Concepts

For the first three questions, you can get the anwsers from reference link, so I don’t plan to talk about it in this article.

How to enable and test VLAN function?

After understanding VLAN basic concepts and mechanism, I can go back to my original question. My original question is to enable and test VLAN function in a server management system.

In this scenario, we used the following steps to test VLAN.

  1. Set static IP address in server side.
  2. Connect server and client A(This client could be Windows or Linux) with network cable directly.
  3. Set static IP address in client A.
  4. Ping each other.
  5. Enable VLAN and set VLAN ID in server side.
  6. Enable VLAN and set VLAN ID in client A.
  7. Ping each other again.

Step 1: Set static IP address in server side.

There are some server managment interfaces used to set static IP address or you can use ifconfig command to do it.

ifconfig command as below:

ifconfig <interface> <IP Address> netmask <Subnet Mask> up

route add default gw <Gateway address>

For instance:

ifconfig dev0 10.211.138.50 netmask 255.255.254.0 up

route add default gw 10.211.138.1

Step 2: Connect server and client A(This client could be Windows or Linux) with network cable directly.

Step 3: Set static IP address in client A.

Do the same thing as step 1, what we need to pay attention to is make them in the same subnet. We can set the static IP address as below.

ifconfig np5s0 10.211.138.55 netmask 255.255.254.0 up

route add default gw 10.211.138.1

Note: Maybe there are more than one network interface in your client, make sure use the one plugged.

Step 4: Ping each other.

If you have already set static IP address both server and client correctly, they can ping each other successfully.

Step 5: Enable VLAN and set VLAN ID in server side.

It has its specific method to set VLAN in server management system side. After setting VLAN ID(such as 2000, this value should be > 0 && < 4096) and priority, there is another network interface dev0.2000 will be created, which has the same static IP address(10.211.138.50) with dev0 and dev0 interface will lost the IP address in my server platform. You don’t need to refer to this behavior because it is a specific server management interface in my side.

Step 6: Enable VLAN and set VLAN ID in client A.

In client side, my client is a Ubuntu system. You can access this offcial website to know how to do it. Now I set a static IP address(10.211.138.60) for np5s0.2000 interface.

Step 7: Ping each other again.

In client side, run “ping 10.211.138.50” command to check if it can access server successfully.

In server side, run “ping 10.211.138.60” command to check if it can access client successfully.

If they can ping each other successfully, it means the VLAN function works well.

Have a good day.

If you have any feedback, please let me know and thank you so much.

Reference:

  1. https://www.computernetworkingnotes.com/ccna-study-guide/vlan-basic-concepts-explained-with-examples.html
  2. https://zhuanlan.zhihu.com/p/35616289
Share this article to your social media
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments