Solved

Detecting DHCP

Posted on 2000-05-17
2
153 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending email via Perl on Windows 3 196
Removing file extension within a file. 4 104
instmodsh - listing perl modules 2 91
How to generate square thumbnail using perl 13 90
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
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…
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…

730 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