#520417 Remove need of 'sed' from /etc/network/*.d/vlan and consolidate to one script

#520417#5
Date:
2009-03-19 14:54:08 UTC
From:
To:
I was reviewing the /etc/network/*.d/vlan scripts to write an
ip-vlan script to allow the same thing to be done entirely with
'ip' and I found a few anomalies

1) Doesn't handle arbitrarily named raw devices.
2) Doesn't catch the typo of padded vlan ID (IE eth0.01)
3) Extensive use of sed when ${VARIABLE%pattern} and ${VARIABLE#pattern}
would suffice.
4) A fair amount of 'repeat yourself'

Attached is one rewritten 'vlan' that is to be placed  in
/etc/network/if-pre-up.d and a symlink to ../pre-up.d/vlan should be
placed in /etc/network/if-post-down.d

Attached as the patch is the rewritten vlan script.

#520417#10
Date:
2009-03-19 15:38:03 UTC
From:
To:

Remove
if [ -n "$IF_VLAN_VLANID" ]; then
  VLANID="$IF_VLAN_VLANID"
fi

It makes sense for the script for iproute2, but not
for vconfig.

#520417#15
Date:
2012-06-24 20:43:19 UTC
From:
To:
I ran into a problem with the vlan if-pre-up.d script that is mentioned in
this bug.

I've renamed an interface on my firewall like so:

$ grep inside /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", \
ATTR{address}=="00:a0:c9:c5:33:f2", ATTR{dev_id}=="0x0", \
ATTR{type}=="1", KERNEL=="eth*", NAME="eth-inside"

When attempting to configure and entry in /etc/network/interfaces, such as:

auto eth-inside.4
iface eth-inside.4 inet static
         address 192.168.4.1
         network 192.168.4.0
         netmask 255.255.255.0
         broadcast 192.168.4.255
         vlan-raw-device eth-inside

The vlan script fails to create the vlan subinterface.

A work around is:

auto eth-inside.4
iface eth-inside.4 inet static
         address 192.168.4.1
         network 192.168.4.0
         netmask 255.255.255.0
         broadcast 192.168.4.255
         pre-up vconfig add eth-inside 4

#520417#20
Date:
2013-10-10 07:51:47 UTC
From:
To:
Hello,

Maybe I'm wrong, but it looks like the /etc/network/*.d/vlan conflicts
with normal behaviour of ifup/ifdown in wheezy.
The script ifup/ifdown already use "ip link" to configure and create vlan.

Configuration file /etc/network/interfaces
auto bond2.341
iface bond2.341 inet static
        address 192.168.1.1
        netmask 255.255.255.0

With VLAN package installed:

# ifconfig bond2.341
bond2.341: error fetching interface information: Device not found

# ifup bond2.341
Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config
ERROR: trying to add VLAN #341 to IF -:bond2:-  error: File exists

# ifconfig bond2.341
bond2.341 Link encap:Ethernet  HWaddr 00:10:18:f0:88:b8
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::210:18ff:fef0:88b8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:398 (398.0 B)

# ifdown bond2.341
Removed VLAN -:bond2.341:-
Cannot find device "bond2.341"

# ifconfig bond2.341
bond2.341: error fetching interface information: Device not found


Without VLAN package:

# dpkg -P vlan
Removing vlan ...
Purging configuration files for vlan ...

# ifup bond2.341

# ifconfig bond2.341
bond2.341 Link encap:Ethernet  HWaddr 00:10:18:f0:88:b8
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::210:18ff:fef0:88b8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:398 (398.0 B)

# ifdown bond2.341

# ifconfig bond2.341
bond2.341: error fetching interface information: Device not found

The scripts /etc/network/*.d/vlan should be modified or removed ?

On the web site of the author
http://www.candelatech.com/~greear/vlan.html
<http://www.candelatech.com/%7Egreear/vlan.html>  it's written : "802.1Q
VLAN code is now part of the official kernel, and has been for years and
years. MAC-VLAN code has been added since around 2.6.29. It is very
unlikely that you need to download anything from this site, the packages
are left here for posterity's sake."

Thanks.

#520417#25
Date:
2013-10-10 08:49:22 UTC
From:
To:
Hi,

I think you are quite correct.
I need to find me a sponsor again.
The actual plan was to phase out the vlan package, but the vlan
package itself has some nice things to modify
/proc/sys/net/*/conf/${IFACE}/* settings.
Next to that I think macvlan configuration is not in ifupdown
yet. I will have a look at that.

The vconfig binary is obsolete and is not available in my local
builds.