Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Jun 2002 03:25:46 -0400
From:      parv <parv@pair.com>
To:        BSD Freak <bsd-freak@mbox.com.au>
Cc:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Converting decimal dotted subnet mask to CIDR in a script
Message-ID:  <20020607072546.GA6108@moo.holy.cow>
In-Reply-To: <f9079af91739.f91739f9079a@mbox.com.au>
References:  <f9079af91739.f91739f9079a@mbox.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
in message <f9079af91739.f91739f9079a@mbox.com.au>,
wrote BSD Freak thusly...
>
> I have a variable in a script we use
>
> $MASK=255.255.255.0
>
> Is there a utility or an easy way to process $MASK and get
>
> $MASKCIDR=24
>
> the CIDR value of 255.255.255.0

in addition to a general solution, python & perl programs, there is
at least one port on the subject: net/ipcalc ...

# ipcalc -b 0/255.255.255.0

Address:   0.0.0.0
Netmask:   255.255.255.0 = 24
Wildcard:  0.0.0.255
=>
Network:   0.0.0.0/24
Broadcast: 0.0.0.255
HostMin:   0.0.0.1
HostMax:   0.0.0.254
Hosts/Net: 254


--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020607072546.GA6108>