Grobbendonk
10-17-2003, 09:00 AM
Hi,
I've got two problems here (sort of - the second is my failure to solve the first!)
I've got the following hardware setup:
internet - cable-modem - [ eth1 - smoothwall on old PC - eth0 ] - hub - other machines.
Every now and then, eth0 stops working - /var/log/dmesg shows something about the network card entering "promiscous mode", with no apparent reason, and then a few minutes later, it stops being able to send/receive packets on the interface. I've found no pattern to it. eth1 is fine, as is eth0 on the red-hat server sat next to it (identical network cards, which I've swapped a couple of times!)
It would be nice to fix this properly, but I can't find anything to tell me WHY it's happening or how to stop it.
Anyway, second problem, is an attempt at a dodgy fix:
The connection can be re-enabled by simply "ifconfig eth0 down" then "ifconfig eth0 up"
So, as a near-clueless newbie, I created this script:
#!/bin/sh
ping -c 3 192.168.0.5
if [ $? != 0 ] ; then
ifconfig eth0 down
ifconfig eth0 up
fi
(my first ever script which does anything more complex than set a few environment variables! So probably the worst way to do it?)
This works when run in foreground. But not when it's added to cron. (10 * * * * /usr/local/bin/nics_stayalive.sh >/var/log/SA.log) When run by cron, it executes (SA.log contains the three ping responses and expected timestamp), but doesn't seem to do the down/up bit. There's no output from the ifconfig in foreground or background, so I've no idea where to look next!
Any help will be very gratefully received, thanks in advance!
I've got two problems here (sort of - the second is my failure to solve the first!)
I've got the following hardware setup:
internet - cable-modem - [ eth1 - smoothwall on old PC - eth0 ] - hub - other machines.
Every now and then, eth0 stops working - /var/log/dmesg shows something about the network card entering "promiscous mode", with no apparent reason, and then a few minutes later, it stops being able to send/receive packets on the interface. I've found no pattern to it. eth1 is fine, as is eth0 on the red-hat server sat next to it (identical network cards, which I've swapped a couple of times!)
It would be nice to fix this properly, but I can't find anything to tell me WHY it's happening or how to stop it.
Anyway, second problem, is an attempt at a dodgy fix:
The connection can be re-enabled by simply "ifconfig eth0 down" then "ifconfig eth0 up"
So, as a near-clueless newbie, I created this script:
#!/bin/sh
ping -c 3 192.168.0.5
if [ $? != 0 ] ; then
ifconfig eth0 down
ifconfig eth0 up
fi
(my first ever script which does anything more complex than set a few environment variables! So probably the worst way to do it?)
This works when run in foreground. But not when it's added to cron. (10 * * * * /usr/local/bin/nics_stayalive.sh >/var/log/SA.log) When run by cron, it executes (SA.log contains the three ping responses and expected timestamp), but doesn't seem to do the down/up bit. There's no output from the ifconfig in foreground or background, so I've no idea where to look next!
Any help will be very gratefully received, thanks in advance!