| Next: [Samba] [Urgent] Cannot make changes via pdbedit |
| Author |
Message |
Folderol External

Since: Dec 13, 2004 Posts: 118
|
Posted: Tue Jul 17, 2007 8:09 pm Post subject: Auto network re-connect Archived from groups: uk>comp>os>linux (more info?) |
|
|
|
| Is there a simple way I can get computers that are connected to a
router to recognise when the router is turned off (possibly giving a
warning) then automatically connect when it is turned on again?
--
Will J G
|
|
|
| Back to top |
|
 |
Folderol External

Since: Dec 13, 2004 Posts: 118
|
Posted: Tue Jul 17, 2007 8:10 pm Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
On Tue, 17 Jul 2007 20:09:46 +0100
Folderol <folderol.DeleteThis@ukfsn.org> wrote:
> Is there a simple way I can get computers that are connected to a
> router to recognise when the router is turned off (possibly giving a
> warning) then automatically connect when it is turned on again?
Forgot to mention
Working on debian etch
--
Will J G |
|
| Back to top |
|
 |
Chris Davies External

Since: Apr 13, 2004 Posts: 267
|
Posted: Wed Jul 18, 2007 11:46 am Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Folderol <folderol.RemoveThis@ukfsn.org> wrote:
> Is there a simple way I can get computers that are connected to a
> router to recognise when the router is turned off (possibly giving a
> warning) then automatically connect when it is turned on again?
If they're connected using ethernet then take a look at mii-tool. On
Debian (Etch) the ifplug stuff can do this for you.
Chris |
|
| Back to top |
|
 |
Martin Gregorie External

Since: Aug 20, 2005 Posts: 284
|
Posted: Wed Jul 18, 2007 9:31 pm Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Chris Davies wrote:
> Folderol <folderol.TakeThisOut@ukfsn.org> wrote:
>> Is there a simple way I can get computers that are connected to a
>> router to recognise when the router is turned off (possibly giving a
>> warning) then automatically connect when it is turned on again?
>
> If they're connected using ethernet then take a look at mii-tool. On
> Debian (Etch) the ifplug stuff can do this for you.
>
According to its FC6 manpage mii-tool is obsolete and was replaced by
ethtool, which can deal with a bigger range of devices. In any case I
don't see how ethtool can help. Its manpage says that it diddles with
NICs plugged into your computer, not with routers at the other end of a
lump of CAT5.
To the OP: what it this 'reconnect' of which you speak? When I power
cycle my ADSL router all the computers on my LAN can see it immediately
it restarts. No problem. If you mean "detect when its off", then a
script that periodically pings the router and records the result in a
known place should solve that. Alternatively, ping something at your ISP
and then you'll also know the status of the ADSL connection, but don't
do that too frequently or you'll annoy your ISP.
Please explain the problem you're trying to solve.
--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org | |
|
| Back to top |
|
 |
Folderol External

Since: Dec 13, 2004 Posts: 118
|
Posted: Thu Jul 19, 2007 11:22 pm Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
On Wed, 18 Jul 2007 21:31:42 +0100
Martin Gregorie <martin RemoveThis @see.sig.for.address> wrote:
> Chris Davies wrote:
> > Folderol <folderol RemoveThis @ukfsn.org> wrote:
> >> Is there a simple way I can get computers that are connected to a
> >> router to recognise when the router is turned off (possibly giving a
> >> warning) then automatically connect when it is turned on again?
> >
> > If they're connected using ethernet then take a look at mii-tool. On
> > Debian (Etch) the ifplug stuff can do this for you.
> >
> According to its FC6 manpage mii-tool is obsolete and was replaced by
> ethtool, which can deal with a bigger range of devices. In any case I
> don't see how ethtool can help. Its manpage says that it diddles with
> NICs plugged into your computer, not with routers at the other end of a
> lump of CAT5.
>
> To the OP: what it this 'reconnect' of which you speak? When I power
> cycle my ADSL router all the computers on my LAN can see it immediately
> it restarts. No problem. If you mean "detect when its off", then a
> script that periodically pings the router and records the result in a
> known place should solve that. Alternatively, ping something at your ISP
> and then you'll also know the status of the ADSL connection, but don't
> do that too frequently or you'll annoy your ISP.
>
> Please explain the problem you're trying to solve.
The actual situation is that there are computers in 3 different offices
connected to the router. None of the users have any real IT knowledge
(or interest). The router is in office1 and sometimes get switched off
by mistake by a 'switch everything off' type person.
If the girl in office2 arrives first and starts her machine she has no
idea there is no Internet connection until she tries to fetch e-mail.
The same applies for office3. What these people currently do then is to
go to office1 switch on the router then reboot their machines.
I would like to be able to set things up so that.
1. They are made aware that the router is off.
2. When it is switched on again their machines will connect to it
without any further action from them.
--
Will J G |
|
| Back to top |
|
 |
Geoffrey Clements External

Since: Apr 06, 2004 Posts: 221
|
Posted: Fri Jul 20, 2007 8:38 am Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
"Folderol" <folderol RemoveThis @ukfsn.org> wrote in message
news:20070719232204.4385c35a@localhost...
> On Wed, 18 Jul 2007 21:31:42 +0100
> Martin Gregorie <martin RemoveThis @see.sig.for.address> wrote:
>
>> Chris Davies wrote:
>> > Folderol <folderol RemoveThis @ukfsn.org> wrote:
>> >> Is there a simple way I can get computers that are connected to a
>> >> router to recognise when the router is turned off (possibly giving a
>> >> warning) then automatically connect when it is turned on again?
>> >
>> > If they're connected using ethernet then take a look at mii-tool. On
>> > Debian (Etch) the ifplug stuff can do this for you.
>> >
>> According to its FC6 manpage mii-tool is obsolete and was replaced by
>> ethtool, which can deal with a bigger range of devices. In any case I
>> don't see how ethtool can help. Its manpage says that it diddles with
>> NICs plugged into your computer, not with routers at the other end of a
>> lump of CAT5.
>>
>> To the OP: what it this 'reconnect' of which you speak? When I power
>> cycle my ADSL router all the computers on my LAN can see it immediately
>> it restarts. No problem. If you mean "detect when its off", then a
>> script that periodically pings the router and records the result in a
>> known place should solve that. Alternatively, ping something at your ISP
>> and then you'll also know the status of the ADSL connection, but don't
>> do that too frequently or you'll annoy your ISP.
>>
>> Please explain the problem you're trying to solve.
>
> The actual situation is that there are computers in 3 different offices
> connected to the router. None of the users have any real IT knowledge
> (or interest). The router is in office1 and sometimes get switched off
> by mistake by a 'switch everything off' type person.
>
> If the girl in office2 arrives first and starts her machine she has no
> idea there is no Internet connection until she tries to fetch e-mail.
> The same applies for office3. What these people currently do then is to
> go to office1 switch on the router then reboot their machines.
>
> I would like to be able to set things up so that.
>
> 1. They are made aware that the router is off.
> 2. When it is switched on again their machines will connect to it
> without any further action from them.
>
Personally would either:
a. put a label over the router switch saying "Do NOT switch off", or
b. operate a "three strikes and you're out" rule to whoever switches it off,
or
c. both
You or your PHB can decide what "out" means.
--
Geoff |
|
| Back to top |
|
 |
Lurch External

Since: Jun 19, 2007 Posts: 2
|
Posted: Fri Jul 20, 2007 9:41 am Post subject: Re: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
On Fri, 20 Jul 2007 08:38:13 +0100, "Geoffrey Clements"
<geoffrey.clementsNO.DeleteThis@SPAMbaesystems.com> mused:
>>> Please explain the problem you're trying to solve.
>>
>> The actual situation is that there are computers in 3 different offices
>> connected to the router. None of the users have any real IT knowledge
>> (or interest). The router is in office1 and sometimes get switched off
>> by mistake by a 'switch everything off' type person.
>>
>> If the girl in office2 arrives first and starts her machine she has no
>> idea there is no Internet connection until she tries to fetch e-mail.
>> The same applies for office3. What these people currently do then is to
>> go to office1 switch on the router then reboot their machines.
>>
>> I would like to be able to set things up so that.
>>
>> 1. They are made aware that the router is off.
>> 2. When it is switched on again their machines will connect to it
>> without any further action from them.
>>
>
>Personally would either:
>a. put a label over the router switch saying "Do NOT switch off", or
>b. operate a "three strikes and you're out" rule to whoever switches it off,
>or
>c. both
>
d. move\hide the router.
--
Regards,
Stuart. |
|
| Back to top |
|
 |
Chris Davies External

Since: Apr 13, 2004 Posts: 267
|
Posted: Fri Jul 20, 2007 9:42 am Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Martin Gregorie <martin DeleteThis @see.sig.for.address> wrote:
> According to its FC6 manpage mii-tool is obsolete and was replaced by
> ethtool, which can deal with a bigger range of devices.
Fair 'nuf. Debian (etch) doesn't report that.
> In any case I don't see how ethtool can help. Its manpage says that
> it diddles with NICs plugged into your computer, not with routers at
> the other end of a lump of CAT5.
$ sudo mii-tool eth0
eth0: negotiated 100baseTx-FD flow-control, link ok
$ sudo mii-tool eth1 # Not connected
SIOCGMIIPHY on 'eth1' failed: Invalid argument
$ sudo mii-tool eth2
eth2: no autonegotiation, 10baseT-HD, link ok
mii-tool (and possibly ethtool; I don't know about that) reports whether
or not a NIC has a link-level connection. According to the OP each PC
is connected to the router. If there's no link then one can infer that
the router is switched off.
Chris |
|
| Back to top |
|
 |
Tim Southerwood External

Since: Apr 23, 2007 Posts: 113
|
Posted: Fri Jul 20, 2007 10:01 am Post subject: Re: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Lurch wrote:
>>
>>Personally would either:
>>a. put a label over the router switch saying "Do NOT switch off", or
>>b. operate a "three strikes and you're out" rule to whoever switches it
>>off, or
>>c. both
>>
> d. move\hide the router.
Agree with PP and GPP
"Working around" the router being randomly off is solving the wrong problem.
Networking infrastructure is designed *and* intended to be left on forever.
Low end units take next to no power so green/economic concerns aren't really
an issue either.
Time to buy a labelling machine methinks.
And a *big* box of red on yellow labels.
Cheers
Tim |
|
| Back to top |
|
 |
Dave Liquorice External

Since: Jan 11, 2005 Posts: 36
|
Posted: Fri Jul 20, 2007 1:45 pm Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
On Thu, 19 Jul 2007 23:22:04 +0100, Folderol wrote:
> The router is in office1 and sometimes get switched off by mistake by a
> 'switch everything off' type person.
Educate this person. Far simpler than trying to find a technological
solution.
--
Cheers new5pam.RemoveThis@howhill.com
Dave. pam is missing e-mail |
|
| Back to top |
|
 |
Johnny B Good External

Since: Mar 30, 2004 Posts: 55
|
Posted: Fri Jul 20, 2007 2:33 pm Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
The message <nyyfbegfubjuvyypbz.jlhnzr0.pminews DeleteThis @srv1.howhill.net>
from "Dave Liquorice" <new5pam DeleteThis @howhill.com> contains these words:
> On Thu, 19 Jul 2007 23:22:04 +0100, Folderol wrote:
> > The router is in office1 and sometimes get switched off by mistake by a
> > 'switch everything off' type person.
> Educate this person. Far simpler than trying to find a technological
> solution.
Quite right! Modems and routers are intended to run 24/7. An obvious
way to 'educate' any and all users is to clearly label the plug(s)
involved with a brief message indicating that the attached equipment is
not to be switched off (except in an obvious emergency).
Adding a rider to the effect that abuse of this condition is a sackable
offence might be just a tad OTT (but it's your call
--
Regards, John.
Please remove the "ohggcyht" before replying.
The address has been munged to reject Spam-bots. |
|
| Back to top |
|
 |
Folderol External

Since: Dec 13, 2004 Posts: 118
|
Posted: Fri Jul 20, 2007 8:43 pm Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
On Fri, 20 Jul 2007 13:45:27 +0100 (BST)
"Dave Liquorice" <new5pam.RemoveThis@howhill.com> wrote:
> On Thu, 19 Jul 2007 23:22:04 +0100, Folderol wrote:
>
> > The router is in office1 and sometimes get switched off by mistake by a
> > 'switch everything off' type person.
>
> Educate this person. Far simpler than trying to find a technological
> solution.
A technical solution is the *only* one acceptable. There is office
politics involved. We are carefully trying to forstall the killer
statement:
'We never had this problem with the old (windows) system'.
Apparently, XP notifies you when the connection breaks, and also when
it is available again and has reconnected.
--
Will J G |
|
| Back to top |
|
 |
Martin Gregorie External

Since: Aug 20, 2005 Posts: 284
|
Posted: Fri Jul 20, 2007 8:58 pm Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Chris Davies wrote:
> Martin Gregorie <martin.RemoveThis@see.sig.for.address> wrote:
>> According to its FC6 manpage mii-tool is obsolete and was replaced by
>> ethtool, which can deal with a bigger range of devices.
>
> Fair 'nuf. Debian (etch) doesn't report that.
>
>
>> In any case I don't see how ethtool can help. Its manpage says that
>> it diddles with NICs plugged into your computer, not with routers at
>> the other end of a lump of CAT5.
>
> $ sudo mii-tool eth0
> eth0: negotiated 100baseTx-FD flow-control, link ok
>
> $ sudo mii-tool eth1 # Not connected
> SIOCGMIIPHY on 'eth1' failed: Invalid argument
>
> $ sudo mii-tool eth2
> eth2: no autonegotiation, 10baseT-HD, link ok
>
>
> mii-tool (and possibly ethtool; I don't know about that) reports whether
> or not a NIC has a link-level connection. According to the OP each PC
> is connected to the router. If there's no link then one can infer that
> the router is switched off.
>
In that case I misread you. I thought you were implying that it could
force a router reboot by some devious manner.
However, I think I'd still stick to my slow poll of something "out
there" and save the result some place because that also shows that BT
haven't done anything antisocial to the PPP link.
> Chris
--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org | |
|
| Back to top |
|
 |
Paul Martin External

Since: Sep 21, 2004 Posts: 173
|
Posted: Fri Jul 20, 2007 9:38 pm Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Imported from groups: per prev. post (more info?) |
|
|
| This message is not archived |
|
| Back to top |
|
 |
Dave Liquorice External

Since: Jan 11, 2005 Posts: 36
|
Posted: Fri Jul 20, 2007 11:16 pm Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
On Fri, 20 Jul 2007 20:43:27 +0100, Folderol wrote:
> A technical solution is the *only* one acceptable. There is office
> politics involved. We are carefully trying to forstall the killer
> statement:
>
> 'We never had this problem with the old (windows) system'.
>
> Apparently, XP notifies you when the connection breaks, and also when
> it is available again and has reconnected.
I'm not sure which connection we are talking about now. The local LAN
router being switched off or a router/gateway to the 'net?
I've never had problems with switching off anything here, the ADSL modem,
the local router/firewall/gateway, the LAN switch. Everything "just works"
(provided everything is powered up...). Obviously short delays as things
boot/reconnect but it's all transparent to any work station.
On doze you get a little flag above the network thing in the task bar if
the switch or LAN cable goes down but that is all. Pretty sure you don't
get told if the 'net connection dies. Of course if your LAN switch, router
and ADSL modem are all in one box then lack of power to that will raise
that flag but it is really only telling you the LAN is off.
--
Cheers new5pam.DeleteThis@howhill.com
Dave. pam is missing e-mail |
|
| Back to top |
|
 |
Folderol External

Since: Dec 13, 2004 Posts: 118
|
Posted: Fri Jul 20, 2007 11:51 pm Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
On 20 Jul 2007 21:38:39 GMT
Paul Martin <pm RemoveThis @zetnet.net> wrote:
> In article <20070720204327.4904e997@localhost>,
> Folderol wrote:
>
> > Apparently, XP notifies you when the connection breaks, and also when
> > it is available again and has reconnected.
>
> Only at the physical layer. It can't tell you if the router is off,
> only whether the connection to the switch/hub is alive or dead.
Well this will do for us!
Looking back, somebody mentioned ethtool and, after a bit of
googling and reading up on bash scripts, I think this will do what we
want.
The following is not too elegant but put in a cron job to run (say)
every 5 minutes shouldn't impact on the system significantly.
I won't be able to test it though till I'm at work next week!
#!/bin/sh
sudo /usr/sbin/ethtool eth0 >> ~/tmp/status
if [ -z "`grep 'Link detected: yes' ~/tmp/status`" ];
then sudo /usr/sbin/ethtool -r eth0;
fi
--
Will J G |
|
| Back to top |
|
 |
Nix External

Since: Jul 29, 2004 Posts: 680
|
Posted: Sat Jul 21, 2007 12:59 am Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
On 20 Jul 2007, folderol RemoveThis @ukfsn.org told this:
> The following is not too elegant but put in a cron job to run (say)
> every 5 minutes shouldn't impact on the system significantly.
You could alternatively look at /sys/class/net/$interface/carrier, which
contains 0 when the carrier is dropped and 1 when it's up. Alternatively
alternatively, you could inotifywait on it.
Ideally, you could listen on the uevent netlink socket for appropriate
events, but unfortunately, no uevent seems to be fired on carrier loss.
I'd call this a significant missing feature.
--
`... in the sense that dragons logically follow evolution so they would
be able to wield metal.' --- Kenneth Eng's colourless green ideas sleep
furiously |
|
| Back to top |
|
 |
Folderol External

Since: Dec 13, 2004 Posts: 118
|
Posted: Sat Jul 21, 2007 2:17 pm Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
On Sat, 21 Jul 2007 00:59:02 +0100
Nix <nix-razor-pit.DeleteThis@esperi.org.uk> wrote:
> On 20 Jul 2007, folderol.DeleteThis@ukfsn.org told this:
> > The following is not too elegant but put in a cron job to run (say)
> > every 5 minutes shouldn't impact on the system significantly.
>
> You could alternatively look at /sys/class/net/$interface/carrier, which
> contains 0 when the carrier is dropped and 1 when it's up. Alternatively
> alternatively, you could inotifywait on it.
Hmmm. That would make things a bit neater:
#!/bin/sh
if [ `cat /sys/class/net/eth0/carrier` = "0" ];
then sudo /usr/sbin/ethtool -r eth0;
fi
> Ideally, you could listen on the uevent netlink socket for appropriate
> events, but unfortunately, no uevent seems to be fired on carrier loss.
> I'd call this a significant missing feature.
>
--
Will J G |
|
| Back to top |
|
 |
Chris F.A. Johnson External

Since: Oct 06, 2004 Posts: 589
|
Posted: Sat Jul 21, 2007 3:02 pm Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
On 2007-07-21, Folderol wrote:
> On Sat, 21 Jul 2007 00:59:02 +0100
> Nix <nix-razor-pit DeleteThis @esperi.org.uk> wrote:
>
>> On 20 Jul 2007, folderol DeleteThis @ukfsn.org told this:
>> > The following is not too elegant but put in a cron job to run (say)
>> > every 5 minutes shouldn't impact on the system significantly.
>>
>> You could alternatively look at /sys/class/net/$interface/carrier, which
>> contains 0 when the carrier is dropped and 1 when it's up. Alternatively
>> alternatively, you could inotifywait on it.
>
> Hmmm. That would make things a bit neater:
>
> #!/bin/sh
>
> if [ `cat /sys/class/net/eth0/carrier` = "0" ];
> then sudo /usr/sbin/ethtool -r eth0;
> fi
Why use cat?
read n < /sys/class/net/eth0/carrier
if [ "${n:-0}" -eq "0" ]
then
sudo /usr/sbin/ethtool -r eth0
fi
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
===================================================================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) |
|
| Back to top |
|
 |
Nix External

Since: Jul 29, 2004 Posts: 680
|
Posted: Sat Jul 21, 2007 6:24 pm Post subject: Re: Auto network re-connect [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
On 21 Jul 2007, folderol RemoveThis @ukfsn.org outgrape:
> Hmmm. That would make things a bit neater:
>
> #!/bin/sh
>
> if [ `cat /sys/class/net/eth0/carrier` = "0" ];
> then sudo /usr/sbin/ethtool -r eth0;
> fi
Alternatively, try
if [[ "x$(cat /sys/class/net/eth0/carrier)" = "x0" ]]; then
sudo /usr/sbin/ethtool -r eth0;
fi
(significantly faster with many shells, although not bash, and doesn't
collapse with a syntax error if the carrier file doesn't exist or by
some oddity contains something which requires quoting to avoid being
seen as a shell metacharacter.)
--
`... in the sense that dragons logically follow evolution so they would
be able to wield metal.' --- Kenneth Eng's colourless green ideas sleep
furiously |
|
| Back to top |
|
 |
|