Virtual Interfaces and VLANs in Fedora20

Setting up VLAN interfaces in Fedora20

VLAN is an acronym for Virtual Local Area Network. Several VLANs can co-exist on a single physical switch, which are configured via Linux software and not through hardware interface (you still need to configure actual hardware switch too).

Hardware Device Requirements
• To be able to use VLANs you will need a switch that support the IEEE 802.1q standard on an Ethernet network.
• You will also need a NIC (Network Interface Card) that works with Linux and support 802.1q standard.

Setting Up 802.1q VLAN Tagging

This is based on Fedora documentation, specifically F17-System Administrators Guide .
• First, ensure that the 8021q kernel module is loaded with the following command:
# lsmod | grep 8021q
# modprobe 8021q
is the command to load it if no output results from the grep command above.
• Configure the physical interface by editing the /etc/sysconfig/network-scripts/ifcfg-enp0s25 file, where enp0s25 is the name of the physical interface. The configuration file for the physical interface should look as follows:




• Copy the configuration file of the physical interface to a VLAN interface configuration file by appending a .(period) character and the VLAN ID number to the VLAN interface filename:
∘ # cp /etc/sysconfig/network-scripts/ifcfg-enp0s25{,.5}
creates a new file for our VLAN interface, the ID number of which is 5 within the system-wide network directory mentioned above.
• Edit the VLAN interface configuration file so that it matches the following example:







• Restart the networking service
∘ # systemctl restart NetworkManager.service

If the network router is acting as the DHCP server (sharing a single IP address from the ISP), restarting the networking service as mentioned above might display some messages from the router with a different IP address if it's not configured to provide a static address to the interface.

Method 2: Using the vconfig Command

The vconfig program allows you to create and remove vlan-devices on a vlan-enabled kernel. VLAN-devices are virtual ethernet devices which represent the virtual LANs on the physical LAN. To add a virtual interface with ID number 5, for example, execute:
# vconfig add enp0s25 5

# ifconfig enp0s25.5
will show the newly-created VLAN interface along with its configured parameters.
• The ifconfig command can also be used to directly assign an IP address to the VLAN interface:
∘ # ifconfig enp0s25.5 broadcast up
• To get more detailed information about the interface execute:
∘ # cat /proc/net/vlan/enp0s25

Method 3: ip command for VLANs

∘ # ip link add link enp0s25 name enp0s25.5 type vlan id 5

∘ # ip link

∘ # ip -d link show enp0s25.5
• Once again, as with ifconfig above, assign an IP address to the VLAN interface:
∘ # ip addr add brd dev enp0s25.5

∘ # ip link set dev enp0s25.5 up
• The enp0s25 interface will handle the traffic for both, the VLAN's address as well as its own; however, the VLAN's traffic will be tagged with a VLAN ID tag 5. Only VLAN-aware devices can accept the traffic using VLAN tagging.
• To remove the VLAN tagging from the IP packets, use the following commands:
∘ # ip link set dev enp0s25.5 down

∘ # ip link delete enp0s25.5

Popular posts from this blog

Password Policy in RHEL 7

Centos 7 pulseaudio

Password Aging and Authentication in RHEL7