My MythTV box doesn't have a keyboard or monitor and could be moved between TV aerial points. It has two network cards so can connect via cable or wireless.
Is there any way, at boot time, to get it to try the cable interface first and then, perhaps after a given time, to try the wireless interface and to keep trying both interfaces until it does find a connection?
On 14-Feb-08 11:53:57, Barry Samuels wrote:
My MythTV box doesn't have a keyboard or monitor and could be moved between TV aerial points. It has two network cards so can connect via cable or wireless.
Is there any way, at boot time, to get it to try the cable interface first and then, perhaps after a given time, to try the wireless interface and to keep trying both interfaces until it does find a connection?
-- Barry Samuels http://www.beenthere-donethat.org.uk The Unofficial Guide to Great Britain
You say "can connect" -- but what to?
If you had a specific IP address to connect to, you could run a script at boot which (assuming your two cards are on eth0 and eth1) switched the routing table back & forth between eth0 and eth1 (say with a "sleep 2" between switches) and tried to ping that IP address.
The test would be on the lines of
if [ ping -1 ip.add.re.ss ] ; then exit
(or whatever)
Or you could ping one address when on eth0 and another on eth1.
The basic lines of such a script would be (stuff in "{...}" is "metalanguage" -- i.e. the details are up to you ... )
{set route to eth0} while true ; do sleep 2 {delete eth0 route and set route to eth1} if [ ping -1 ip.add.re.ss1 ] ; then exit {delete eth1 route and set eth0} sleep 2 if [ ping -1 ip.add.re.ss0 ] ; then exit done
("sleep 2" is just a guess, of course).
Ted.
-------------------------------------------------------------------- E-Mail: (Ted Harding) Ted.Harding@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 14-Feb-08 Time: 12:38:27 ------------------------------ XFMail ------------------------------
In Gentoo, I use mii-diag and mii-tool to determine if a cable is plugged into my laptop's FE port, perhaps you could do something around that?
This is the code from the sample network config files in Gentoo if its of any help: <code snip> if mii-tool "${IFACE}" 2> /dev/null | grep -q 'no link'; then ewarn "No link on ${IFACE}, aborting configuration" return 1 fi </code snip>
Jim
On Thu, 2008-02-14 at 11:53 +0000, Barry Samuels wrote:
My MythTV box doesn't have a keyboard or monitor and could be moved between TV aerial points. It has two network cards so can connect via cable or wireless.
Is there any way, at boot time, to get it to try the cable interface first and then, perhaps after a given time, to try the wireless interface and to keep trying both interfaces until it does find a connection?
On Thu, 2008-02-14 at 11:53 +0000, Barry Samuels wrote:
Is there any way, at boot time, to get it to try the cable interface first and then, perhaps after a given time, to try the wireless interface and to keep trying both interfaces until it does find a connection?
I am not sure but is there a way of using a RIP routing daemon and then setting the metric of the wireless connection higher than that of the wired connection so that if present the wired connection is used and if not it falls back to wireless ?
On Thu, Feb 14, 2008 at 11:53:57AM +0000, Barry Samuels wrote:
My MythTV box doesn't have a keyboard or monitor and could be moved between TV aerial points. It has two network cards so can connect via cable or wireless.
Is there any way, at boot time, to get it to try the cable interface first and then, perhaps after a given time, to try the wireless interface and to keep trying both interfaces until it does find a connection?
You can use ifplugd to only bring up the wired interface if it has a link beat. Perhaps something like whereami might help in terms of deciding which network connection to fallback to.
J.
On 14/02/08 15:28:11, Jonathan McDowell wrote:
On Thu, Feb 14, 2008 at 11:53:57AM +0000, Barry Samuels wrote:
My MythTV box doesn't have a keyboard or monitor and could be moved between TV aerial points. It has two network cards so can connect via cable or wireless.
Is there any way, at boot time, to get it to try the cable interface first and then, perhaps after a given time, to try the wireless interface and to keep trying both interfaces until it does find a connection?
I went for a script solution i.e. code in /etc/rc.local.
I've set both interfaces to be NON-auto. The script tries to bring up eth0 first (cable) and if that fails it tries ath0 (wireless). It's set to try both those interfaces up to 5 times and if it can't get a connection it shuts down.
The system complains about it shutting down from within rc.local but I assume I can ignore that.
A knockon effect is that because the network interface comes up last thing MySQL fails to start and, consequently, so does mythtv-backend. So I've added '/etc/init.d/mysql restart' and '/etc/init.d/mythtv- backend restart' to the end of rc.local.
It all seems to work.
Many thanks for the various suggestions.