LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 03-01-2003, 04:30 PM   #1
davecs
Member
 
Registered: Feb 2003
Location: Dagenham, Essex, Britain
Distribution: PCLinuxOS
Posts: 485

Rep: Reputation: 31
Lightbulb NTL and USB cable modem - A solution?


To all NTL cable users with USB modems:



A common problem some of us have with USB Cable Modems using NTL Broadband is that the connection regularly goes down resulting in the computer having to be restarted.

On another thread, Wai put forward a means of bringing up the modem without restarting the computer, which seemed to work for Red Hat, but with Mandrake it half worked and one or two more actions were needed to actually get the internet connection running again.

Wai came up with a script, which worked for Red Hat but not for Mandrake, I amended it and my version works on both Mandrake and Red Hat, at least with an Ambit Cable modem. It may work with other distros. Or it may not!

We are still testing it, but we are convinced that it works.

First word of caution: it does not prevent the connection going down, and it takes anything up to half a minute to get it going again. At least it is better than restarting the computer. I have also found on Mandrake that if you bring the network down yourself it does not work, only when it cuts off automatically.

Second word of caution: this script is only for those who get a connection which later drops. If you cannot get a connection at all, get your Mac Address (see further down) and phone it in to NTL. (You may still need the script once up and running.)

Third word of caution: you use this script at your own risk. Wai, this web site and I cannot take responsibility if it does not work for you or if your computer catches fire when you try it or any other problem it may cause.

Here is the script:

--------------------------

#!/bin/bash
# Auther @Wai Ming Pang Date 22 Feb 2003
#########################################
## Originally written for Red Hat 7.x
## Adapted by Dave Spagnol for Mandrake 9.0 28 Feb 2003
#########################################
## A script that reconnects your internet connection should the
## mac address gets taken by other processes
##
## You will need to change the mac address and
## interface name before you start this script as root
## Run the script > reloadifusb &
##
## When you do fail to connect to the web please allow time for the
## script to kick in.
##
## The author accepts no responsible for the use of this script.

## change this to your mac address (hardware address, physical address)
## check with ifconfig -a or (ipconfig /all in windows)
## DO NOT INCLUDE SPACE BETWEEN : and D (used here to prevent "smiley")
macAddress=00: D0:59:XX:XX:XX
## your interface name usually eth0 or eth1
usbif=eth1

reset=0
while true
do
count=`ifconfig $usbif | grep "00:00:00:00" | wc -l`
if [ $count -gt 0 ]
then
echo Resetting $usbif for $reset times
ifconfig $usbif down
ifconfig $usbif hw ether $macAddress
ifconfig $usbif up
ifdown $usbif
ifup $usbif
reset=$(( $reset + 1 ))
fi
sleep 10
done

-----------------------------

Open a File Manager window, cut and paste the above into a text document. If your cable modem is on eth0 instead of eth1, amend the line starting usbif= . You will have to put the modems MAC address (aka serial number) in the line beginning macAddress= . You can get this in KDE by running KDE Control Centre, Information, USB Devices, and selecting your modem from the list. The MAC address is actually the serial number.

Save your file as "reloadifusb".

Open a terminal as root, copy reloadifusb to /root/bin/.

From /root/bin/, execute chmod u+x reloadifusb

Still in the terminal as root, edit the file /etc/rc.d/rc.local and add the line right at the end:

/root/bin/reloadifusb >> /root/log/reloadifusb.log 2>&1 &

Save, restart and that's it.

May I end by saying that I have posted this here but Wai is the brains here, it is his baby.... I am just the guy who couldn't wait to tell everyone!!

DAVE
 
Old 03-01-2003, 06:09 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
i'd still vote for an ethernet connection anyday...
 
Old 03-01-2003, 06:50 PM   #3
Wai
LQ Newbie
 
Registered: Feb 2003
Posts: 17

Rep: Reputation: 0
I agree that ethercard it a better solution to the problem. It is more stable and not as resource demanding as usb service.
The solution that Dave and I have presented is a quick hack to get the system up and running. And hopefully we be able to keep more linux users. But personally myself I just can be bothered, point taken and no offense

Wai
 
Old 03-02-2003, 10:29 AM   #4
Wai
LQ Newbie
 
Registered: Feb 2003
Posts: 17

Rep: Reputation: 0
found a usual link

http://www.ntlhelp.co.uk/CModem/CMnewframe.htm
 
Old 03-02-2003, 01:12 PM   #5
davecs
Member
 
Registered: Feb 2003
Location: Dagenham, Essex, Britain
Distribution: PCLinuxOS
Posts: 485

Original Poster
Rep: Reputation: 31
Re: Ethernet vs USB

My computer has built in ethernet and I have tried to connect Windows to NTL cable via ethernet without success. If/when I suss it out, I may switch my connection.

At present, I am learning Linux and have a long way to go. One thing I have learned is that there is always a solution, and that Linux software is improving all the time. I expect in a year or so I will be able to get all my programming requirements together under Linux, and consign Microsoft to the dustbin. I will have replaced my UMAX 2100U scanner which steadfastly refuses to work under Linux (despite me reading stuff which says it can be got going). I will have either bought a Linux-compatible card reader for the compact flash card in my digital camera which again does not connect with Linux.

AND I will have become clever enough to sort out Linux problems.

Meanwhile, I have to dual-boot Mandrake 9.0 and Win98SE.

I am not having a go at anyone, and I tend to agree with you, acid_kewpie! However, it is important for me and I guess loads of others in my position, that we can keep our Windows partitions going until we learn enough to take the final step to 100% Linux. That will mean compromises but ensures we can take our first steps on the Linux road, because if we are forced to choose at this stage, I'm afraid it will have to be Windows.

If that means having to live with 2nd-best internet connection hardware and having to botch up a fix to keep connected, so be it.

Anyway, rant over. I love this site and everyone on it! As a newbie, I have already been able to pass on a few bits that I have learnt to others, and feel encouraged to do so.

There is always someone who knows more than you, and always someone who knows less. Take help and give help.
 
Old 03-02-2003, 01:14 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
hell no.... if it works that's great...
 
Old 03-03-2003, 06:57 PM   #7
davecs
Member
 
Registered: Feb 2003
Location: Dagenham, Essex, Britain
Distribution: PCLinuxOS
Posts: 485

Original Poster
Rep: Reputation: 31
Re: NTL and USB cable modem - A solution?

Sorry I made a little mistake above, having established that "reloadifusb" works I assumed it could be added to run on startup in Mandrake the same as in Red Hat. It cannot.

In Mandrake 9.0, move the file "reloadifusb" to /root/ and not /root/bin/

The line in rc.local needs to read:

/root/reloadifusb >> /root/reloadifusb.log 2>&1 &

I saw it reconnect today, so I know it works. Previously I had assumed that because the script worked from a terminal it would work from any folder. Just shows how wrong you can be.

DAVE
 
Old 03-30-2003, 07:46 AM   #8
davemn
LQ Newbie
 
Registered: Mar 2003
Posts: 4

Rep: Reputation: 0
Thanks so much for that, it has been a great help as i am new to linux and wouldnt of had a hope in hell of fixing this.

Thanks again.
 
Old 04-14-2003, 09:25 AM   #9
k4fr0s
LQ Newbie
 
Registered: Apr 2003
Posts: 13

Rep: Reputation: 0
Reason

By the way the reason for the hung up at least for NTL users is here:
http://homepage.ntlworld.com/ian.sha.../ntldhcpcd.htm
,and the new dhcpcd doesn't seem to solve the problem.

Last edited by k4fr0s; 04-15-2003 at 11:51 AM.
 
Old 04-17-2003, 06:01 PM   #10
pcytdpah
LQ Newbie
 
Registered: Apr 2003
Posts: 1

Rep: Reputation: 0
Thanks

Thanks everyone, this thread (and partiually the first one where this code was originally posted) helped me to get ntl working via usb on linux.

I also learnt some things:

ifdown "stops" interfacesetenv PATH "/usr/local/sbin:/usr/sbin:/sbin:${PATH}:${HOME}/bin"
ifup "starts" it again

^__^

oh yeah, if anyone knows how to configure my system so that ifconfig etc work without the whole path (/sbin/ifconfig) being entered I'd appreciate the help.

note that my ..cshrc entery in /root already contains a line:

setenv PATH "/usr/local/sbin:/usr/sbin:/sbin:${PATH}:${HOME}/bin"

which I assume should allow /sbin commands to be typed anywhere...

of course I'm probably completly wrong
 
Old 04-22-2003, 02:06 PM   #11
k4fr0s
LQ Newbie
 
Registered: Apr 2003
Posts: 13

Rep: Reputation: 0
A generic script for you

------------------ SCRIPT START HERE ---------------------
#!/bin/sh
#############################################################
# Author: Konstantinos Mantzaris (godoal@hotmail.com) #
# Date : 22 April 2003 #
# Description : Simple bash script to check and bring up #
# your Cable connection. #
# Usage : Preferably loaded from rc.local or some other rc #
# file as a deamon i.e. keepup & #
# NOTE: The Author accepts no responsibility for the use of #
# this script. #
#############################################################
#------- YOU NEED TO CHANGE THE FOLLOWING PARAMETERS -------#
# ETH : The interface of the USB modem #
# HW : The MAC address of the modem #
# CHK : How long should we wait for the next check in sec #
#############################################################
ETH=eth?
CHK=1
HW=XX:XX:XX:XX:XX:XX

while `sleep $CHK` ; do
if [ "`ifconfig|grep $ETH`" = "" ] ; then
dhcpcd -k $ETH 2>&1> /dev/null # kill dhcpcd
ifconfig $ETH hw ether $HW up 2>&1> /dev/null # bring up the interface
dhcpcd -dnt 10 $ETH 2>&1> /dev/null # bring up the connection
fi
if [ ! "`cat /etc/dhcpc/dhcpcd-$ETH.pid`" = "" ] ; then
dhcpcd -nS $ETH 2>&1> /dev/null # maybe we are lucky and get the lease on time
fi
done
------------------ SCRIPT END HERE ---------------------------

Just save the script in a file called lets say "keepup" then in a console run
chmod 755 keepup
and load it when your computer starts from an rc. file, lets say rc.local
Hmm, ok (for those who didn't understand that last bit) edit "rc.local"
and put the following line somewhere in there
/path/to/script/keepup &
(to activate the script you need to reboot your system or run it as a deamon from a console window)
NOTE:Just make sure that you change at least the ETH and HW parameters on the script.

Check davecs explanation on how to find the correct parameters for your system.

Last edited by k4fr0s; 04-22-2003 at 03:48 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ntl Cable modem (usb) on CL Mahony Linux - Hardware 16 01-27-2004 01:50 PM
NTL cable modem issue. Skankin Pickle Mandriva 3 11-02-2003 09:03 AM
NTL USB Cable Modem robpaz26 Linux - Networking 1 05-14-2003 03:37 AM
NTL Cable modem ozkarfizz Linux - Software 1 04-10-2002 01:21 AM
NTL Cable modem ozkarfizz Linux - Newbie 1 04-09-2002 07:31 PM


All times are GMT -5. The time now is 07:44 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration