named vlan interfaces

This simple snippet allows creating vlan interfaces with custom names
on debian/ubuntu. Add the following to /etc/network/if-pre-up.d/blink:


#!/bin/sh

if [ -n "$IF_VLAN_RAW_DEVICE" ] && [ -n "IF_VLAN_ID" ]; then
        vconfig set_name_type VLAN_PLUS_VID_NO_PAD
        vconfig add $IF_VLAN_RAW_DEVICE $IF_VLAN_ID
        ip link set vlan$IF_VLAN_ID name $IFACE
fi

This will allow entries like this in /etc/network/interfaces:


iface management inet static
        address 192.168.3.2
        netmask 255.255.255.0
        vlan-raw-device intern
        vlan-id 3

intern is a network interface which is renamed using the regular /etc/iftab.

Leave a Reply

Powered by WP Hashcash