DietPi icon indicating copy to clipboard operation
DietPi copied to clipboard

DietPi-Config | VLAN support

Open 1985kasper opened this issue 6 years ago • 17 comments

ADMIN EDIT

Vote for it on FeatHub: https://feathub.com/MichaIng/DietPi/+42


Creating a feature request

Is your feature request related to a problem? Please describe:

  • I use this raspberry to use airplay over multiple vlans. vlans are a great way to segregate IoT devices for example.

Describe the solution you'd like:

  • I can mannually add a vlan. However with every update or change of the networking etc. dietpi overrules the vlan. It would be great to have vlan support natively in the network settings. Something very simple like adding interface eth0.20 would do.

Describe alternatives you've considered:

  • ...

Additional context

  • ...

1985kasper avatar Feb 23 '19 22:02 1985kasper

@1985kasper Thanks for your request.

I have no idea about VLANs actually, since never used it. Could you give an example about how your interfaces file looks like then?

Would it be possible to simply store them inside /etc/network/interfaces.d as drop-in config or do they need to be directly besides/within the eth0 section, as of your example?

MichaIng avatar Feb 23 '19 23:02 MichaIng

The thing is the way i always did it by installing vlan package like here; https://blog.sleeplessbeastie.eu/2012/12/23/debian-how-to-create-vlan-interface/ https://wiki.debian.org/NetworkConfiguration#Howto_use_vlan_.28dot1q.2C_802.1q.2C_trunk.29_.28Etch.2C_Lenny.29 is being deprecated by debian (no idea how long it will take) and i am seeing messages about it moving to ip command. https://wiki.archlinux.org/index.php/VLAN This is the method i use for my use case which is having a airplay receiver on IoT vlan and spotify devices on another vlan: https://chrisreinking.com/need-bonjour-across-vlans-set-up-an-avahi-gateway/

BUT multiple vlan support would also be great since pihole is able to "serve" multiple interfaces with a little workaround. Vlans are handy for lots of things.

1985kasper avatar Feb 24 '19 00:02 1985kasper

@1985kasper Reading: https://manpages.debian.org/stretch/vlan/vlan-interfaces.5.en.html Yeah an interesting feature definitely that could be added natively. We should add source /etc/network/interfaces.d/* to the generated /etc/network/interfaces file as well to allow drop-in config config files. This is easy to apply now, so after DietPi v6.22 release you can add VLANs as drop-in configs.

is being deprecated by debian

Jep due to net-tools (ifconfig, commands being used, which are deprecated an replaced by iproute2 command set.

MichaIng avatar Feb 24 '19 00:02 MichaIng

@MichaIng Thanks! that would be awesome!

1985kasper avatar Feb 24 '19 10:02 1985kasper

please enable these kernel options and release a new version: CONFIG_VLAN_8021Q=m CONFIG_VLAN_8021Q_GVRP=m CONFIG_VLAN_8021Q_MVRP=m

zxp avatar Mar 09 '19 09:03 zxp

@zxp I think in kernel this should be enabled, it is just about the possibility to add those from DietPi-Config menu.

Or do you run a DietPi image where the kernel options are missing? Which device do you use in case? Generally we do no custom kernel coding/creation, so this would be something to forward to the base image devs.

MichaIng avatar Mar 09 '19 19:03 MichaIng

I'm sure the NanoPi NEO2, K1 Plus and SoPine A64 image downloaded at diet.com which kernel don't enabled 8021q support. @MichaIng

zxp avatar Mar 11 '19 06:03 zxp

@zxp Ah okay thanks for the hint in case. So when adding this feature, we must check for kernel support first on the particular device. However setting the kernel parameters is out of our tasks currently, so this is something to forward to ARMbian (in case of Pine64 images) respectively FriendlyARM for NanoPi.

MichaIng avatar Mar 12 '19 14:03 MichaIng

but the official Armbian image for that device indeed has 8021q vlan module support. @MichaIng

zxp avatar Mar 13 '19 06:03 zxp

This has been added to our FeatHub page: https://feathub.com/MichaIng/DietPi/+42

MichaIng avatar Mar 17 '19 13:03 MichaIng

Any news on this? Just lost all VLANs i had setup again on the dietpi box because of the most recent update. It would be at least nice to respect manually setup VLANS when dietpi is updated.

1985kasper avatar Mar 24 '19 12:03 1985kasper

@1985kasper Since VLAN implementation itself will take a while (and testing), for now I will implement drop-in config support. So you can place any any adjustments/additions into /etc/network/interfaces.d/ to survive dietpi-config touches.

Hmm, not sure why the update removed your VLANs actually, since it does not touch interfaces... Only on first boot and when running dietpi-config manually this is the case (or should be). Could you paste your update log: cat /var/tmp/dietpi/logs/dietpi-update.log

MichaIng avatar Mar 24 '19 14:03 MichaIng

Because there is no 8021q vlan module support in some hardware platform DietPi kernel...that's why I commented at here to request add some configs into kernel config. see #issuecomment-471163150

zxp avatar Mar 31 '19 05:03 zxp

@zxp Note that there is no "DietPi" kernel as we do not compile own kernels. Pine64 images have been switched to ARMbian-base so these should have VLAN enabled. In case of NanoPi we anyway have to switch base-image AFAIK since FriendlyARM does not provide Debian images anymore.

MichaIng avatar Mar 31 '19 15:03 MichaIng

@1985kasper Btw. I made a start and added /etc/network/interfaces.d/ drop-in config support: https://github.com/MichaIng/DietPi/commit/aa4a36fd890a0774d68fb9e7118e72af042ac8d4#diff-0e127c4cad3f8401a925d13d05b5ae87 So you can add your custom VLAN interfaces as separate config file to not be overwritten by dietpi-config.

I will slowly migrate dietpi-config to use this for own interface configs as well. This allows a more flexible and less intrusive network adapter/interface handling and is a good basis to add more features like VLAN etc.

MichaIng avatar May 06 '19 22:05 MichaIng

This will come in handy for PiHole when serving more than one network (e.g. guest and main).

Alestrix avatar May 19 '20 00:05 Alestrix

This will come in handy for PiHole when serving more than one network (e.g. guest and main).

Did you figured out an alternative solution that would not collide with dietpi-networking stuff?

hllhll avatar Jun 23 '24 14:06 hllhll