Do More With Less: 802.1Q VLANs with Voyage Linux - Page 2

By Carla Schroder | Posted Feb 12, 2008
Page 2 of 2   |  Back to Page 1
Print ArticleEmail Article
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn

Permanent VLAN Client Configurations

Previous VLAN Articles

Stuck for a definition? Look it up at Webopedia:
 

Naturally, every danged Linux distribution has its own pet method for configuring network interfaces. A pox on all of them. Fortunately, the majority are either Debian-derivatives or Red Hat offspring, so we can cover a lot of distributions with examples from those two. Your favorite graphical network configurator may not let you do VLANs, so here is how we do it the old-fashioned way.

VLAN Debian

Debian is easy- there is a single configuration file, /etc/network/interfaces. I know, the hot new trend is to take even the simplest configurations and split them among a half-dozen widely-scattered and undocumented configuration files, to maximize unpredictable behavior and user confusion, but fortunately Debian has resisted this trend. So far. This is what a single VLAN interface looks like.

auto eth0
iface eth0 static 0.0.0.0
        up vconfig add eth0 5

auto eth0.5
iface eth0.5 inet dhcp

Or you might want a static address:
auto eth0
iface eth0 static 0.0.0.0
        up vconfig add eth0 5

auto eth0.5
iface eth0.5 inet static
        address 192.168.5.25
        netmask 255.255.255.0
        network 192.168.5.0
        broadcast 192.168.5.255
        gateway 192.168.5.1

You can add as many more as you want on the same interface, and you can use a non-zero address on the base interface if you want.

VLAN Fedora

Red Hat put the B in Byzantine network interface configuration, and Fedora, CentOS, PCLinuxOS, and hordes of others follow suit. This shows a static address. You'll configure two files:

#/etc/sysconfig/network-scripts/ifcfg-eth0
    DEVICE=eth0
    ONBOOT=no
    TYPE=Ethernet

#/etc/sysconfig/network-scripts/ifcfg-eth0.5
    DEVICE=eth0.5
    HWADDR=00:BB:6A:FE:77:EE    
    IPADDR=192.168.5.25
    NETMASK=255.255.255.0
    VLAN=yes
    ONBOOT=yes
    BOOTPROTO=none

This shows how to configure DHCP:

#/etc/sysconfig/network-scripts/ifcfg-eth0.5
    DEVICE=eth0.5
    BOOTPROTO=dhcp
    HWADDR=00:BB:6A:FE:77:EE
    ONBOOT=yes
    TYPE=Ethernet
    VLAN=yes

And don't forget /etc/sysconfig/network, which is where you set the default gateway and other global network information:

     NETWORKING=yes
     HOSTNAME=vlanqueen
     GATEWAY=192.168.5.1
     DOMAINNAME=foobeer.net
     GATEWAYDEV=eth0.5

More Switches! More!

OK then. Now for the final burning basic 802.1Q question: What about adding more switches? Easy. Just plug the suckers together, and remember to uplink them using tagged ports. You can create VLANs that span switches and still use a single router, so check your switch documentation for details. For troubleshooting use ping, mtr, route, and tcpdump or Wireshark.

Resources

Comment and Contribute
(Maximum characters: 1200). You have
characters left.
Get the Latest Scoop with Enterprise Networking Planet Newsletter