A physical network card is virtualized into two virtual network cards (using VLAN method slicing) using the steps of the operation:
Pre-planning Preparation:
ETH1 Network card Normal use
ETH1 The switch port configuration trunk allow vlan5 and public required Vlanid (if 2)
Example: If Eth1 made two virtual network cards, one as a storage network card as eth1.5, and the other external network card is eth1.2
1. Load 802.1q Module
[[email protected] net]# modprobe 8021q---load 8021q
[[email protected] net]# lsmod |grep 8021q---Check if 802.1q protocol is supported
8021q 28808 0
Garp 14384 1 8021q
MRP 18542 1 8021q
[[email protected] net]# cat >/etc/sysconfig/modules/8021q.modules << EOF---Boot automatically hangs on 8021q module
#!/bin/sh
if [! ' lsmod | grep 8021q ']; Then
Exec/sbin/modprobe 8021q >/dev/null 2>&1
Fi
Eof
2. Virtual NIC configuration VLAN
Storage network directly go vlan5, public network is vlan2
Vi/etc/sysconfig/network-scripts/ifcfg-eth1
Device=eth1
Onboot=yes
Bootproto=static
3. Configure VLAN virtual network card devices
A. Storing the virtual network card
[email protected] net]#cd/etc/sysconfig/network-scripts/
[email protected] net]#CP ifcfg-eth1 ifcfg-eth1.5
[Email protected] net]# VI ifcfg-eth1.5
device=eth1.5
Type=ethernet
Bootproto=static
Onboot=yes
ipaddr=192.168.10.1---storage network using IP
Prefix=24
Vlan=yes---Ensure that when the network starts, check that the virtual network card has not been started
B. Public network Virtual network card
[[Email protected] NET] #cd/etc/sysconfig/network-scripts/
[[Email protected] NET] #cp ifcfg-eth1 ifcfg-eth1.2
[Email protected] net]# VI ifcfg-eth1.2
device=eth1.2---Public network virtual NIC, eth1.2 represents vlan2 sub-interface, '. ' The number that follows is a couple of VLANs.
Type=ethernet
Bootproto=static
ipaddr=10.10.10.1---public network using IP
Prefix=24
Onboot=yes
Vlan=yes ---Ensure that when the network starts, check that the virtual network card has not been started
4. Restart the Network service restart
A. Check the equipment
[[Email protected] vlan]# IP a---can see a [email protected] and [email protected] network card, indicating a successful configuration
5. Verify that the virtual network card is available
Ping 192.168.10.3 test the other physical servers in the storage network to see if the network can pass
Note: It is best to install vconfig-1.9-16.el7.x86_64.rpm again
This article is from the "Lucky Dog" blog, make sure to keep this source http://703356.blog.51cto.com/693356/1670033
Virtualization of Linux network cards