[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 565
  • Last Modified:

rarp and Perl

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
jjeff1
Asked:
jjeff1
1 Solution
 
maneshrCommented:
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
 
jjeff1Author Commented:
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
 
maneshrCommented:
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
jjeff1Author Commented:
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
 
maneshrCommented:
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
 
jjeff1Author Commented:
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
 
maneshrCommented:
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
 
jjeff1Author Commented:
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
 
jjeff1Author Commented:
Never mind, it's qx/STRING/

0
 
maneshrCommented:
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
 
shyamalbhCommented:
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
 
jmcgOwnerCommented:
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now