Skip to content

ac000/ipv6-tools

Repository files navigation

Overview
========

Some simple tools for working with IPv6 addresses.

ipv6-arpa	- Given an IPv6 address, display it in ip6.arpa format. e.g

    $ ./ipv6-arpa 2001:db8:1:2::f00f
    Address  : 2001:0db8:0001:0002:0000:0000:0000:f00f
    ip6.arpa :-
      f.0.0.f.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.

ipv6-isin	- Given an IPv6 network/prefix and an IPv6 address, determine
		  if the address falls within the given network. e.g

    $ ./ipv6-isin 2001:db8:1:2::/64 2001:db8:1:2::cafe
    Yes
    $ ./ipv6-isin 2001:db8:1:2::/64 2001:db8:1:20::cafe
    No

ipv6-range	- Given a network address and prefix, calculate the range
		  of available IPs. e.g

    $ ./ipv6-range 2001:db8:1:2::/64
    Network : 2001:db8:1:2::/64
    Start   : 2001:0db8:0001:0002:0000:0000:0000:0000
    End     : 2001:0db8:0001:0002:ffff:ffff:ffff:ffff

    A /64 provides 18,446,744,073,709,551,616 addresses

gen-ula		- Generates an IPv6 ULA prefix based on the algorithm in
		  RFC 4193. e.g

    $ ./gen-ula
    fd0c:d0e3:46f0::/48
    /64 subnet range:
        fd0c:d0e3:46f0:0000::/64 -
        fd0c:d0e3:46f0:ffff::/64

The gen-ula tool requires libuuid and mhash.

mac-to-eui64	- Generates a modified EUI-64 identifier for the given MAC
		  address.

    $ ./mac-to-eui64 00:21:2f:b5:6e:10
    Modified EUI-64 :-
		 02:21:2f:ff:fe:b5:6e:10
    (SLAAC Host) ::0221:2fff:feb5:6e10

    The mac address can also be read from stdin e.g

    $ ./ipv6-extract-mac fe80::6231:97ff:fe1a:de8b | ./mac-to-eui64
    Modified EUI-64 :-
                 62:31:97:ff:fe:1a:de:8b
    (SLAAC Host) ::6231:97ff:fe1a:de8b

mac-type	- Test the U/L (Universal/Local) and IG (Individual/Group) bits
		  of a MAC address.

    $ ./mac-type 00:21:2f:b5:6e:10
    U/L (LG) bit is NOT set. Address is universally administered.
    IG bit is NOT set. Unicast address.

    $ ./mac-type df:ad:be:ef:ca:fe
    U/L (LG) bit is set. Address is locally administered.
    IG bit is set. Broadcast address.

    The mac address can also be read from stdin e.g

    $ ./ipv6-extract-mac fe80::6231:97ff:fe1a:de8b | ./mac-type
    U/L (LG) bit is NOT set. Address is universally administered.
    IG bit is NOT set. Unicast address.

ipv6-extract-mac	- Given an IPv6 address such as one generated through
			  SLAAC. This will attempt to extract the MAC address
			  from it.

    ./ipv6-extract-mac 2001:db8::200:5eff:fe00:5300
    00:00:5e:00:53:00

prefix-to-mask		- Given an IPv6 prefix length, display the compressed
			  and uncompressed network mask representations.

    $ ./prefix-to-mask 10
    comp    ffc0::
    uncomp  ffc0:0000:0000:0000:0000:0000:0000:0000

mask-to-prefix		- Given an IPv6 network mask display the prefix length.

    $ ./mask-to-prefix ffc0::
    prefixlen : 10

ipv6-fmt		- Given an IPv6 address format it in compressed,
			  expanded and URI literal forms.

    $ ./ipv6-fmt 2001:0db8:0000::dead:0000:beef
    Compressed  : 2001:db8::dead:0:beef
    Expanded    : 2001:0db8:0000:0000:0000:dead:0000:beef
    URI Literal : [2001:db8::dead:0:beef]

ipv6-gen-slaac		- Given an IPv6 network & MAC address, generate the
			  corresponding SLAAC address.

    $ ./ipv6-gen-slaac 2001:db8:a:b:: 00:24:1d:ba:80:00
    SLAAC : 2001:db8:a:b:224:1dff:feba:8000

ipv4mapped-ipv6		- Given an IPv4 address produce an IPv4-mapped IPv6
			  address.

    $ ./ipv4mapped-ipv6 192.168.1.254
    IPv4-mapped IPv6 : ::ffff:192.168.1.254
                     : ::ffff:c0a8:01fe

Build
=====

  $ make

gen-ula requires libuuid-devel & mhash-devel

License
=======

These tools are licensed under the GNU General Public License Version 2 or
the GNU Lesser General Public License Version 2.1

About

Some simple tools for working with IPv6 addresses.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published