2

I'm trying to configure a tap interface using systemd-networkd configuration files. I created the files:

/etc/systemd/network/tap_test.network
/etc/systemd/network/tap_test.netdev

with the contents:

tap_test.network:
[Match]
Name=tap_test

[Network]
Description=TEST tap interface
Address=192.168.2.100

tap_test.netdev:
[Match]

[NetDev]
Name=tap_test
Kind=tap

Then in restarted the systemd-networkd service:

sudo systemctl restart systemd-networkd.service

As expected, running ifconfig shows the new tap interface. HOWEVER, when I tried to alter the ip address in the configuration file tap_test.network to end with 101, then tried to restart the systemd-networkd once again, no change coul'd be seen when I ran ifconfig again (the ip address remains the old one).

I also tried to shut down the interface with ifconfig tap_test down and then restart the service, it didn't help either.

How can I make systemd-networkd reload the configuration files?

1

To quote systemd.netdev(5):

Virtual network devices are created as soon as networkd is started. If a netdev with the specified name already exists, networkd will use that as-is rather than create its own. Note that the settings of the pre-existing netdev will not be changed by networkd.

So, apparently, this is so by design. I think you need to find a way to deallocate the tap device by yourself (if this is at all possible) and add the required commands to ExecStopPost= of systemd-networkd.service unit.

You can use drop-ins for the latter.

/etc/systemd/system/systemd-networkd.service.d/tuntap.conf:

[Service]
ExecStopPost=<your command goes here>
0

Try using ifdown tap_test and ifup tap_test instead of ifconfig.

Point being that ifup do some more work. ifconfig is bare minimum.

ifup ethX uses the config file and bring up interface with correct IP address etc.

ifconfig ethX up only starts the interface.

  • It would be nice to give some explanation as to why that should help. – peterph Jan 13 '15 at 11:46
  • @peterph: Yes. I tried to leave as comment first, but <50rep. Anyhow: I also miss-read from Q "... ifconfig tap_test down and then restart the service ..." – I somehow read that he used ifconfig to take it up as well. Not sure what the service process, but guess it read same as ifup or perhaps even wrapper for it. IDK. Added some more detail any how. – user367890 Jan 13 '15 at 22:46

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.