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

How to configure vlan network card under Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces "how to configure vlan network card under Linux". In daily operation, I believe many people have doubts about how to configure vlan network card under Linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to configure vlan network card under Linux". Next, please follow the editor to study!

1. You need to use vconfig software. First yum installs vconfig

The code is as follows:

Yum install vconfig

two。 Check to see if the core provides VLAN function and executes

The code is as follows:

Dmesg | grep-I 802

Check whether it is supported, as shown in the following figure

The code is as follows:

[root@CactiServ] # dmesg | grep-I 802

802.1Q VLAN Support v1.8 Ben Greear

3. Check if the "/ proc/net/vlan" file exists:

The code is as follows:

Ls / proc/net/vlan

If the VLAN function is not provided, the / proc/net/vlan directory does not exist.

If it exists as follows:

The code is as follows:

[root@CactiServ] # ls / proc/net/vlan

Config eth2.100 eth2.25

4. Use the "mod p ro b e" module command to load the "802.1q.o" module, and use the "lsmod" command to verify that the module has been loaded into the core.

The code is as follows:

[root@CactiServ] # modprobe 8021q

[root@CactiServ] # lsmod | grep 8021q

8021q 25493 0

Garp 7152 1 8021q

5. Add subinterfaces using the vconfig command: add subinterfaces with a vlan of 25 and a vlan of 100

The code is as follows:

Vconfig add eth2 25

Vconfig add eth2 100

Then, use the ls command to check the changes in the "/ proc/net/vlan" directory and find that there is an extra file named "eth2.25", and you can use the "ifconfig eth2.25" command to determine whether the VLAN interface exists.

Pay attention to the addition of vlan, and when adding subinterfaces, first make sure that the eth2 port has no ipadd.

6. After the addition, use the cp command to copy the ip address configuration of the interface.

The code is as follows:

Cp ifcfg-eth2 ifcfg-eth2.25

Cp ifcfg-eth2 ifcfg-eth2.100

Then vi to modify the ifcfg-eth2.25 ifcfg-eth2.100 file, set IP address and other information.

7. Finally, restart the network service. Make the configuration effective.

At this point, the study on "how to configure vlan network card under Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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