public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Matti Nykyri <Matti.Nykyri@iki.fi>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Ifplugd breaks services
Date: Sun, 8 Jun 2014 15:01:02 +0300	[thread overview]
Message-ID: <20140608120102.GA23691@lyseo.edu.ouka.fi> (raw)
In-Reply-To: <201406081126.11662.michaelkintzios@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 6191 bytes --]

On Sun, Jun 08, 2014 at 11:25:53AM +0100, Mick wrote:
> On Sunday 08 Jun 2014 10:25:40 Matti Nykyri wrote:
> > Hi
> > 
> > I also have other problems in my life. One of them is on one of my gentoo
> > server. This server has two network cards one serves intranet and the
> > other internet. The on that is on the internet is attached to a cable
> > modem. The modem is buggy and some times reboots it self losing the link
> > so I have ifplugd there get new address via dhcp immediately. Intranet
> > card is configured not to use ifplugd. I'm using OpenRC.
> 
> Are you sure of this?  How have you configured your intranet card to not be 
> acted upon by ifplugd?  From what I see, ifplugd will pick up any interface in 
> /etc/init.d:
> 
>   EXEC="/etc/init.d/net.$1"

Actually it's not ifplugd's fault. It is just the one that restarts services... 
The restarting is the thing that breaks stuff:

--------------------------------------------

server% [13:44] /var/log$ sudo iptables -v -L -t nat
Chain POSTROUTING (policy ACCEPT 10142 packets, 743K bytes)
 pkts bytes target     prot opt in     out     source               destination         
 8307  616K MASQUERADE  all  --  any    enp0s10  anywhere             anywhere            
server% [13:45] /var/log$ sudo /etc/init.d/net.enp0s10 stop
 * Stopping NIS Server ...                                   [ ok ]
 * samba -> stop: smbd ...                                   [ ok ]
 * samba -> stop: nmbd ...
 * start-stop-daemon: 2 process(es) refused to stop          [ !! ]
 * Unmounting network filesystems ...                        [ ok ]
 * Stopping chrooted named ...
 * Umounting chroot dirs ...
 * umounting /chroot/dns/usr/share/GeoIP ...                 [ ok ]
 * umounting /chroot/dns/etc/bind ...                        [ ok ]
 * umounting /chroot/dns/var/log/named ...                   [ ok ]
 * umounting /chroot/dns/var/bind ...                        [ ok ]
 * Stopping dhcpd ...                                        [ ok ]
 * Bringing down interface enp0s10
 *   Stopping dhclient on enp0s10 ...                        [ ok ]
 *   Stopping ifplugd on enp0s10 ...                         [ ok ]
server% [13:45] /var/log$ sudo iptables -v -L -t nat
Chain POSTROUTING (policy ACCEPT 10147 packets, 743K bytes)
 pkts bytes target     prot opt in     out     source               destination         
 8309  617K MASQUERADE  all  --  any    enp0s10  anywhere             anywhere            
server% [13:45] /var/log$ sudo /etc/init.d/net.enp0s10 start
 * Bringing up interface enp0s10
 *   Changing MAC address of enp0s10 ...                     [ ok ]
 *     changed to 00:80:23:7A:8A:A4
 *   Starting ifplugd on enp0s10 ...                         [ ok ]
 *     Backgrounding ...
 * WARNING: net.enp0s10 has started, but is inactive
server% [13:45] /var/log$ sudo iptables -v -L -t nat
Chain POSTROUTING (policy ACCEPT 10147 packets, 743K bytes)
 pkts bytes target     prot opt in     out     source               destination         
 8309  617K MASQUERADE  all  --  any    enp0s10  anywhere             anywhere            

--------------------------------------------
It takes around 40 seconds for dhclient to address from ISP (net-misc/dhcp-4.2.5_p1)
After it gets the address iptables is changed:
--------------------------------------------

server% [13:45] /var/log$ sudo iptables -v -L -t nat
Chain POSTROUTING (policy ACCEPT 2 packets, 152 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 MASQUERADE  all  --  any    eth1    anywhere             anywhere            
server% [13:48] /var/log$ ps aux | grep dhclient  
root     22011  0.0  0.2  16200  7108 ?        Ss   13:46   0:00 /sbin/dhclient -e PEER_NTP=no -e IF_METRIC=3 -q -1 -pf /var/run/dhclient-enp0s10.pid enp0s10
server% [13:48] /var/log$ ls /etc/init.d/net*
lrwxrwxrwx 1 root root     6 Oct  4  2011 /etc/init.d/net.enp0s10 -> net.lo*
lrwxrwxrwx 1 root root     6 Oct  4  2011 /etc/init.d/net.enp5s12 -> net.lo*
-rwxr-xr-x 1 root root 17412 Jan  2 23:42 /etc/init.d/net.lo*

--------------------------------------------

> > The problems are related to iptables and samba.
> > 
> > Samba: when ifplugd runs down the internet card samba is killed. This
> > shouldn't happen. Samba is configured only to use intranet card. Samba
> > always fails to start when ifplugd starts the internet card. Manual
> > starting is required.
> > 
> > Iptables: the system uses new nic names (enp7s0 etc). Iptables has them
> > correctly in the rules and in rules save. However when ifplugd cycles the
> > internet nic all the nic names in the in-kernel rules change to eth0 an
> > eth1. I need to zap iptables and then start it to reset the rules.
> 
> This does not happen here.  When ifplugd restarts a NIC it always comes back 
> with the new consistent naming.  Do you have some udev rules defined which are 
> picked up on the second time that the ifplugd brings up the card, but not the 
> first?

No I don't. And as stated when dhclient sets the address that is the point 
when the names change.

> > Any suggestions where to start? Or just disable ifplugd?
> 
> Have you tried configuring static IP addresses, broadcast and gateways for 
> each card using the /etc/cong.d/net file?  You can still set dhcp as a fall 
> back if you want, although I am not sure it is necessary for a server in a 
> static LAN.

lol. Yeap... I had an old rules set file that was set to run in 
postup()-function. Quite embarrassing :/ I don't know how I missed this...

modules_enp5s12="!plug"
modules_enp0s10="dhclient"

So enp5s12 is static and enp0s10 is dynamic with plug and dhcp.

> The file /usr/share/doc/netifrc-0.2.2/net.example.bz2 provides suggestions for 
> different set ups.

In the past there was option in the rc.conf to say that eth1 is sufficient for
net. I don't wan't any services shutdown if anything drives down the enp0s10 
NIC. Is there a way to do that with OpenRC? As you see when I stop enp0s10 all
the services that serve intranet are driven down...

-- 
-Matti

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2014-06-08 12:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-08  9:25 [gentoo-user] Ifplugd breaks services Matti Nykyri
2014-06-08 10:25 ` Mick
2014-06-08 12:01   ` Matti Nykyri [this message]
2014-06-08 16:15     ` Neil Bothwick
2014-06-08 17:44       ` Matti Nykyri
2014-06-08 18:19         ` Neil Bothwick
2014-06-16  3:46           ` Matti Nykyri
2014-06-10 10:43 ` thegeezer
2014-06-14 22:24   ` Mick
2014-06-17 21:08     ` thegeezer
2014-06-17 21:59       ` Mick
2014-06-18 13:03         ` thegeezer
2014-06-18 21:23           ` Mick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140608120102.GA23691@lyseo.edu.ouka.fi \
    --to=matti.nykyri@iki.fi \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox