1 nic Multiple vlans

WINDOWS:
SOURCE: http://www.intel.com/content/www/us/en/support/network-and-i-o/ethernet-products/000005677.html
This can be done using Intel or Broadcom (BACS) driver, but not from Windows itself

Configuring VLANs
– Go to Windows Device Manager
– Open the properties of the port where you want to configure the VLAN
– Go to the VLAN tab
– Click the New button
– Type the VLAN ID number into the VLAN ID box. The IDs configured on the port must also be configured on the switch.
– Accept the VLAN name entered by default or type in a new name.
– Click OK.

LINUX:
SOURCE: http://www.cyberciti.biz/tips/howto-configure-linux-virtual-local-area-network-vlan.html

RHEL/CentOS
Method1
-example we want to create vlan 5
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.5
# cat /etc/sysconfig/network-scripts/ifcfg-eth0.5
DEVICE=eth0.5
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.5
NETMASK=255.255.255.0
USERCTL=no
NETWORK=192.168.1.0
VLAN=yes

# /etc/init.d/network restart
OR
# service network restart

Method2 vconfig
# vconfig add eth0 5
# ifconfig eth0.5 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 up

To get detailed information about VLAN interface, type:
# cat /proc/net/vlan/eth0.5

If you wish to delete VLAN interface use delete command as follows:
# ifconfig eth0.5 down
# vconfig rem eth0.5

Method #3: Create the VLAN device using the ip command
# ip link add link eth0 name eth0.5 type vlan id 5
# ip link
# ip -d link show eth0.5

You need to activate and add an IP address to vlan link, type:
# ip addr add 192.168.1.200/24 brd 192.168.1.255 dev eth0.5
# ip link set dev eth0.5 up

How can I remove VLAN ID 5?
# ip link set dev eth0.5 down
# ip link delete eth0.5

Debian/Ubuntu
# cat /etc/network/interfaces
auto eth0.5
iface eth0.5 inet static
address 192.168.1.200
netmask 255.255.255.0
vlan-raw-device eth0

# /etc/init.d/networking restart

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s