Networking Forums

Networking Forums > Computer Networking > Linux Networking > Discovering DHCP linux device

Reply
Thread Tools Display Modes

Discovering DHCP linux device

 
 
thewozza
Guest
Posts: n/a

 
      12-17-2007, 10:03 PM
Hi,

I have built a small linux machine that I take with me to work on
customer's sites, but one thing I would like is a way to detect the
machine on their network.

If I were the systems administrator there, I could go through the DHCP
server logs and find it. But I'm not, and it just seems a little
unprofessional to have to ask for help to find my own hardware.

I know I could sniff the traffic and look for DHCP transactions, but
this is (by and large) a one time event which means I have to be
watching while the thing comes online. And it is again a little
unprofessional as it is quite cumbersome to be poring through sniffer
data to find my own hardware.

What I would do is write a script with netcat that broadcasts the
device's presence periodically, and have another application on my
laptop to listen for these broadcasts. As long as we're on the same
LAN I should be able to detect those broadcasts, and then I will know
the IP to manage the machine.

I can create this script, but I'm posting this to see if there are any
linux projects already underway that meet my requirements. I know
that my NAS (Infrant) uses a similar approach to managing those
systems, so something like that would do the trick.

Thanks,

Paul
 
Reply With Quote
 
 
 
 
thewozza
Guest
Posts: n/a

 
      12-18-2007, 12:14 AM
On Dec 17, 3:03 pm, thewozza <paulwoz...@gmail.com> wrote:
> Hi,
>
> I have built a small linux machine that I take with me to work on
> customer's sites, but one thing I would like is a way to detect the
> machine on their network.
>
> If I were the systems administrator there, I could go through the DHCP
> server logs and find it. But I'm not, and it just seems a little
> unprofessional to have to ask for help to find my own hardware.
>
> I know I could sniff the traffic and look for DHCP transactions, but
> this is (by and large) a one time event which means I have to be
> watching while the thing comes online. And it is again a little
> unprofessional as it is quite cumbersome to be poring through sniffer
> data to find my own hardware.
>
> What I would do is write a script with netcat that broadcasts the
> device's presence periodically, and have another application on my
> laptop to listen for these broadcasts. As long as we're on the same
> LAN I should be able to detect those broadcasts, and then I will know
> the IP to manage the machine.
>
> I can create this script, but I'm posting this to see if there are any
> linux projects already underway that meet my requirements. I know
> that my NAS (Infrant) uses a similar approach to managing those
> systems, so something like that would do the trick.
>
> Thanks,
>
> Paul


Okay so I got impatient and just ended up writing my own stuff. It
isn't pretty, but I can output periodic broadcasts with netcat on my
headless linux device, and I have a reasonably cumbersome method of
capturing and parsing the data from tshark on my laptop. So now I can
show up and be confident that I can find my hardware without having to
go through too many hoops.

RADAR-ADVERTISE.pl
#!/usr/bin/perl

$interval = 10; # defines the broadcast period in seconds

# open netcat as a filehandle
open (FILE, "|nc -b -u 255.255.255.255 9999 -p 9999");

# mark the NC filehandle as hot, so we're not buffering the output
{ my $ofh = select FILE;
$| = 1;
select $ofh;
}

# go forever! because I can't think of any good reason to stop
# it would probably be better to kill the loop and move this into a
cronjob if you're doing it once a minute
while (1) {
print FILE "LOOK IT IS ME!\n";
sleep $interval;
}

exit 0; # clear memory on exit

RADAR-DETECT.pl
#!/usr/bin/perl

# use tshark to grab data from the network port. we're watching for
udp port 9999 and IP broadcast
# this is very flexible, I used both vectors to ensure that most real
network data is filtered out
# you probably need to be root to sniff with tshark - sorry
# if being root is a big deal for you, you could probably use netcat
to grab the data
open (FILE, "tshark -l -R \"ip.dst == 255.255.255.255 and udp.dstport
== 9999\"|");

while (<FILE>) {
chomp;
$_ =~ s/^\W*//; # whitespaces are bad
($tdata, $source, $cruft) = split / /, $_;
print "$source\n"; # print the source IP of the device broadcasting
}

exit 0;
 
Reply With Quote
 
Joe Beanfish
Guest
Posts: n/a

 
      12-18-2007, 05:23 PM
thewozza wrote:
> Hi,
>
> I have built a small linux machine that I take with me to work on
> customer's sites, but one thing I would like is a way to detect the
> machine on their network.
>
> If I were the systems administrator there, I could go through the DHCP
> server logs and find it. But I'm not, and it just seems a little
> unprofessional to have to ask for help to find my own hardware.
>
> I know I could sniff the traffic and look for DHCP transactions, but
> this is (by and large) a one time event which means I have to be
> watching while the thing comes online. And it is again a little
> unprofessional as it is quite cumbersome to be poring through sniffer
> data to find my own hardware.
>
> What I would do is write a script with netcat that broadcasts the
> device's presence periodically, and have another application on my
> laptop to listen for these broadcasts. As long as we're on the same
> LAN I should be able to detect those broadcasts, and then I will know
> the IP to manage the machine.
>
> I can create this script, but I'm posting this to see if there are any
> linux projects already underway that meet my requirements. I know
> that my NAS (Infrant) uses a similar approach to managing those
> systems, so something like that would do the trick.
>
> Thanks,
>
> Paul


A different way to look at it might be to stick an lcd on the device
so it can display it's ip.

http://www.seetron.com/slcds.htm
http://www.hobbyengineering.com/H2078.html
 
Reply With Quote
 
Stefan Monnier
Guest
Posts: n/a

 
      12-23-2007, 12:50 AM
> I have built a small linux machine that I take with me to work on
> customer's sites, but one thing I would like is a way to detect the
> machine on their network.


If you know the network's IP range, then `nmap' should have no trouble
finding your device.


Stefan
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Commercial] : Hands on Technical Training on Linux Device Driver meetseemarai1@gmail.com Linux Networking 0 04-22-2009 09:07 AM
[Commercial] Linux System and Device Driver Programming fromProfessionals Concepts Systems Linux Networking 0 12-23-2007 05:28 AM
[Commercial] Linux System and Device Driver Programming fromProfessionals Concepts Systems Linux Networking 0 12-02-2007 08:14 AM
NAS device uses linux os Eric Linux Networking 0 08-19-2006 10:01 PM
DHCP Question: Moving the same device in various subnets controlledby the same server Anna Markou Linux Networking 0 06-23-2003 08:31 PM



1 2 3 4 5 6 7 8 9 10 11