Solved

Samba startup with multiple interfaces

Posted on 2009-07-11
8
568 Views
Last Modified: 2013-12-06
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.
0
Comment
Question by:phil8258
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 20

Expert Comment

by:edster9999
ID: 24893487
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.
0
 

Expert Comment

by:gcovato
ID: 24950472
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
0
 
LVL 2

Expert Comment

by:Hasues
ID: 25040461
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
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

Author Comment

by:phil8258
ID: 25106438
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.
0
 
LVL 2

Expert Comment

by:Hasues
ID: 25117791
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
0
 

Author Comment

by:phil8258
ID: 25118161
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.
0
 
LVL 2

Accepted Solution

by:
Hasues earned 250 total points
ID: 25118598
Make a virtual interface on something, like say a USB port, or even a fake one of sorts.  Add this interface to smb.conf as an interface it listens on, and do the same for /etc/ssh/sshd_config.  These interfaces would be available during boot and thus the service would be available.  As another option, you could modify the init scripts for both changing their dependencies.  For instance, in /etc/init.d/samba, change:

depend() {
        after slapd
        need net
        use cupsd
}

to

depend() {
        use cupsd
}

Finally, as food for thought, if no interfaces are available, it doesn't really matter what service is available, right?  No connectivity is available to serve it.

One of the above should work for you.

Haz
0
 

Author Closing Comment

by:phil8258
ID: 31602452
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.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
Determining the an SCCM package name from the Package ID
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question