On 07/22/15 at 12:42pm, Dave Young wrote:
On 07/22/15 at 12:07pm, Minfei Huang wrote:
> > > if [ -n "$_ipaddr" ]; then
> > > - _netmask=$(ipcalc -m $_ipaddr | cut -d'=' -f2)
> > > - _gateway=$(ip route list dev $_netdev | awk '/^default /{print
$3}')
> > > - echo -n "${_srcaddr}::${_gateway}:${_netmask}::"
> > > + _gateway=$(ip $_ipv6_flag route list dev $_netdev | awk
'/^default /{print $3}')
> > > +
> > > + if [ "x" != "x"$_ipv6_flag ]; then
> > > + _netmask=${_ipaddr#*\/}
> >
> > Could you add an example and a comment about ipv6 netmask, it is not easy to
> > understand for people who do not know ipv6
>
> Will add it.
>
> >
> > Why ipcalc does not work for ipv6?
>
> It is different for netmask between ipv4 and ipv6. The ipv6 netmask is
> always the specified number 64 or 128.
It does not answer the question, why ipcalc can not return proper value for ipv6?
I do not find a proper way to calculate the netmask by using ipcalc
command. Thus I cut out the $_ipaddr to get the netmask.
Thanks
Minfei