Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ DietPi-Config | Allow network drop-in configs via /etc/network/interfaces.d, which e.g. allows to add VLANs, multiple network adapters and such without DietPi-Config destroying it. Future idea is to use this ourself to allow easier adding/removal/adjusting of single interface settings instead of scraping and rewriting the whole interfaces file.
- Loading branch information
aa4a36f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very nice! but not really following how it works. You just create a file with lets say
iface eth0.300 inet dhcp
in /etc/network/interfaces.d?
can you explain how to setup a "drop-in"?
aa4a36f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@1985kasper
Jep exactly this should be possible. The drop-in config syntax follows exactly the one for the main config. Image the drop-in content to be copied just as-is into the main config when being parsed.
I am currently only not 100% sure about conflicts with
iface eth0 inet dhcp
that is generated byDietPi-Config
. In case you need to comment that part.And also I am not sure if the order is relevant, e.g.
iface eth0 inet dhcp
needs to be defined in front of the VLANs or such? With a future patch I want to move DietPi-Config settings into the drop-in dir as well. And when a certain interface (Ethernet or WiFi) is disabled, this config will be removed completely. So when you need a customised network setup, you can simply disable all interfaces indietpi-config
and add your own instead. Using DietPi-Config should then feel more like an "offer" than like what is required or expected.aa4a36f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
figured it out :-) never used this before but it's pretty nice
add to /etc/network/interfaces:
source interfaces.d/interfacename.cfg
create interfacename.cfg in /etc/network/interfaces.d. Example:
iface eth0.300 inet dhcp
ifup eth0.300
Very nice!
aa4a36f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@1985kasper
source interfaces.d/*
loads all files automatically, using the asterisk as wildcard. If this did not work already, then perhaps indeed the order is relevant for VLANs, e.g. source being after the main interface declaration.aa4a36f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MichaIng Only thing i notice now is the interfaces in /etc/network/interfaces.d are not persistent across boots. Is this on purpose?
aa4a36f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@1985kasper
You mean the directory is cleared or the interfaces are simply not loaded on boot, but can be e.g. via
ifup eth0.300
?Basically it should not make any difference it you add directives via drop-in files or directly to /etc/network/interfaces. Both should behave exactly the same.
aa4a36f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have to run ifup after a reboot
aa4a36f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@1985kasper
Does your drop-in contain
allow-hotplug eth0.300
orauto eth0.300
? Not sure if this required for VLANs?Otherwise could you try moving
source interfaces.d/*
to the end of the file? Possiblyeth0
needs to be placed in front ofeth0.300
.aa4a36f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point regarding the auto/hotplug I will try both tomorow. :-) thanks!