Switch/VLAN

The switch built-in into the most WLAN routers is capable of separating each port using VLAN tagging. You can configure the switch by simply adding the interface to the config file and giving the desired switch-ports (FIXME):
[label=\file{/etc/network/interfaces}]
auto eth0.0
iface eth0.0 inet static
    switch-ports 1 2 5*
    address 192.168.1.1
    netmask 255.255.255.0

auto eth0.1
iface eth0.1 inet static
    switch-ports  3 4 5
    address 192.168.2.1
    netmask 255.255.255.0

auto eth0.2
iface eth0.2 inet static
    switch-ports 0 5
    address 172.16.1.42
    netmask 255.255.255.0
    gateway 172.16.1.1

This configures three VLAN interfaces eth0.0 on ports 1 and 2, eth0.1 on port 3 and 4 and eth0.2 on port 0.

If you need to do some advanced settings, because you have for example a powerful switch with a VLAN trunking port connected to one of your switch ports, the configuration would look like this:

[label=\file{/etc/network/interfaces}]
auto eth0.1
iface eth0.1 inet static
    switch-ports 2 3 4 5*
    address 192.168.1.1
    netmask 255.255.255.0

auto eth0.2
iface eth0.2 inet static
    switch-ports 1t 5
    address 10.2.0.1
    netmask 255.255.255.0
    broadcast +

auto eth0.3
iface eth0.3 inet static
    switch-ports 1t 5
    address 10.3.0.1
    netmask 255.255.255.0
    broadcast +

auto eth0.4
iface eth0.4 inet static
    switch-ports 1t 5
    address 10.4.0.1
    netmask 255.255.255.0
    broadcast +

This configures four VLAN interfaces, eth0.1 on physical ports 2, 3 and 4. The interfaces eth0.2, eth0.3 and eth0.4 are three different networks with VLAN ID 2–4. The physical port 1 needs to be connected to a VLAN trunking port on a switch with knows the same VLAN IDs.

Explanation:

port 0
this is typically the port labeled as WAN
port 1–4
these are typically the ports labeled as LAN
port 5
this special port represents the port where the router–board is connected to the switch
*
one interface always need an asterisk behind port 5 which means it is the default interface and gets all the packages with unknown tags.