# Confusion about nework setup

## hanfi

Hi,

After reading a lot of Things i am still a little bit confused about how to set-up my network correct. Maybe someone can explain some of the stuff below. (I think parts of the confusion come from outdated docs....)

My Laptop has 2 primary network interfaces. eth0 and wlan0.

I want none of them to be used at boot. All of them shall be managed from my gnome-session using NetworkManager.

As far as i Understand, I can do this by not adding /etc.init.d/net.eth0 or /etc/init.d/net.wlan0 as openrc then does not know about these services and does not bring them up. 

This works (its what i do currently), but is this the "right" way to do it? Or should I add those /etc/init.d scripts and put "!net.*" as rc_hotplug in /etc/rc.conf instead? Is this the same (well, i think not, but what's the difference..in end effect, not in how openrc deals with this, but that may be interesting too :-p)?

Next thing is what services to start, and when.

At boot i see the message "WARNING: xyz is scheduled to start when Network Manager has started". those are services i added to default runlevel.

This sounds nice,  however, NetworkManager HAS started at that point, its just marked "inactive". If i understand this correct, this is due to no network is available at this point (expect the loopback). So i assume this is a good thing (correct?).

How does NetworkManager know about to be "inactive"? 

From checking the init scripts, i do not see anything in the (for example) sshd script which would emit this message... how does this "inactivity detection" works?

Now lets take a look at some services.

- "tcsd". 

This is part of TPM-things, i do not need/want it to listen on the network. It shall use loopback and nothing else (as far as I understand this daemon is required for TPM tools to work correct). 

How do i tell openrc to start this service without NetworkManager? 

Would it be "correct" to set the dependency in /etc/init.d/tcsd from "need net" to "need net.lo" (sounds like a hack, so I assume that's not how to do it, but how then...)?

- "sshd".

Well,  i want it start on primary external interfaces if it comes up, and stop if it goes down. The point is that i like to have it listen on my eth0 and wlan0 but never on a bluetooth- or USB-Network which I sometimes have.

Would it be "the right way" to create multiple sshd start scripts (using some trickery to set the correct listen IP...)? eg, sshd.eth0 depending on net.eth0, sshd.wlan0 depending on net.wlan0. Or should i do this with scripts inside /etc/NetworkManager/dipsatch.d ?

- "tor".

similar to sshd, but I want it to start on all networks. That's easy, but how do I tell it about switching networks? eg, if I disable eth0 and enable wlan0? then it shall switch to that network (I do not think tor does support this, so I think I have to restart it in this case).. maybe the easiest way is again to restart it when the currently used network goes down? so using /etc/NetworkManager/dispatch.d scripts is better?

I think those questions above boil down to: shall I use /etc/init.d for such things, or drop that and use /etc/NetworkManager/dispatch.d?

Thanks in advance for any light shed into the darkness in my head.

----------

## Arkhelion

If you do use NetworkManager, you don't need to start net.eth0 nor net.wlan0 (and you shouldn't) so they shouldn't be in any runlevel.

I believe that every script that depends on "net" should be handled by the dispatcher in NetworkManager (or you could go over to NetworkManager 0.9.4 and add NetworkManager to default runlevel, it will automatically start eth0, and _then_ will start net dependant scripts).

----------

