You are not logged in.

#1 2013-04-16 18:52:46

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,221
Website

setup 'internet sharing pc' - provide custom systemd target?

Hi,

I just received a 2-year old netbook, which seemed perfect for me to install as a network 'bridge': providing internet to a pc by:
* receiving internet through wlan
* routing it with iptables to the ethernet adapter

To expand the functionality, I am adding dhcpd, minidlna, ntpd, ... - services.

I have already setup netctl:
* netctl-auto@wlan is connecting automagically upon boot and providing network.target
* netctl-ifplugd@eth is connecting automagically whenever I plug in the ethernet-cable.

But: since connecting to the wlan provides the network.target, services like dhcpd and minidlna are started only to fail because the ethernet adapter is not brought up.

I think the best solution is to make a custom .target-file, f.e. an 'ifplugd.target' and edit the service files of the services that I wish to start only after the ethernet-adapter is brought up. Inside the service files I should only have to change 'After = network.target' to 'After = ifplugd.target' - but how do I provide the ifplugd.target through systemd or netctl?

(or am I doing this all wrong?)

Thx!

/EDIT: to correct myself: this is not really a bridge, but rather a 'sharing of internet' as the wiki describes it (if this should be relevant at all) - subject changed

Last edited by zenlord (2013-04-16 19:53:03)

Offline

#2 2013-04-16 19:29:21

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,221
Website

Re: setup 'internet sharing pc' - provide custom systemd target?

I thought I had found the answer:

1. Do not create a custom .target
2. Change the service files of minidlna, dhcpd4, nmbd (required by samba) to have:
[Unit]
Requires=netctl-ifplugd@enp1s0f0.service
After=netctl-ifplugd@enp1s0f0.service

3. Disable the above services to start at boot.

RESULT: ifplugd works, activating the netctl profile with the static IP-address, but the dependent services don't start automatically.

Any tips?

Vincent

Offline

#3 2013-04-17 20:52:31

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,221
Website

Re: setup 'internet sharing pc' - provide custom systemd target?

I solved it, but it's not the most elegant solution: I added to the netctl profile for my ethernet adapter two commands 'ExecUpPost' and 'ExecDownPre', each starting/stopping a series of systemctl services...

Happy to hear other / more elegant solutions...

Offline

Board footer

Powered by FluxBB