Set up 802.1q VLANs on SUSE Linux Enterprise Server

This document (3864609) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 10
SUSE Linux Enterprise Server 9
SUSE Linux Enterprise Desktop 10

Situation

Need to set up a 802.1q VLAN on SUSE Linux Enterprise Server so that outgoing packets are tagged with the proper VLAN id.

Resolution

SUSE Linux has great support for VLANs built in by default.

For details on setting up VLANs in SUSE Linux, see the documentation for the vlan package. In particular, read the /usr/src/doc/packages/vlan/README.SuSE file.

Here is an example setup:
 
  • Two SLES10 systems connected to a switch configured with a VLAN ID 20
  • System 1 has IP address 192.168.0.10
  • System 2 has IP address 192.168.0.11

To configure the network on each system for the VLAN, do the following from a terminal as root:
  1. Change directory to /etc/sysconfig/network:
    cd /etc/sysconfig/network
  2. Copy the ifcfg-eth-id- file to create the VLAN configuration file. The name for a VLAN interface configuration file should be in the format ifcfg-vlanNNN, where NNN represents the VLAN ID. For example, to create a VLAN for ID 20, copy the file as follows:
     
    cp ifcfg-eth-id- ifcfg-vlan20
  3. Edit the ifcfg-eth-id- file and comment out the lines that give the interface an IP configuration. e.g.:

    cat ifcfg-eth-id-00\:0c\:29\:36\:69\:1f
    #BOOTPROTO='static'
    #BROADCAST=''
    #ETHTOOL_OPTIONS=''
    #IPADDR='192.168.0.10'
    #MTU=''
    NAME='AMD PCnet - Fast 79c971'
    #NETMASK='255.255.255.0'
    #NETWORK=''
    #REMOTE_IPADDR=''
    STARTMODE='auto'
    UNIQUE='rBUG.weGuQ9YPF'
    #USERCONTROL='no'
    _nm_name='bus-pci-0000:00:11.0'
     
  4. Next edit the ifcfg-vlanNNN file and put in appropriate values for the IP configuration. Also, add VLAN and ETHERDEVICE parameters. For example:

    BOOTPROTO='static'
    BROADCAST=''
    ETHTOOL_OPTIONS=''
    IPADDR='192.168.0.10'
    MTU=''
    NAME='AMD PCnet - Fast 79c971'
    NETMASK='255.255.255.0'
    NETWORK=''
    REMOTE_IPADDR=''
    STARTMODE='auto'
    USERCONTROL='no'
    VLAN='yes'
    ETHERDEVICE='eth0'
     
  5. Restart the network:
    rcnetwork restart
The ouput of ip address show should now include the vlan20 network interface:
...
2: eth0: mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:0c:29:36:69:1f brd ff:ff:ff:ff:ff:ff
inet6 fe80::20c:29ff:fe36:691f/64 scope link
valid_lft forever preferred_lft forever
3: vlan20: mtu 1500 qdisc noqueue
link/ether 00:0c:29:36:69:1f brd ff:ff:ff:ff:ff:ff
inet 192.168.0.10/16 brd 192.168.255.255 scope global vlan20
inet6 fe80::20c:29ff:fe36:691f/64 scope link
valid_lft forever preferred_lft forever
...

Notice that eth0 does not have any inet addresses bound. You can run with addresses on eth0 and the vlan, but that is not covered here.

Perform the same steps on the other system to set up the vlan20 interface with address 192.168.0.11.

When completed, the two machines should be able to ping each other. Additionally, capturing packets between the two systems should show the 802.1q information.  In most cases, tcpdump will not show the 802.1q information.  It is recommended to run the capture on another device using a mirrored port on the switch to best view the packets sent by the server.


 

Additional Information

For more information, see the files under/usr/share/doc/package/vlan/and the manual page forifcfg-vlan (man 5 ifcfg-vlan).

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:3864609
  • Creation Date: 31-May-2007
  • Modified Date:16-Mar-2021
    • SUSE Linux Enterprise Desktop
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center