1. Connect the eth0 interface of your linux machine to the switch.
2. Remove the IP Address information on the eth0 interface

    # ifconfig eth0 0.0.0.0
    # ifconfig eth0 up

3. Configure 2 VLANs on the eth0 interface using vconfig as follows (100,200 are the VLAN id’s). If the 8021q.o module is not loaded, the vconfig command (when invoked first time) will automatically load the module.

    # vconfig add eth0 100
    # vconfig add eth0 200   

4. Configure IP on the VLAN interfaces

    # ifconfig eth0.100 xxx.xxx.xxx.xxx netmask 255.255.252.0 up
    # ifconfig eth0.200 yyy.yyy.yyy.yyy netmask 255.255.255.0 up

5. Preserve the vlan configuration across reboots by adding it to configuration files. Create the appropriate ifcfg files for eth0, eth0.100 and eth0.200 in /etc/sysconfig/network-scripts/

    # cd /etc/sysconfig/network-scripts/
      
    Contents of ifcfg-eth0
        DEVICE=eth0
        ONBOOT=no
        TYPE=Ethernet
   
    Contents of  ifcfg-eth0.100
        DEVICE=eth0.100
        IPADDR=xxx.xxx.xxx.xxx
        NETMASK=255.255.252.0
        VLAN=yes
        ONBOOT=yes
        BOOTPROTO=none
   
    Contents of ifcfg-eth0.200
        DEVICE=eth0.200
        IPADDR=yyy.yyy.yyy.yyy
        NETMASK=255.255.0.0
        VLAN=yes
        ONBOOT=yes
        BOOTPROTO=none
       
    Update /etc/sysconfig/network file to make the GATEWAYDEV use the public vlan interface.
   
    Contents of /etc/sysconfig/network
        NETWORKING=yes
        HOSTNAME=un1xf00
        GATEWAY=xxx.xxx.xxx.1
        DOMAINNAME=dev.un1xf00.com
        GATEWAYDEV=eth0.100
       
       
6. The VLAN configuration on the server can be verified in the file /proc/net/vlan/config. Sample contents are shown below.
   
        VLAN Dev name    | VLAN ID
        Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
        eth0.100       | 100  | eth0
        eth0.200       | 200  | eth0

0 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like
Read More

Load Average

A very good article on Unix Load averages and how it is calculated [ http://www.linuxjournal.com/article/9001 ] . Worth…