CLI IP range lookup tool

Rick Stevens rstevens at internap.com
Fri Dec 21 21:03:56 UTC 2007


On Fri, 2007-12-21 at 09:14 -0700, Ashley M. Kirchner wrote: 
>     Is there a command line tool that can get me from '123.235.126.232' 
> to '123.232.0.0/14' or even to '123.232.0.0:123.235.255.255'?
> 
>     Right now I'm manually using any of ripe.net, lacnic.net, or 
> arin.net to go from the IP to the range '123.232.0.0:123.235.255.255' 
> and then using 'netmask' to get to '123.232.0.0/14'.  I'm wondering if 
> there's a single tool to go from one to the other.

I'm not sure what you're trying to do.  The normal way of doing it
is to use ifconfig:

	# ifconfig eth0 123.235.126.232 netmask 255.252.0.0

That's a /14 netmask.  ipcalc can show it to you:

	# ipcalc -m 123.235.126.232/14
	NETMASK=255.252.0.0

----------------------------------------------------------------------
- Rick Stevens, Principal Engineer             rstevens at internap.com -
- CDN Systems, Internap, Inc.                http://www.internap.com -
-                                                                    -
-     There are only 10 kinds of people in the world -- those who    -
-                 understand binary and those who don't              -
----------------------------------------------------------------------




More information about the users mailing list