Hello,
I'm having a lot of problems with my internet provider. It seems that I get the
IP from their dhcp, but when it runs out, I don't get a single that I my server should request a new one. So in that situation I have a IP on my eth1, but internet doesn't work.
I looked online and found a little script that checks if internet works (google) and if it doesn't it releases ip from eth1 and ask for a new one.
The strange thing is that although the script gets called every 15 minutes (root user) it dons not do the job. If I call it manually, it works immediately and every time.
Here it is:
#!/bin/bash
WGET="/usr/bin/wget"
$WGET -q --tries=10 --timeout=5
http://www.google.com -O /tmp/index.google &> /dev/null
if [ ! -s /tmp/index.google ];then
echo "Internet connectionm down...geting new ip for eth1"
dhclient -r eth1
sleep 5
dhclient eth1
touch /home/yoda/dhcp-new
else
echo "Internet connection ok"
fi
I really don't know what to do and why this is happening.
Any ideas?
I'm running latest ubuntu server.
Thanks!