[ipv6calc] mac -> ipv6 conversion with ipv6calc

Peter Bieringer pb at bieringer.de
Sat Mar 30 19:13:14 CET 2013


Hi again Vladimir,

Am 29.03.2013 20:58, schrieb Peter Bieringer:
> Hi Vladimir,
>
> Am 29.03.2013 13:23, schrieb Vladimír Kotal:
>>
>> Hi Peter,
>>
>> I am trying to convert MAC address to link-local address using ipv6calc
>> but it does not seem to be allowed/supported:
>>
>> $ ~/bin/ipv6calc --in mac 0:9:3d:14:14:f3 --out ipv6addr
>> No valid IPv6 address given!
>>
>> would it be possible to convert MAC to link-local in this case ? Of
>> course, I can convert to EUI64 and then to link-local but I'd like it to
>> be done in single step.
>
> Hmm, in principle, this can be implemented, but this must be proper
> implemented e.g. by giving a prefix.
>
> Will take a look how difficult this would be, perhaps in upcoming 0.94.0
> release (work in progress since longer time) this will be implemented.

After looking into the source code I found that this is already 
implemented since longer time:

Instead of using
~/bin/ipv6calc --in mac 0:9:3d:14:14:f3 --out ipv6addr

please use:

$ ./ipv6calc -q --in prefix+mac fe80::/10 0:9:3d:14:14:f3 --out ipv6addr
fe80::209:3dff:fe14:14f3/10

Also shown in online help:

$ ./ipv6calc -I -h
ipv6calc: version 0.94.0 DB_IEEE DB_IPV4 DB_IPV6
(P) & (C) 2001-2013 by Peter Bieringer <pb (at) bieringer.de>

  Available input types:
   auto            : automatic detection
   revnibbles.int  : dot separated nibbles reverse, ending with ip6.int.
   revnibbles.arpa : dot separated nibbles reverse, ending with ip6.arpa.
   bitstring       : bitstring labes, ending with ip6.arpa.
   ipv6addr        : IPv6 address
   ipv6literal     : IPv6 address in literal
   ipv4addr        : IPv4 address
   ipv4hex         : IPv4 in hexdecimal format
   ipv4revhex      : IPv4 in byte-reversed hexdecimal format
   mac             : MAC address (48 bits)
   base85          : Base-85 string
   ifinet6         : Like line in /proc/net/if_inet6
   iid+token       : Interface identifier and token
   ipv6logconv     : ipv6logconv (currently not supported)
* prefix+mac      : IPv6 prefix and a MAC address


Hope this helps,
	Peter



More information about the ipv6calc mailing list