You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Sai Pullabhotla <sa...@jmethods.com> on 2010/03/22 15:15:46 UTC

Converting an IP range to CIDR notation

Does any one have Java code for converting a given range of IP
addresses to CIDR notation, like the one here http://ip2cidr.com/.

Thanks.

Regards,
Sai Pullabhotla

Re: Converting an IP range to CIDR notation

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 3/22/10 3:15 PM, Sai Pullabhotla wrote:
> Does any one have Java code for converting a given range of IP
> addresses to CIDR notation, like the one here http://ip2cidr.com/.
>
> Thanks.
>
> Regards,
> Sai Pullabhotla
>
>    
You may have a look at the Apache JAMES project, it seems that they 
provide such converters :

http://osdir.com/ml/jakarta.james.devel/2003-02/msg00469.html

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.nextury.com



RE: Converting an IP range to CIDR notation

Posted by Rick Bullotta <ri...@burningskysoftware.com>.
Would this work for you?

http://labs.karmasphere.org/dp/javadoc/com/karmasphere/dp/type/CIDR.html


-----Original Message-----
From: Sai Pullabhotla [mailto:sai.pullabhotla@jmethods.com] 
Sent: Monday, March 22, 2010 10:16 AM
To: dev
Subject: Converting an IP range to CIDR notation

Does any one have Java code for converting a given range of IP
addresses to CIDR notation, like the one here http://ip2cidr.com/.

Thanks.

Regards,
Sai Pullabhotla


RE: Converting an IP range to CIDR notation

Posted by Rick Bullotta <ri...@burningskysoftware.com>.
Nope.  Not going to work either.

-----Original Message-----
From: Rick Bullotta [mailto:rick.bullotta@burningskysoftware.com] 
Sent: Monday, March 22, 2010 2:15 PM
To: dev@mina.apache.org
Subject: RE: Converting an IP range to CIDR notation

Hi, Sai.

In that same package, there's a CIDRIterator class that may do the trick.
I'll take a look at let you know.

Rick

-----Original Message-----
From: Sai Pullabhotla [mailto:sai.pullabhotla@jmethods.com] 
Sent: Monday, March 22, 2010 1:49 PM
To: dev@mina.apache.org
Subject: Re: Converting an IP range to CIDR notation

Does not look like it. What I'm looking for is - given a from and to
IP addresses, it needs to generate corresponding Subnets using the
CIDR notation. So, for example, if the from address is 192.168.1.1 and
the to address is 192.168.1.12, the subnets should be -

192.168.1.1/32
192.168.1.2/31
192.168.1.4/30
192.168.1.8/30
192.168.1.12/32

I downloaded the source code of Apache James too, and did not find
anything that would do this.

Regards,
Sai Pullabhotla





On Mon, Mar 22, 2010 at 12:10 PM, Rick Bullotta
<ri...@burningskysoftware.com> wrote:
> Would this work for you?
>
> http://labs.karmasphere.org/dp/javadoc/com/karmasphere/dp/type/CIDR.html
>
>
> -----Original Message-----
> From: Sai Pullabhotla [mailto:sai.pullabhotla@jmethods.com]
> Sent: Monday, March 22, 2010 10:16 AM
> To: dev
> Subject: Converting an IP range to CIDR notation
>
> Does any one have Java code for converting a given range of IP
> addresses to CIDR notation, like the one here http://ip2cidr.com/.
>
> Thanks.
>
> Regards,
> Sai Pullabhotla
>
>



RE: Converting an IP range to CIDR notation

Posted by Rick Bullotta <ri...@burningskysoftware.com>.
Hi, Sai.

In that same package, there's a CIDRIterator class that may do the trick.
I'll take a look at let you know.

Rick

-----Original Message-----
From: Sai Pullabhotla [mailto:sai.pullabhotla@jmethods.com] 
Sent: Monday, March 22, 2010 1:49 PM
To: dev@mina.apache.org
Subject: Re: Converting an IP range to CIDR notation

Does not look like it. What I'm looking for is - given a from and to
IP addresses, it needs to generate corresponding Subnets using the
CIDR notation. So, for example, if the from address is 192.168.1.1 and
the to address is 192.168.1.12, the subnets should be -

192.168.1.1/32
192.168.1.2/31
192.168.1.4/30
192.168.1.8/30
192.168.1.12/32

I downloaded the source code of Apache James too, and did not find
anything that would do this.

Regards,
Sai Pullabhotla





On Mon, Mar 22, 2010 at 12:10 PM, Rick Bullotta
<ri...@burningskysoftware.com> wrote:
> Would this work for you?
>
> http://labs.karmasphere.org/dp/javadoc/com/karmasphere/dp/type/CIDR.html
>
>
> -----Original Message-----
> From: Sai Pullabhotla [mailto:sai.pullabhotla@jmethods.com]
> Sent: Monday, March 22, 2010 10:16 AM
> To: dev
> Subject: Converting an IP range to CIDR notation
>
> Does any one have Java code for converting a given range of IP
> addresses to CIDR notation, like the one here http://ip2cidr.com/.
>
> Thanks.
>
> Regards,
> Sai Pullabhotla
>
>


Re: Converting an IP range to CIDR notation

Posted by Sai Pullabhotla <sa...@jmethods.com>.
Does not look like it. What I'm looking for is - given a from and to
IP addresses, it needs to generate corresponding Subnets using the
CIDR notation. So, for example, if the from address is 192.168.1.1 and
the to address is 192.168.1.12, the subnets should be -

192.168.1.1/32
192.168.1.2/31
192.168.1.4/30
192.168.1.8/30
192.168.1.12/32

I downloaded the source code of Apache James too, and did not find
anything that would do this.

Regards,
Sai Pullabhotla





On Mon, Mar 22, 2010 at 12:10 PM, Rick Bullotta
<ri...@burningskysoftware.com> wrote:
> Would this work for you?
>
> http://labs.karmasphere.org/dp/javadoc/com/karmasphere/dp/type/CIDR.html
>
>
> -----Original Message-----
> From: Sai Pullabhotla [mailto:sai.pullabhotla@jmethods.com]
> Sent: Monday, March 22, 2010 10:16 AM
> To: dev
> Subject: Converting an IP range to CIDR notation
>
> Does any one have Java code for converting a given range of IP
> addresses to CIDR notation, like the one here http://ip2cidr.com/.
>
> Thanks.
>
> Regards,
> Sai Pullabhotla
>
>