CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
receiving free ip from giving subnet

 



zohman
Novice

Jun 6, 2017, 1:35 AM

Post #1 of 2 (1211 views)
receiving free ip from giving subnet Can't Post

i'm trying to solve some problem thinking how to start..

my task is to give as argument subnet ip in CIDR notation (for example: 192.168.1.0\24)
and hostname as FQDN format (for example: host01.domain.com)

and to get, first, 1 free ip from the subnet, meaning that it is not online/ping-able and not have any PTR record.
second, for the fqdn i want to make sure it is not registered in DNS.

is any one have some subroutine in-hand?


Code
my ($free_ip, $valid_fqdn) = query_ip_dns('192.168.1.0\24','host01.domain.com');


$free_ip should return free ip from within the given subnet range or return undef in case all hosts in subnet are in use.
$valid_fqdn can return true/false - registered in DNS already or not.

the idea is that if all checks will pass,
later on the script will register 'A record' in DNS with the provided FQDN and the retuerned IP.

Thanks in advance,
Zohman.


FishMonger
Veteran / Moderator

Jun 6, 2017, 8:38 AM

Post #2 of 2 (1205 views)
Re: [zohman] receiving free ip from giving subnet [In reply to] Can't Post

What have you tried?

Have you searched cpan for any related modules?

Here are some of the related modules you should look at.

Net::Netmask https://metacpan.org/pod/distribution/Net-Netmask/lib/Net/Netmask.pod
NetAddr::IP https://metacpan.org/pod/NetAddr::IP
Net::IP https://metacpan.org/pod/Net::IP#looping
Net::Ping https://metacpan.org/pod/Net::Ping
Net::DNS https://metacpan.org/pod/Net::DNS
Net::Nslookup https://metacpan.org/pod/Net::Nslookup

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives