Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #162694 > unrolled thread

systemd and variable network (help needed)

Started bydeloptes <deloptes@yahoo.com>
First post2016-01-06 13:10 +0100
Last post2016-01-13 09:00 +0100
Articles 12 — 4 participants

Back to article view | Back to linux.debian.user


Contents

  systemd and variable network (help needed) deloptes <deloptes@yahoo.com> - 2016-01-06 13:10 +0100
    Re: systemd and variable network (help needed) Brian <ad44@cityscape.co.uk> - 2016-01-06 15:10 +0100
      Re: systemd and variable network (help needed) deloptes <deloptes@yahoo.com> - 2016-01-06 16:20 +0100
        Re: systemd and variable network (help needed) Brian <ad44@cityscape.co.uk> - 2016-01-06 16:50 +0100
          Re: systemd and variable network (help needed) deloptes <deloptes@yahoo.com> - 2016-01-06 20:00 +0100
        Re: systemd and variable network (help needed) Elimar Riesebieter <riesebie@lxtec.de> - 2016-01-07 09:50 +0100
          Re: systemd and variable network (help needed) deloptes <deloptes@yahoo.com> - 2016-01-07 19:40 +0100
          Re: systemd and variable network (help needed) deloptes <deloptes@yahoo.com> - 2016-01-08 08:40 +0100
    Re: systemd and variable network (help needed) Dominique Dumont <dod@debian.org> - 2016-01-08 08:30 +0100
      Re: systemd and variable network (help needed) deloptes <deloptes@yahoo.com> - 2016-01-08 09:00 +0100
      Re: systemd and variable network (help needed) deloptes <deloptes@yahoo.com> - 2016-01-10 00:40 +0100
    Re: systemd and variable network (help needed) [SOLVED] deloptes <deloptes@yahoo.com> - 2016-01-13 09:00 +0100

#162694 — systemd and variable network (help needed)

Fromdeloptes <deloptes@yahoo.com>
Date2016-01-06 13:10 +0100
Subjectsystemd and variable network (help needed)
Message-ID<qNV4C-Vs-7@gated-at.bofh.it>
Hi,

I'm willing to start using systemd, but there is one major issue that
prevent me to do so.

I have following use cases regarding network setup.

1) home office 
        - my home is on a nfs share 
        - the nfs share mounted via fstab before user gets to login prompt
        - eth0 no firewall required
        - wireless off except bluetooth
2) company office 
        - user has a stand allone profile 
        - eth0 firewall active (not too strict rules)
        - wireless and bluetooth off
3) on the road
        - user has a stand allone profile (same as 2)
        - wireless on, bluetooth off
        - wlan0 firewall active (strict rules)

I do this with two custom init script
        - network script (checks the interface and network/domain) 
        and updates fstab, resolv.conf + mounts nfs if 1)
        - firewall script - iptables classic + custom checks

How can I solve this with systemd? Can I tell systemd to execute a/the
script after something else was done and where do I set this?

Debian Jessie in use here

Highly appreciated, thanks in advance.

[toc] | [next] | [standalone]


#162702

FromBrian <ad44@cityscape.co.uk>
Date2016-01-06 15:10 +0100
Message-ID<qNWWJ-2bS-5@gated-at.bofh.it>
In reply to#162694
On Wed 06 Jan 2016 at 12:45:43 +0100, deloptes wrote:

> I'm willing to start using systemd, but there is one major issue that
> prevent me to do so.
> 
> I have following use cases regarding network setup.
> 
> 1) home office 
>         - my home is on a nfs share 
>         - the nfs share mounted via fstab before user gets to login prompt
>         - eth0 no firewall required
>         - wireless off except bluetooth
> 2) company office 
>         - user has a stand allone profile 
>         - eth0 firewall active (not too strict rules)
>         - wireless and bluetooth off
> 3) on the road
>         - user has a stand allone profile (same as 2)
>         - wireless on, bluetooth off
>         - wlan0 firewall active (strict rules)
> 
> I do this with two custom init script
>         - network script (checks the interface and network/domain) 
>         and updates fstab, resolv.conf + mounts nfs if 1)
>         - firewall script - iptables classic + custom checks
> 
> How can I solve this with systemd? Can I tell systemd to execute a/the
> script after something else was done and where do I set this?
> 
> Debian Jessie in use here

Why not try systemd before anticipating any issues? 'init=/bin/systemd'
on the kernel command line for trial runs.

[toc] | [prev] | [next] | [standalone]


#162705

Fromdeloptes <deloptes@yahoo.com>
Date2016-01-06 16:20 +0100
Message-ID<qNY2u-2RR-13@gated-at.bofh.it>
In reply to#162702
Brian wrote:

> Why not try systemd before anticipating any issues? 'init=/bin/systemd'
> on the kernel command line for trial runs.

I have tried it - this is the reason I ask the question.

The nfs share with my home did not mount, so script either did not execute,
or executed inappropriate.

Can you provide arguments / explain what would happen from systemd point of
view?

regards

PS: usually it is not accepted to answer question with question. In your
question you also presume, I have not tried it, please!

[toc] | [prev] | [next] | [standalone]


#162709

FromBrian <ad44@cityscape.co.uk>
Date2016-01-06 16:50 +0100
Message-ID<qNYvw-35F-17@gated-at.bofh.it>
In reply to#162705
On Wed 06 Jan 2016 at 15:57:12 +0100, deloptes wrote:

> Brian wrote:
> 
> > Why not try systemd before anticipating any issues? 'init=/bin/systemd'
> > on the kernel command line for trial runs.
> 
> I have tried it - this is the reason I ask the question.
> 
> The nfs share with my home did not mount, so script either did not execute,
> or executed inappropriate.

Did journalctl have anything to say on this?

[toc] | [prev] | [next] | [standalone]


#162722

Fromdeloptes <deloptes@yahoo.com>
Date2016-01-06 20:00 +0100
Message-ID<qO1tp-4Yl-27@gated-at.bofh.it>
In reply to#162709
Brian wrote:

> Did journalctl have anything to say on this?

I don't know - the home dir was not mounted - so I would expect my scripts
either did not execute at all or something went wrong, because they relay
on init services - perhaps this could be the reason.

However after I upgraded to jessie, there was no time to sit down and read
about systemd ... and back then I did not know it is logging in the
nirvana.

I simply followed this article:
http://without-systemd.org/wiki/index.php/How_to_remove_systemd_from_a_Debian_jessie/sid_installation

But recently I started testing (more time) and found out some components are
bound to systemd (bluemon) thus looking for a way to make all right.

It seems systemd is inevitable ATM

thanks in advance

regards

[toc] | [prev] | [next] | [standalone]


#162755

FromElimar Riesebieter <riesebie@lxtec.de>
Date2016-01-07 09:50 +0100
Message-ID<qOeqC-5Ek-7@gated-at.bofh.it>
In reply to#162705
* deloptes <deloptes@yahoo.com> [2016-01-06 15:57 +0100]:

> Brian wrote:
> 
> > Why not try systemd before anticipating any issues? 'init=/bin/systemd'
> > on the kernel command line for trial runs.
> 
> I have tried it - this is the reason I ask the question.
> 
> The nfs share with my home did not mount, so script either did not execute,
> or executed inappropriate.

To mount net devices via fstab an additional option is needed:

_netdev

mount(8):
...
_netdev
              The filesystem resides on a device that
              requires network access (used to prevent
              the system from attempting to mount these
              filesystems until the network has been
              enabled on the system).
...

/etc/fstab:

[nfsserver]:/nfs/share /mount/point/ nfs defaults,_netdev 0 0

Elimar
-- 
 The path to source is always uphill!
                                -unknown-

[toc] | [prev] | [next] | [standalone]


#162773

Fromdeloptes <deloptes@yahoo.com>
Date2016-01-07 19:40 +0100
Message-ID<qOnDB-3xV-57@gated-at.bofh.it>
In reply to#162755
Elimar Riesebieter wrote:

> To mount net devices via fstab an additional option is needed:
> 
> _netdev
> 
> mount(8):
> ...
> _netdev
>               The filesystem resides on a device that
>               requires network access (used to prevent
>               the system from attempting to mount these
>               filesystems until the network has been
>               enabled on the system).
> ...
> 
> /etc/fstab:
> 
> [nfsserver]:/nfs/share /mount/point/ nfs defaults,_netdev 0 0
> 
> Elimar

Hi Elimar, all,

Thanks for the hints - indeed this could do the work for the nfs mount, but
how do I execute a custom actions.

MY requirements are
        mount nfs conditional (this could be solved with the _netdev option)
        setup proper home directory (the users home is obviously also on nfs)
        enable disable wifi/bluetooth
        start firewall in specific profile (case 1,2,3)
        etc

So my overall question is how you tell systemd what to do - is it possible
to tell it start custom init script - I read there are a lot of ways to
configure it, but heard it is a bit complicated ... xml files and so on.

thanks in advance

regards

[toc] | [prev] | [next] | [standalone]


#162787

Fromdeloptes <deloptes@yahoo.com>
Date2016-01-08 08:40 +0100
Message-ID<qOzOq-3uw-13@gated-at.bofh.it>
In reply to#162755
another example

 perl -pi -e "s/^ServerName .*$/ServerName
$HOME_SERVER_NAME/g" /etc/cups/client.conf

how do I do this with systemd?

I'll try now the _netdev option and see if it works for me without systemd

thanks in advance

[toc] | [prev] | [next] | [standalone]


#162786

FromDominique Dumont <dod@debian.org>
Date2016-01-08 08:30 +0100
Message-ID<qOzEK-3rg-9@gated-at.bofh.it>
In reply to#162694
On Wednesday 06 January 2016 12:45:43 deloptes wrote:
> I do this with two custom init script
>         - network script (checks the interface and network/domain) 
>         and updates fstab, resolv.conf + mounts nfs if 1)

I do a similar task with a script located in /etc/network/if-up.d/ 
This is executed when systemd sets up network with NetworkManager. 

HTH

-- 
 https://github.com/dod38fr/   -o- http://search.cpan.org/~ddumont/
http://ddumont.wordpress.com/  -o-   irc: dod at irc.debian.org

[toc] | [prev] | [next] | [standalone]


#162788

Fromdeloptes <deloptes@yahoo.com>
Date2016-01-08 09:00 +0100
Message-ID<qOA7M-3BQ-9@gated-at.bofh.it>
In reply to#162786
Dominique Dumont wrote:

> On Wednesday 06 January 2016 12:45:43 deloptes wrote:
>> I do this with two custom init script
>>         - network script (checks the interface and network/domain)
>>         and updates fstab, resolv.conf + mounts nfs if 1)
> 
> I do a similar task with a script located in /etc/network/if-up.d/
> This is executed when systemd sets up network with NetworkManager.
> 
> HTH

Thanks Dominique ,
this is a good hint. I'll give it a try during the weekend.

I have the feeling that _netdev will not help me with the mount, but will
report back after tested today

thanks and regards

[toc] | [prev] | [next] | [standalone]


#162831

Fromdeloptes <deloptes@yahoo.com>
Date2016-01-10 00:40 +0100
Message-ID<qPbh0-4ca-7@gated-at.bofh.it>
In reply to#162786
Dominique Dumont wrote:

> On Wednesday 06 January 2016 12:45:43 deloptes wrote:
>> I do this with two custom init script
>>         - network script (checks the interface and network/domain)
>>         and updates fstab, resolv.conf + mounts nfs if 1)
> 
> I do a similar task with a script located in /etc/network/if-up.d/
> This is executed when systemd sets up network with NetworkManager.
> 
> HTH

>From home it worked after slightly modifying the script.

BTW I'm not sure if and how this relates to NetworkManager  - for this
network it is disabled on my side

regards

[toc] | [prev] | [next] | [standalone]


#162979 — Re: systemd and variable network (help needed) [SOLVED]

Fromdeloptes <deloptes@yahoo.com>
Date2016-01-13 09:00 +0100
SubjectRe: systemd and variable network (help needed) [SOLVED]
Message-ID<qQovw-4Vo-7@gated-at.bofh.it>
In reply to#162694
deloptes wrote:

> Hi,
> 
> I'm willing to start using systemd, but there is one major issue that
> prevent me to do so.
> 
> I have following use cases regarding network setup.
> 
> 1) home office
>         - my home is on a nfs share
>         - the nfs share mounted via fstab before user gets to login prompt
>         - eth0 no firewall required
>         - wireless off except bluetooth
> 2) company office
>         - user has a stand allone profile
>         - eth0 firewall active (not too strict rules)
>         - wireless and bluetooth off
> 3) on the road
>         - user has a stand allone profile (same as 2)
>         - wireless on, bluetooth off
>         - wlan0 firewall active (strict rules)
> 
> I do this with two custom init script
>         - network script (checks the interface and network/domain)
>         and updates fstab, resolv.conf + mounts nfs if 1)
>         - firewall script - iptables classic + custom checks
> 
> How can I solve this with systemd? Can I tell systemd to execute a/the
> script after something else was done and where do I set this?
> 
> Debian Jessie in use here
> 
> Highly appreciated, thanks in advance.

Thanks to all of you (especially to Dominique) all the points have been
achieved successfully after moving the custom network script from init.d to
if-up.d. Of course the script was reworked, but it works nice as before

regards

regards

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web