1

I'm trying to figure out best way to control network settings in best way possible in real time.

My current plan is this:

  • Start ip -s -d -o monitor with systemd and write its output to file generated with mkfifo or write tiny script which outputs to tcp socket 127.0.0.1:<some port>
  • Write shell script which reads the file/socket and generate systemd network config files on the fly if there are changes and of course use other commands to read additional data for systemd configuration depending of the change

This way you can use ip <cmd> command to change network settings in real time and also you can write systemd config files by hand and restarting networkd and then again both ip and systemd's network settings stays in sync after boot.

Then the question: or is there even better way?

For example is there commands like:

  • systemd-networkd --add-vlan 123 --name lan
  • systemd-networkd --attach-vlan lan --device interface0
  • systemd-networkd --monitor --script /etc/network_changes_script.sh
  • Do you want this to be a fully automated / scripted task, or do you want to be able to interactively modify settings using the same interface? It sounds as though you want the latter, which would complicate things. What have you tried so far? You shouldn't see many configuration changes that you didn't in one way or another initiate. If you do, address that in a static manner - not in real time - fix it rather than apply a band aid. You would see things like physical link state changes, wifi stats - for which you may have a use case to take action in response to, but it's not clear to me. – Argonauts May 22 '16 at 23:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.