Looking for software that adds dhcp pcs to a host file

I have a local wirelses/wired lan running behind a soho router that does dhcp to give my local laptops addresses in the 192.168 space. I also have a linux server on that lan that I occassionally power on.

I would like a piece of software that goes out and pings the local address space and finds out what addresses are in use and what hostnames those addresses are using and makes me a list suitable for appending to the /etc/hosts file on said server. That seems like something who is familiar with tcp-ip and networking could write in about an hour, but would probably take me a day or more to write and I might do very inefficiently.

Thus, if someone is willing to write said software and send me a copy in source code I will send them $100. You can keep the software and re-distribute it however you like as long as I get the rights to keep and modify my own copy. Note, if you are interested, contact me via email first, just to make certain I haven't found another author, as I would hate for you to waste your time and I'm only willing to pay for one copy of said program (and will pay only after I have verified that it solves my problem). That will also give us a chance to make certain we are on the same page as to what the program will do, i.e. that we have clear acceptance and payment criteria.

Thank you for your interest,

-Chris

***************************************************************************** Chris Clark Internet : snipped-for-privacy@world.std.com Compiler Resources, Inc. Web Site :
formatting link
23 Bailey Rd voice : (508) 435-5016 Berlin, MA 01503 USA fax : (978) 838-0263 (24 hours)

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

Reply to
Chris F Clark
Loading thread data ...

Chris F Clark hath wroth:

Ok, so you're looking for Linux based software, not Windoze.

One piece or can I have it several pieces? What you're looking for is "networks discovery" type of tools. I could write something like that using simple shell scripts. Actually, I might have one sitting on one of my servers from 10+ years ago. I'll check (later). Why you would want such as an abomination is beyond me. DHCP works well enough. There are also lots of sites full of Perl and shell scripts that will probably be close. The hard part will be dealing with duplicate entries, deleting transient machines, and making it fool proof.

It would take me 5 minutes to write it, and the rest of the week to debug it. I'm a really lousy programmist.

Hmmm... I'm late for a lavish weekend lunch. I'll see what I can dredge up later. Meanwhile, I found this Bourne shell script that I scribbled many years ago called "pingall" which pings everything found in /etc/hosts which might be useful as part of the routine for dropping old entries.

MACHINES=`cat /etc/hosts | grep -v "^#" | cut -f2` # get hostnames for i in $MACHINES do echo "testing ${i}...\\c" result=`/usr/bin/ping -c 1 ${i} | grep "bytes from" | \\ cut -d " " -f 2-3` if [ "${result}" = "bytes from" ] then echo OK else echo BAD fi done

Seems to run fine. However, its a weekend so most of office machines and print serves are turned off:

==> pingall testing localhost...OK testing comix.comix.santa-cruz.ca.us...OK testing pride.comix.santa-cruz.ca.us...BAD testing avarice.comix.santa-cruz.ca.us...BAD testing anger.comix.santa-cruz.ca.us...BAD testing sloth.comix.santa-cruz.ca.us...BAD testing envy.comix.santa-cruz.ca.us...BAD testing vectra.comix.santa-cruz.ca.us...BAD testing glutton.comix.santa-cruz.ca.us...BAD testing lust.comix.santa-cruz.ca.us...BAD testing cleanix.comix.santa-cruz.ca.us...OK testing 810m.comix.santa-cruz.ca.us...BAD testing atsys1.comix.santa-cruz.ca.us...BAD testing atsys2.comix.santa-cruz.ca.us...BAD testing hp5...BAD testing milan1...BAD testing milan2...BAD testing axis1...BAD testing ps104...BAD testing 192.168.111.33...OK testing router...OK

Reply to
Jeff Liebermann

You can definitely give it to me as several pieces, as long as I understand how to fit the pieces together.

Yes, that seems like a good name for them.

This is a fair question....

Yes, it does for one thing, but as far as I can tell the soho router doesn't proved rarp and I want to run dhcp there because it is the only constant on the lan, since without it, there is no lan. All the other boxes, including the server in question, I keep it powered down most of the time. Thus, aside from the router everything else is transient depending upon what laptops I have brought home on any given day and what addresses the router assigns them when I hook them in.

Therefore,, I want this software, so when sitting at this server (and thus have it powered up), I can ssh into one of the laptops I brought home and copy files off it onto the server. And, I don't want to have to go to the laptop and ask it what its ip address is, since it might not be in the same room (or even on the same floor). And, I'd like to address the laptop by name, as that's how I know which each one is. They're real creative names like t42p, a30p, sony, hdxpl1040 (that's a work one and they picked the name) but I know which one each is.

Actually, I don't care about perfection. Duplicate entries are interesting, because some of the laptops have cloned machine names, so that could be an issue. However, I'm willing to live with a script the lists the entries that I can them remove dups from. Of course, nice would be a script that marked dup entries by commenting them out.

That actually, looks like a good start, I just need to revise it to loop over the address range rather than the name in the hosts file. I was kind of hoping it would be that easy. Drats, when I tried that it didn't add the hostname to the ping report, just gave me back the same address number I typed in.

In fact, that's the part that has me stumped getting the hostname in the first place. There must be something one can send, that says give me your hostname. I just don't know what it is....

Thanks,

-Chris

***************************************************************************** Chris Clark Internet : snipped-for-privacy@world.std.com Compiler Resources, Inc. Web Site :
formatting link
23 Bailey Rd voice : (508) 435-5016 Berlin, MA 01503 USA fax : (978) 838-0263 (24 hours)

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

Reply to
Chris F Clark

Chris F Clark hath wroth:

If that's all you want, you're doing this all wrong. There's a feature called "static DHCP" or "Pre-assigned DHCP" found in many routers. These guarantee that the router will assign the same IP address to a specific MAC address. You get all the benifits of having a static IP address for your desktops, with central IP/DHCP administration in the router. If you need to go to a specific known desktop, you just point to the IP address.

The only place where this goes wrong is for laptops with an ethernet port in both the laptop and a docking station, as well as a wireless device. Each of these has a different MAC address and will have a corresponding different IP address. Assigning 3 different IP addresses for a specific laptop has caused me some grief. Specifically, the pre-assigned DHCP table in most cheap routers is limited in size and will not handle a large number of machines. For example, the Dlink DI-624 can only handle 32 entries:

If you need more than 32 entries, but still want to leave the power off on anything that might be used as a DHCP server, then methinks you're ready for a fancy new router with more features and a high price tag.

It will be a major issue if the table grows and grows with duplicate entries every time the script is run. You'll end up with a rather ugly huge script. The "uniq" command should fix that. Something like: echo "localhost 127.0.0.1" > /etc/hosts (wipe hosts file) cat /etc/hosts.static >> /etc/hosts (restore static IP from file). sh script.sh | uniq | sort > /etc/hosts (append results of script)

Fine. I was gone for a boring lunch. I'll have some time to work on it later tonite. It's no big deal. However, I suggest you reconsider doing this as "pre-assigned DHCP" is a much easier way of doing it.

Reply to
Jeff Liebermann

I bet $100 would buy the OP a router/broadband box that was smart enough to have a table that assigned specific IP addresses by MAC address each time a machine renewed a lease.

What about setting the expiration to "never". Can aby small boxes do that? You would have, effectively, a static IP for each MAC.

Do one of the above and then you can have a static host file on each machine to map IP to names.

The OP can use IPCop or m0n0 (both free) on an old PC to replace the broadband box and provide more capability, including a full function firewall, dhcp and dns servers that will do anything he wants to do.

An old laptop would be fine for IPCop/m0no. The dead battery would be a sufficient UPS and the electric bill would be about $10/month cheaper than running an old desktop system.

formatting link

Reply to
Al Dykes

Ok, I'll look into "static dhcp". The router I'm using is a linksys wrt54g. The laptops have the 3 address problem, but there are only 5 of them plus the 2 desktops (one with 2 ethernet cards), so as long as I get 32 addresses I should have enough.

Thanks, for the suggestion. Next weekend, I'll try it. If it works, I'll still send you an expression of my gratitude, since it still will have saved me some effort....

Reply to
Chris F Clark

I can understand how to use ipcop as a firewall, but how do I fit it "inside" my lan. Most of my laptops are wireless, so I need the wireless router. If I put the ipcop system between the router and the modem, then doesn't the NAT in the router get in the way. If I put it inside the lan, it can't be a firewall can it? Although, then, it could do the dhcp and dns. However, if I do that, it seems I might as just well have the server I'm not powering up do the dhcp and dns, which is actually something I'd like to avoid, since the fewer boxes in the solution, the fewer points of failure there are.

Reply to
Chris F Clark

Chris F Clark hath wroth:

The stock WRT54G firmware does NOT have a "static DHCP" feature.

If you install DD-WRT v23 SP2 or other alternative firmware on your WRT54G, you'll have this feature (along with a huge collection of other nifty features). See:

Also OpenWRT:

which is less menu driven and more config file editing based.

One gotcha is that the WRT54G v5 and v6 hardware mutations are not the best firmeware transplant candidates on the planet. It's also somewhat of an ordeal to install on these versions. It's worth a try, but if you have a deadline or mission critical, downtime sensitive, or cannot fail installation, I suggest you simply purchase a better cheap router, such as a Buffalo WHR-HP-G54 or WHR-G54S.

The size of the MAC address table can be expanded with compile time options. If you've never tried to compile DD-WRT or OpenWRT, you'll probably find it rather difficult. There are people available that will do it for you, but I don't think it will be necessary.

Thanks, but no cash or goodies required (unless they're geek toys). However, I'm probably going to pass on doing any more shell scripting (because I'm a terrible programmer and am lazy). Incidentally, the I wrote the shell script 15 years ago for SCO Unix 3.2v4.2, which has some substantial differences in program location and output from the current Linux LSB (Linux Standards Base) 3.0/3.1. I just tried to run it on my W2K machine using Cygwin, which produced problems similar to what you've experienced. I'm too lazy to fix it tonite.

Good luck...

Reply to
Jeff Liebermann

Cabling-Design.com Forums website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.