VLAN configuration for linux Nic in virtual deployment (1)

Source: Internet
Author: User
Tags dmesg

VLAN configuration for linux Nic in virtual deployment (1)

This article from Bkjia "Drop water stone Sun Jie" blog, original address: http://xjsunjie.blog.51cto.com/999372/1633815

If the switch port connected to the server has been configured with TRUNK in advance and allows specific VLANs to pass through, the server Nic must be configured with the corresponding VLAN; otherwise, it will fail, this situation is common in virtualization deployment.

For example, in an office environment, the VLAN of the office is 1020. Two 10-Gigabit NICs are deployed on the virtualized physical host, which belong to VLAN 3111 and VLAN 3112. These three VLANs can communicate with each other, how can I configure it?

1. Check whether the Linux kernel supports VLAN:

Current kernel and operating system version:

[root@test ~]# cat /etc/redhat-releaseRed Hat Enterprise Linux Server release 6.5 (Santiago)

First, install vconfig in yum.

yum install vconfig

Check whether the core provides VLAN functions for execution

Dmesg | grep-I 802 [root @ test] # dmesg | grep-I 802802.1Q VLAN Support v1.8 Ben Greear [root @ test] # modprobe 8021q [root @ test ~] # Lsmod | grep 8021q // check whether the system kernel supports the 802.1q Protocol
8021q 18633 0
[Root @ test ~] # Lspci // check whether the NIC Driver is loaded properly
00:00. 0 Host bridge: Intel Corporation release BX/ZX/DX-release 43bx/ZX/DX Host bridge (rev 01)
00:01. 0 PCI bridge: Intel Corporation platinum BX/ZX/DX-Sort 43bx/ZX/dx agp bridge (rev 01)
00:07. 0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
00:07. 1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07. 3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:07. 7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
00: 0f. 0 VGA compatible controller: VMware svga ii Adapter
00:11. 0 PCI bridge: VMware PCI bridge (rev 02)
00:15. 0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15. 1 PCI bridge: VMware PCI Express Root Port (rev 01)
. 2 PCI bridge: VMware PCI Express Root Port (rev 01)

2. Relationship between physical Nic, sub Nic, and virtual vlan nic:

1. physical NIC: Physical Nic refers to the actual network interface device on the server. It can be seen in the system. For example, the two physical NICs correspond to the network interfaces eth0 and eth1 respectively.

2. Sub-NIC: the sub-nic is not actually a network interface device, but can appear in the system as a network interface, such as eth0: 1 and eth1: 2. They must depend on physical NICs. Although they can coexist with the network interfaces of physical NICs and use different IP addresses in the system, they also have their own network interface configuration files. However, when the dependent physical Nic is not enabled (Down), these sub-nics cannot work together.

3. virtual vlan nic: these virtual VLAN NICs are not actually network interface devices. They can also be used as network interfaces in the system. However, unlike the sub-nic, they do not have their own configuration files. They only generate VLAN virtual NICs by adding physical networks to different VLANs. If you add a physical Nic to multiple VLANs, multiple VLAN virtual NICS will appear, their information and related VLAN information are stored in the temporary file/proc/net/vlan/config, and there is no independent configuration file. Their network interface names are eth0.1 and eth1.2.

Note: When you need to enable VLAN virtual NICs, the associated physical Nic network interface must have no IP address configuration information.

[root@test ~]# vi/etc/sysconfig/network-scripts/ifcfg-eth1————————————————–DEVICE=eth1ONBOOT=yesBOOTPROTO=static

Set static addresses and do not set IP addresses.


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.