Solved

Detecting DHCP

Posted on 2000-05-17
2
150 Views
Last Modified: 2010-03-05
What is the best way to detect DHCP running on a computer using perl and then actually getting that dynamic IP address?  Is there a Win32 module or function call that I can use?
0
Comment
Question by:paulca
2 Comments
 
LVL 16

Accepted Solution

by:
maneshr earned 50 total points
ID: 2817445
i think, on NT boxes you can use the ipconfig /all to find and get the IP address.

all that you need to do is use basic PERL parse capabilities to parse thru the output and extract the relevant info.

as an sg. i have this small program which will give you the IP address of the machine on which its running.

## call the external command & get its output
$output=`ipconfig /all`;

## Remove the enter char at the end of the output
chomp($output);

## Parse for and extract the ip address
$output=~ /\s+IP Address.*:\s+(\d+.*)/;
$ip_address=$1;

## print the ip address!!
print $ip_address,"\n";
0
 
LVL 10

Expert Comment

by:makerp
ID: 2817631
just see if 'ipconfig /all' displayed an ip address next to the DHCP server entry .

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Perl efficient DB Call 8 81
Excel to CSV conversion with specific columns 5 74
quoting a comma separated list 20 82
create a gui in perl 3 72
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

21 Experts available now in Live!

Get 1:1 Help Now