You are not logged in.

#1 2014-02-07 20:12:34

rodyaj
Member
Registered: 2009-10-13
Posts: 54

How can I load service files after specific network interface is up?

Some applications such as pdnsd bind to each network interface separately. I want to know how I can adjust service files e.g., pdnsd, so that the 'After=' points to a specific netctl-auto wireless interface rather than just network.target. Thanks.

Last edited by rodyaj (2014-02-07 20:12:52)

Offline

#2 2014-02-10 14:31:07

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: How can I load service files after specific network interface is up?

Why not use (for pdnsd):

server_ip=0.0.0.0;

fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#3 2014-02-11 02:45:29

rodyaj
Member
Registered: 2009-10-13
Posts: 54

Re: How can I load service files after specific network interface is up?

Rexilion wrote:

Why not use (for pdnsd):

server_ip=0.0.0.0;

Because I have a problem in that I must manually restart pdnsd service every time I reboot or hibernate my laptop.

Someone mentions the reason for this in the Arch Bug Tracker:

The reason is pdnsd binds to each network interface separately.

And the supposed fix is:

Adjust .service file to start pdnsd after specific network interface is up.

I want to know how to do the latter.

Last edited by rodyaj (2014-02-11 02:49:00)

Offline

#4 2014-02-11 08:11:58

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: How can I load service files after specific network interface is up?

Hmm, I'm not familiair with that. I know nm is capable of doing this through dispatcher.d.

You have to use systemD templates:

systemd manpage wrote:

Optionally, units may be instantiated from a template file at runtime. This allows creation of multiple units from a single configuration file. If systemd looks for a unit configuration file, it will first search for the literal unit name in the file system. If that yields no success and the unit name contains an "@" character, systemd will look for a unit template that shares the same name but with the instance string (i.e. the part between the "@" character and the suffix) removed. Example: if a service getty@tty3.service is requested and no file by that name is found, systemd will look for getty@.service and instantiate a service from that configuration file if it is found.

To refer to the instance string from within the configuration file you may use the special "%i" specifier in many of the configuration options. See below for details.

Can you show me the pdnsd service file? I think we have to adapt it somehow.


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#5 2014-02-11 12:57:31

rodyaj
Member
Registered: 2009-10-13
Posts: 54

Re: How can I load service files after specific network interface is up?

Rexilion wrote:

Can you show me the pdnsd service file? I think we have to adapt it somehow.

[Unit]
Description=proxy name server
After=network.target

[Service]
ExecStart=/usr/bin/pdnsd

[Install]
WantedBy=multi-user.target

Thanks for looking.

Offline

#6 2014-02-11 13:33:07

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: How can I load service files after specific network interface is up?

That's too bad. Templates won't work in this instance since it assumes an pdnsd for each interface.

Are you even using systemd to manage your interfaces? Or is that NetworkManager?


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#7 2014-02-11 14:13:10

rodyaj
Member
Registered: 2009-10-13
Posts: 54

Re: How can I load service files after specific network interface is up?

Rexilion wrote:

That's too bad. Templates won't work in this instance since it assumes an pdnsd for each interface.

Are you even using systemd to manage your interfaces? Or is that NetworkManager?

systemd using netctl with the netctl-auto@interface.service.

Last edited by rodyaj (2014-02-11 14:13:27)

Offline

#8 2014-02-12 18:51:23

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: How can I load service files after specific network interface is up?

What I *would* do, is check to see if pdnsd is capable of handling signals like SIGUSR1, SIGUSR2 etc etc. Sometimes this makes the program reload and or rebind in our specific case.

If you find that out, we can create a unit file for the interface.


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#9 2014-02-12 22:57:01

rodyaj
Member
Registered: 2009-10-13
Posts: 54

Re: How can I load service files after specific network interface is up?

Rexilion wrote:

What I *would* do, is check to see if pdnsd is capable of handling signals like SIGUSR1, SIGUSR2 etc etc. Sometimes this makes the program reload and or rebind in our specific case.

If you find that out, we can create a unit file for the interface.

It does seem to handle some signals, but I don't see anything about reloading/rebinding.

For the time being I've dealt with the problem by appending the following to my wireless profiles in /etc/netcl:

ExecUpPost='systemctl restart pdnsd || true' # the true part allows the wireless to up itself even if pdnsd fails to start

I'd still be interested to find out a systemd method for handling this, as manually adding this line for every roaming profile I use is a bit of a pain.

Last edited by rodyaj (2014-02-12 23:00:43)

Offline

#10 2014-04-21 00:33:39

saturn_knight
Member
Registered: 2010-10-16
Posts: 9

Re: How can I load service files after specific network interface is up?

I'm having the same problem, thought I found a fix related to a static IP I was using but that wasn't the problem. I guess it just comes down to the way PDNSD is written. I'm just surprised more people aren't experiencing this issue.

I found some interesting information here: http://www.freedesktop.org/wiki/Softwar … orkTarget/

Last edited by saturn_knight (2014-04-21 00:40:33)

Offline

#11 2014-04-21 07:09:08

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: How can I load service files after specific network interface is up?

Another crude approach would be to use an dummy interface. Let's call it dummy0 (it's first instance). You assign dummy0 a unique local ip (from 127.0.0.1/8, let's say 127.1.1.1) and then let pdnsd bind to dummy0.

In your firewall, you configure that any packets that want to go to 127.0.0.1 port 53, redirect to 127.1.1.1 port 53 (DNAT target).

No more messing around with network.target as you could setup dummy0 by adapting the pdnsd service file (/etc/systemd/system/pdnsd.service.d/)
No more restarting pdnsd as the firewall will handle this.

(and you have something to show off with...)

OTOH: You could also use unbound smile .

Last edited by Rexilion (2014-04-21 07:09:47)


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#12 2014-05-10 07:53:38

ssuerbier
Member
Registered: 2014-05-10
Posts: 1

Re: How can I load service files after specific network interface is up?

If you just want to solve the problem regarding rebooting/hibernation, maybe this works for you:

I changed my pdnsd.conf server setting to

uptest=query;

instead of the interface test.

I guess the interface check that is done by pdnsd is somehow screwed so that after rebooting/hibernation it thinks it cannot reach the specified DNS Servers. The query check actually queries the DNS servers (with an empty query) to see if they are online.

Offline

Board footer

Powered by FluxBB