Solved

rarp and Perl

Posted on 2001-08-24
12
548 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 7

Author Comment

by:jjeff1
Comment Utility
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
Comment Utility
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
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 16

Expert Comment

by:maneshr
Comment Utility
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
Comment Utility
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
Comment Utility
Never mind, it's qx/STRING/

0
 
LVL 16

Accepted Solution

by:
maneshr earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now