HELP!! Network => 2wire and Linksys (x3) at arts co-operative in Bristol

Started by mulch, Apr 29, 2011, 20:31:30

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mulch

thanks for all the info guys... still gonna try a few more times to disable the DHCP on this router...

I managed to get command-line connection via the putty software as advised by Steve. Cool!!!

However, the instructions on Disabling DHCP Server via the link Steve posted is not clear! (excuse my ignorance here folks!):
http://wiki.openwrt.org/doc/recipes/bridgedclient#step.2disable.the.dhcp.server
These instructions show commands that are not recognised by the router. I type help and about 35 built-in commands appear, but none of them are the codes shown in the link:

These are the instructions that Steves link states: if anyone can explain how to apply these from a command line that would be cool!!!
Edit /etc/config/dhcp and set the predefined LAN DHCP pool to ignore:
config 'dhcp' 'lan'
option 'interface' 'lan'
option 'start' '100'
option 'limit' '150'
option 'leasetime' '12h'
option 'ignore' '1'

Apply the change by restarting dnsmasq:
root@OpenWrt:~# /etc/init.d/dnsmasq restart

mulch

hey steve... by the way, i tried the cmd>ipconfig and it doesnt resolve with any result.

i typed
xp>cmd>ipconfig
and it created an error so i tried
cmd>ipconfig
and it hangs for ages... i had to terminate the command prompt window!

not sure im entering them correctly!

cheers :]

Steve

The options are contained within a file which you need to edit ie /etc/config/dhcp it sounds promising if you managed to connect via PuTTY . I would suggest WinSCP to find and edit the file and then save the changes. Another method as suggested by one other forum member via PM to me was to use a Live Linux Distro then ssh and then gedit,

http://winscp.net/eng/docs/task_edit


Sorry I seemed to confuse you with ipconfig and my shorthand , just enter ipconfig from a command prompt
Steve
------------
This post reflects my own views, opinions and experience, not those of IDNet.

mulch

you are indeed patient!!! i thank you so much!!!... ok i will see the fact that it connects to putty as a positive... and leave it there for the day!!! to be continued... thanks Steve and all..

mulch :]

mulch

one last thing... i just tried the winscp tool and it loaded but came up with the following:
Connection has been unexpectedly closed. Server sent command exit status 127.
Cannot initialize SFTP protocol. Is the host running a SFTP server?

then i click 'OK' (there is no 'NO' to click in response to the error) and it takes me back to the main WinSCP Login Screen. So i try again and click 'Reconnect' when i get to the same error message. and then it returns to the error message again.

I notice that the protocol SSH is not available in the File Protocol drop down menu....

anyway... g'night!

mulch :]

D-Dan

When you enter the commands try just entering the command itself. eg:

ipconfig

At the prompt. Note that if this doesn't work, complaining that there is no such command, and you are running this on the router, try:

ifconfig

ifconfig is the linux version of ipconfig. There is no way that ifconfig should hang unless the firmware is bad. If this works:

vi /etc/config/dhcp

Then make the edits to the file using the vi editor. Now vi isn't easy to use, but the most basic commands that you will need to know are:


  • cursor keys move up/down/left and right.
  • To overwrite text press shift-r (for R) and then type - this is overwrite mode. When finished press esc to exit overtype mode.
  • To save the file and quit vi type :x
  • If you make a mistake and want to undo type u (though this is very limited in that it will only undo the last action).
  • If you make a complete hash of things type :q! to quit without saving so that you can start over.


Then restart dnsmasq at the prompt by typing:

/etc/init.d/dnsmasq restart

Note that I am simply instructing how to follow the instructions. I have no experience of the router itself so can't vouch for the fix itself working :)

Steve
Have I lost my way?



This post doesn't necessarily represent even my own opinions, let alone anyone else's

Steve

Steve
------------
This post reflects my own views, opinions and experience, not those of IDNet.

mulch

hey guys..... just downloaded gVIm and yes... its tricky... but i get the idea.

so... i enter the text D-Dan advised in previous post...

"vi /etc/config/dhcp"

the response of VI is to say

"E486 Pattern Not Found: etc"

now then... i am just testing the software here... the router is NOT plugged in...

any advice!??

no rush... im back and forth at this console this evening...

mulch :]

Steve

I assume because that file does not exist on the PC you are using,if you enter that command after telnet/ssh into the router you should be able to edit the file. You should also be able to see a directory/file listing ie at the dot prompt (root@Openwrt) type "ls-l" which is Linux CLI command
Steve
------------
This post reflects my own views, opinions and experience, not those of IDNet.

D-Dan

Steve is absolutely correct. The commands are intended to be run on the router, and so depend on the filesystem and structure being present. A quick run through to help you understand what you are doing is probably in order.

"ls" is just the same command as dir (in fact, dir works on Linux, too). You probably won't need the -l switch if you are only using it to check the file exists. "ls /etc/config" will list the files in that folder.

Routers typically run Linux internally (regardless of the OS of the computers plugged into them) and so all commands and changes are done "the Linux way". This is somewhat different than Windows, and significantly for what you are doing, all settings are stored as simple text files, whereas Windows has the registry. Linux has the edge here because it makes custom configuration somewhat easier if you don't have to navigate through endless keys with meaningless names to find the settings that you want.

These text files are stored in set locations in the filesystem, /etc being one of them ("/" in this case refers to the root folder - what you would probably call C: and "etc" is simply a directory (folder) in the root file system. The actual file that you are interested in is dhcp which is inside the config folder in the etc folder - you get the idea).

vi is a commandline text editor - more. No pretty GUI to get in the way etc (hence it's somewhat complicated nature), so typing vi /etc/config/dhcp is akin to opening notepad in Windows and then opening a text file with it.

The final command, "/etc/init.d/dnsmasq" is somewhat like opening the "services" dialogue in Windows and restarting a service. dnsmasq reads it's configuration from the dhcp file, hence it needing to be re-started after changes are made to the config file.

The error suggests that at least vi is working, and seems to simply be complaining that it can't find the file that you are trying to edit (obvious really, since it's on an unconnected router). Things will probably move along swimmingly once you get into the filesystem on the router.

As an aside, if you have never tried Linux and thought that one day you might, please don't assume that this experience is typical, because it isn't. Linux has all the bells and whistles that Windows has when a full desktop environment is included, and using it for day to day stuff is much like using Windows (except that Linux excels at desktop eye candy compared with Windows). As an example, I'm replying to this in Firefox 4 on Linux which has all the same extensions and themes installed as my Windows installation (in fact they both share the same profile folder). I read my email in Thunderbird on both (again sharing a profile folder). In fact, I had no choice but to booted into Windows for most of yesterday as I had truecrypt encrypting my business/client drive and I noticed at one point that I had 5 applications open (Browser, email, media player, IRC and truecrypt), using the identical programs that I use on Linux, configured in exactly the same way and providing exactly the same functionality. Who said Linux had to be hard or so different (especially considering MS copied most of the GUI of Windows from Linux ;)

Steve
Have I lost my way?



This post doesn't necessarily represent even my own opinions, let alone anyone else's

mulch

Thanks so much for the immense details about 'vi' however, i am probably missing the main method of establishing connection with the router itself. Seems a little aimless when typing in path that 'vi' doesnt recognise...

I guess this is all partly because i am a noob to the depth of this, and i am unsure how to get the SSH link setup to enable access to the /etc/config/dhcp path....

so...

Telnet fails to connect
WinScp seems like it wants to but fails via various methods. oh hang on....
Tried SSH tunnel - doesnt like the password... (wierd) / Tried alternative to SFTP (used instead)... and wow...

wow... that seems to work, even though i'm not sure of the exact settings i used as I was clutching at straws by this point!!! ok.. cool.... i can see in the split screen console of WinScp.... phew... was literally just about to give up!!!

The path you guys mention is there, but there is no DHCP file within (im talking about the /etc/config path), only a file called 'firewall'.. the only folder i can find any dhcp related file in is the /tmp folder... the file is called 'dhcp.leases' and upon double clicking it shows the following info...

946730729 00:19:d2:1a:70:xx 192.168.1.125 CNU6510NP8 01:00:19:d2:1a:70:xx
946728040 00:07:e9:92:a8:xx 192.168.1.145 asls-6 01:00:07:e9:92:a8:xx

they look like MAC addresses (the x's are mine:)... not sure whether the /tmp folder is for temporary items... if so, i imagine this is useless to me. cannot find the dhcp settings anywhere....

am i getting close?? or further away!!???

***********************
ok just discovered another dhcp 'related' file in the path: /www/cgi-bin/webif and the file is called 'leases.sh' and it contains the following info:
#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
header "Status" "DHCP" "@TR<<DHCP leases>>"
?>
<table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center">
<tbody>
   <tr>
      <th>@TR<<MAC Address>></th>
      <th>@TR<<IP Address>></th>
      <th>@TR<<Name>></th>
      <th>@TR<<Expires in>></th>
   </tr>
<? [ -e /tmp/dhcp.leases ] && awk -vdate="$(date +%s)" '
$1 > 0 {
   print "<tr>"
   print "<td>" $2 "</td>"
   print "<td>" $3 "</td>"
   print "<td>" $4 "</td>"
   print "<td>"
   t = $1 - date
   h = int(t / 60 / 60)
   if (h > 0) printf h "h "
   m = int(t / 60 % 60)
   if (m > 0) printf m "min "
   s = int(t % 60)
   printf s "sec "
   printf "</td>"
   print "</tr>"
}
' /tmp/dhcp.leases ?>
</tbody>
</table>

<? footer ?>
<!--
##WEBIF:name:Status:2:DHCP

****************

i dont want to confuse too much beyond this, so hopefully someone can tell me to stop wasting my time or perhaps im missing something obvious!!!

thanks all - mulch :]

D-Dan

the webif file that you have found is the web interface (it's php I think, looking at it) and is unlikely to be of use for what you want. The /tmp directory is, as you have deduced, a temporary store and again of no use at the moment.

You could try creating the dhcp file in /etc/config with a single entry as detailed and then restart the server. No guarantees, but it may work.

Steve
Have I lost my way?



This post doesn't necessarily represent even my own opinions, let alone anyone else's

Steve

Alternative methods discussed here https://forum.openwrt.org/viewtopic.php?id=4427&p=1 but you will need telnet for CLI. I thought you managed to get PuTTY to work? 
Steve
------------
This post reflects my own views, opinions and experience, not those of IDNet.

mulch

ok.... im back on the router as root via WinScp...

following the link to OpenWRT forum was helpful.... despite there being lots of code without clear description of where it gets entered... i assume via putty(<--noob me)... however, when i go in as root via putty i can only see the directories mentioned in my last post... i cannot see the etc folder and the other ones viewable via WinScp... perhaps root is not true root??? im lost there!!! anyway...

... upon observing the post about editing the dnsmasq.conf file (which I have copied and pasted below) i realise i can try to edit the file from WinScp... however...
My own dnsmasq.conf file is pretty much exactly the same...

I imagine that the # statements are REM lines (notes to coders?). If so then the active code (lines without # as a prefix) is EXACTLY the same in mine as this. This means that assuming that the information in the forum post represents the correct method to turn off DHCP without turning off DNS, then the router already has this.

If the # statements are code then there are a few differences. i shall list them if needed. Please say...


None of this explains why there is no DHCP file in the CONFIG folder to start with... So perhaps creating one as Steve suggested could be the way forward. but if i create one, what file extension do i give it and what are the EXACT contents of that file?? Do i create it in Notepad?  or from the WinScp console?

not quite got my head around VIM yet, but am prepared to go there thoroughly if it is the last resort...


Hmmmmmm.... anyway... here are the dnsmasq.conf details as posted in the forum.... as always... thanks folks....
ps - the reason i am not pasting the details of my dnsmasq.conf is because all computers except this MAC i am using currently, have been unplugged from the primo router so it would mean typing it out again which i dont want to do (i could use a usb stick to transfer info over yeah... but im worried there is a usb virus in the autorun blah blah.... (reason: in the desperate quest to find out what is causing our broadband connection to drop out sporadically, BT have instructed us to unplug EVERYTHING from the router except ONE computer for 3 days to re-assess the scenario. Obviously they dont want to be liable for any problems downstream of their feed... anyway... a long story there... one which does involve the linksys routers - because i originally thought it was they that was causing the sporadic loss of internet connection.... however, after unplugging them all and only having 3 or 4 computers connected, after a few days of good connection, it started dropping out again.... with no routers connected... BT are suggesting that it could be an issue with computers hanging off the router.... i simply shrug... its been 3 months of this kind of service and im prepared to accept any way forward in the hope of getting a solid connection.... but i doubt some of their conclusions.... sorry to ramble....)

*********************dnsmasq.conf details from forum (https://forum.openwrt.org/viewtopic.php?id=4427&p=1)

# filter what we send upstream
domain-needed
bogus-priv
filterwin2k
localise-queries

# allow /etc/hosts and dhcp lookups via *.lan
local=/lan/
domain=lan
expand-hosts

# enable dhcp (start,end,netmask,leasetime)
#dhcp-authoritative
#dhcp-range=192.168.1.100,192.168.1.250,255.255.255.0,12h
dhcp-leasefile=/tmp/dhcp.leases

# use /etc/ethers for static hosts; same format as --dhcp-host
# <hwaddr> <ipaddr>
read-ethers

# other useful options:
# default route(s): dhcp-option=3,192.168.1.1,192.168.1.2
#    dns server(s): dhcp-option=6,192.168.1.1,192.168.1.2

Steve

With WinSCP can you manage this option "I disabled dnsmasq by preventing it from running at boot by renaming /etc/init.d/S50dnsmasq to disable_S50dnsmasq" (taken from your link) , it seems crude but effective.
Steve
------------
This post reflects my own views, opinions and experience, not those of IDNet.

D-Dan

Disablijng dnsmasq as Steve suggests may achieve what you want, and trying it certainly can't hurt (just be sure to remember the filename so that you can restore as necessary).

Should you want to try creating the dhcp file, use whatever text editor you are comfortable with, do not give the file an extension, and add the line:

config 'dhcp' 'lan' option 'interface' 'lan' option 'start' '100' option 'limit' '150' option 'leasetime' '12h' option 'ignore' '1'

Then save and restart dnsmasq. If it doesn't work, then just delete the new file (rm /etc/config/dhcp)
Have I lost my way?



This post doesn't necessarily represent even my own opinions, let alone anyone else's

mulch

Superb.... thanks guys....

i will put this into action next...

one last thing: Is there any way of checking this works without making the router part of the LAN?

Due to the BT request that nothing else touches our network for a few days...

mulch :]

mulch

ok... i have done both crude last resort actions. unless there is some way of checking this has worked without joining the LAN then I will wait til the end of the week to check it out.

I assume that restarting the dnsmasq is irrelevant once i have disabled it... (i did try via a console from WinScp -but it didnt like it)...

Getting to quite like WinScp by the way, although VIM is probably hugely more powerful once you get your head around it...

mulch :]

mulch

well this is quite funny.... but was annoying!!!

I deduce that I have been successful in making the routers non-dhcp leasing because i cannot even log onto them with a browser now!! I suppose firefox needs the pc to be served an IP before it can connect...

via command prompt there is no host route detected to the IP addresses of the routers themselves.

However, I could connect to the linksys routers when I borrowed a Belkin cable router and put as the first router... this managed DHCP and gave my pc an IP and allowed me to log on to the consoles of the other routers via firefox...

at last... some progress!!!

One router (the 3rd and final Linksys) was proving particularly difficult. I couldnt even get on it from WinScp (although it has always been the problem router) so i think i will ditch that one.... unless anyone can suggest a way in which you can detect the ip address of a router.... hmmm... thoughts of 'knowing the MAC address might help' come to mind...

anyway... more later..... any responses to this or the last two posts appreciated...

mulch :]

D-Dan

The IP addresses of the routers should now be managed by the DHCP that you have, so failing all else, take a look at the status of the Belkin which should tell you the IP addresses of connected devices. One of them will be the "missing" router.
Have I lost my way?



This post doesn't necessarily represent even my own opinions, let alone anyone else's