Link to home
Start Free TrialLog in
Avatar of phil8258
phil8258Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Samba startup with multiple interfaces

Experts,

I'm having a problem where samba will not start up because one on the interfaces is not connected.
The error message is:

* WARNING:   samba is scheduled to start when net.eth1 has started

eth0 is connected to a switch for the local network
eth1 is connected directly to another server

I would like Samba to serve both the network on eth0 AND the other server on eth1.
Obviously my problem comes that it will not serve anything if the other server connected to eth1 is switched off.

I would like samba to start regardless of whether eth0 or eth1 is up or down, and to serve either or both should one or both of these networks come up after samba has started.

I'm sure this must be possible. I've done a bit of google trawling and found there are bugs related to this. I don't think this is a bug, more just a case of I've not switched on a machine.

Help would be much appreciated!

Cheers,

Phil.
Avatar of edster9999
edster9999
Flag of Ireland image

There is two ways to fix this.  Software or hardware.

The software one would be to edit the startup script
/etc/init.d/samba

near the top it has something like

depend() {
     need net;
}

This is the line that makes it stop if the network cards are not up.  Use could swap it for 'use net' or remve it all together.
This is not the best answer as that line was put in there for a reason.  It might make your system unstable if it does start up and neither card is running.
It may also make Samba run too early if it doesn't wait for the network part.

I would go for the other method of fixing this.  Connect the network card to a simple switch and connect that to the other machine.
You may need to swap the existing cable (which is probably a cross over) for a standard bit of ethernet cable and you will need a small switch to connect them.
But it will now always have a connection even if the machine is turned off.
Avatar of gcovato
gcovato

A way to avoid the problem is stop the network card when ever they are not connected.

/etc/init.d/net.ethx stop

In order to avoid the problem during startup, it is better to not autostart the network interfaces during boot

rc-update del net.ethx default

and start them later, manually,  when the cards are physically connected
Avatar of Hasues
You need ifplugd on your system.

emerge -av ifplugd

Once added, it should by default added to the network interfaces and monitor for connection and disconnection events, and starting the associated services once the interface comes online.  You might want to add:

plug_timeout="10"

to /etc/conf.d/net

For reference:
man ifplugd
less /etc/conf.d/net.example
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&chap=6

Haz
Avatar of phil8258

ASKER

Haz,

Thanks for your comment. I've installed ifplugd as you suggested with plug_timeout="10".
It sounds like it's getting somewhere closer to what i'm trying to do.

I'm not sure it's doing what I want yet (though it's actually hard to tell if it's running). Unfortunalely, it's not done what i'm after out-the-box, when I start the machine with the eth1 link down, samba and ssh and whatever services that are bound to both eth0 and eth1 don't start up. Is the idea with ifplugd that it should trick these services into starting by "plugging" the disconnected interface until it comes up?

I've checked ifconfig and found that eth1 when disconnected has information showing but no IP (set manually).

Cheers,

Phil.
Correct Phil, what should be happening is when you start up and the interfaces detect there is no connection, it will warn you that all dependent services are set to start once the interfaces come online.  When you plug in your cable, you should hear the pc speaker beep (if available) and it detects that it has been plugged in, and that it has a connection.  Once the connection is available then the service starts.  Are you saying when you plug the interface in that it is not setting the IP and related on the interface?  Could you post your /etc/conf.d/net and an rc-update -s?

Haz
Haz,
It's working as it should. I've played with it a bit more this evening and found that with the eth1 link unplugged ssh and samba don't start, but soon after plugging it in, they do start.
Unfortunately, whilst it certainly does improve the situation, it's not really what I was after. I want something to trick ssh and samba into thinking eth1 is connected (or ignore it) and start the services at boot regardless.
Perhaps the only real solution is a switch.
Cheers,
Phil.
ASKER CERTIFIED SOLUTION
Avatar of Hasues
Hasues
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry for the delay. Thanks for your suggestions. changing /etc/init.d/samba and sshd to remove the use net dependency was just what I needed. All working nice now. The machine will boot and start both samba and sshd when the machine connected direct to eth1 is powered off, but be fully accessible with those services on eth0 (connected to switch). When the other machine is booted, ifplug restarts samba and sshd is then working on both interfaces. Thanks for your help. Cheers.