Solved

rarp and Perl

Posted on 2001-08-24
12
554 Views
Last Modified: 2007-12-19
Hi,
I have an access database where one of my tables is filled with MAC addresses. I can extract the MACs easily enough, but then I need to do a RARP to find out what the IP address associated with each MAC is.

Is there a perl rarp module? Any other way to do this?

I am going to be running my app on Windows NT server and will also have to use perl2exe to convert the script into an executable.



0
Comment
Question by:jjeff1
12 Comments
 
LVL 16

Expert Comment

by:maneshr
ID: 6423155
jjeff1,

"..but then I need to do a RARP to find out what the IP address associated with each MAC  is. .."

Are all these MAC addresses those of systems in your network?

is this database updated on a periodic basis?

Please provide as much more detail as you can.

This will help you get a more accurate answer, faster.

Thanks,
0
 
LVL 7

Author Comment

by:jjeff1
ID: 6423211
No, here is some more detail.

The MACs are those on my network. In fact, they are all in the same subnet, I even know the IP addresses, but I have to look them up manually.

This is for a phone system I have. The phone system uses an IP device to connect from the network to the phones. Each phone device has an IP assigned to it. When ever I upgrade the software on my system, I am forced to manually telnet to the phone devices and do a reboot.
The phone server has a database with all the devices in it. The devices are only stored by MAC address and a couple other fields ( a description of the device and some fields for the phone system ) . The company who makes the software has been unable to build any utils to force the hubs to reboot. I want to write one myself instead of manually rebooting 70 devices. To reboot a phone device, all I do is telnet in, type a password and give it 2 commands. Simple.

The hard part is getting the IP addresses. Like I said, I know what they are, but I want an automated way of doing this without having to maintain 2 databases ( one for the phone system, and one for my little program ).


The phone database is only updated when I add or remove a phone device.

Perhaps my question was not specific enough. Let me rephrase.

I have a NT 4 server running SP6a, I want a piece of perl code that can give me the IP of a node on  my network ( in the same subnet as the server in fact ) given it's MAC.

0
 
LVL 16

Expert Comment

by:maneshr
ID: 6423238
jjeff1,

"..I even know the IP addresses,  but I have to look them up manually..."

How do you look them up manually?

Pl. let me know.

"..Each phone device has an IP .."

Just out of curiosity, are these Cisco IP 7960 series of IP phones?
You can choose not to answer this, if you want.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Author Comment

by:jjeff1
ID: 6423274
They are all ATM devices which use LANE to join an ELAN. Not exactly IP, but not exactly ATM. It's a hybrid.

I look them up by looking at that description field in the database, then looking at a piece of paper with the description and IP written down.

I can do other stuff, for example, I can put the IP in the description field, but this is not always reliable. If I replace a phone device, I have to manually change the IP on it. In many cases those description fields are not accurate.

Basically, I know I can write a script to do the telnet part. I can pull IP addresses from a text file if need be.

But I wanted to do something automated, using the database of MACs. Since the MAC database is always correct and does not require any intervention on my part.

I also wanted to send the program to the guys who make the phone system and show them that it can be done. Since I've only been complaining about this for about a year.  Little did I know before thinking about this that they wouldn't store the IP addresses of their equipment anyplace, WHEN IT'S AN IP PHONE SYSTEM. Dumbasses.
0
 
LVL 16

Expert Comment

by:maneshr
ID: 6423306
jjeff1,

".. look them up by looking at that description field in the database,..."

Have you tried using the arp -a command option from the Windows command prompt?

if not, then can you pl .try that?

the -a option gets the arp table for you. once you have that you can lookup your MAC address from it and the corresponding IP.

if the arp -a command works for you, i can write a small script to do this lookup for you.

Hope that helps.
0
 
LVL 7

Author Comment

by:jjeff1
ID: 6423385
arp -a does give me my arp table. Is there a perl command for arping, or do I have do a system call, then parse the output?
0
 
LVL 16

Expert Comment

by:maneshr
ID: 6423409
jjeff1,

"..s there a perl command for arping, or do I have do a system call,  then parse the output? "

PERL does not have any in-built command for arp'ing, so i guess the later would be the way to go.

Thanks,
0
 
LVL 7

Author Comment

by:jjeff1
ID: 6423459
Ok, I can do that.

There is a command, I can't remember exactly what. But it executes a system command and places the output of STDOUT directly into a variable. I think it's like a regular expression kind of thing. Do you know what it is?

0
 
LVL 7

Author Comment

by:jjeff1
ID: 6423464
Never mind, it's qx/STRING/

0
 
LVL 16

Accepted Solution

by:
maneshr earned 100 total points
ID: 6423611
jjeff1,

".. Do you know  what it is?..."

Another one would be.....


$var=`arp -a`; ## NOTE we are using backticks not single quotes.

chomp($var); ## Remove the newline character from the end of the variable.

Hope that helps.
0
 

Expert Comment

by:shyamalbh
ID: 8600089
Can you tell me how arp-a get me the IP address of all the devices connected to same network.

I only get a single address when i run it on my machine.

I too need to find out the IP address of a machine on the same network based on the mac address which i have stored in a file.
So by looking up the file i will get the MAC address and then i need to find the IP address currently associated with the device.

Its a DHCP lan

Please help me

Thanks in advance
Shyamal
0
 
LVL 20

Expert Comment

by:jmcg
ID: 9495998
Nothing has happened on this question in over 12 months.

I will leave a recommendation in the Cleanup topic area that
the answer by maneshr be accepted.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question