lost and found ( for me ? )

IPv6 : ipv6calc

[ what’s ipv6calc ? ]

ipv6calc is a tool that manipulates IPv6 addresses.
It’s very useful tool for me to understand IPv6 ‘cause I’m newbie to IPv6 :)

[ how to install ipv6calc ]

- ubuntu 11.04
# apt-get install ipv6calc


- CnetOS 5.6
# yum install ipv6calc.x86_64


[ how to use ]

The following is my IPv6 local link address.
# LANG=C ifconfig br0 | grep inet6 | grep -i link
      inet6 addr: fe80::226:55ff:fee1:e83a/64 Scope:Link

# ipv6calc --addr_to_uncompressed fe80::226:55ff:fee1:e83a
fe80:0:0:0:226:55ff:fee1:e83a


- generate EUI-64 address w/ ipv6calc

You can generate unique IPv6 address based on Hardware address.
ipv6calc --in prefix+mac --action prefixmac2ipv6 --out ipv6addr fe80::/64 00:26:55:e1:e8:3a
fe80::226:55ff:fee1:e83a/64


- show detailed info of an IPv6 address

# ipv6calc --showinfo -m fe80::226:55ff:fee1:e83a
No input type specified, try autodetection...found type: ipv6addr
No output type specified, try autodetection...found type: ipv6addr
IPV6=fe80:0000:0000:0000:0226:55ff:fee1:e83a
TYPE=unicast,link-local
IPV6_REGISTRY=reserved
IID=0226:55ff:fee1:e83a  <- interface ID
EUI48=00:26:55:e1:e8:3a <- Hardware address
EUI48_SCOPE=global
EUI48_TYPE=unicast
OUI="Hewlett Packard"
IPV6CALC_NAME=ipv6calc
IPV6CALC_VERSION=0.73.0
IPV6CALC_COPYRIGHT="(P) & (C) 2001-2008 by Peter Bieringer <pb (at) bieringer.de>"
IPV6CALC_OUTPUT_VERSION=4


generate an IPv6 address from an IPv4

# ipv6calc --ipv4_to_6to4addr 192.168.10.11
2002:c0a8:a0b::
#

# ipv6calc --showinfo -m 2002:c0a8:a0b::
No input type specified, try autodetection...found type: ipv6addr
No output type specified, try autodetection...found type: ipv6addr
IPV6=2002:c0a8:0a0b:0000:0000:0000:0000:0000
TYPE=unicast,6to4,global-unicast,productive
IPV4_SOURCE[192.168.10.11]=6TO4
IPV4[192.168.10.11]=192.168.10.11
IPV4_REGISTRY[192.168.10.11]=reserved(RFC1918)
SLA=0000
IID=0000:0000:0000:0000
EUI64_SCOPE=local
IPV6CALC_NAME=ipv6calc
IPV6CALC_VERSION=0.73.0
IPV6CALC_COPYRIGHT="(P) & (C) 2001-2008 by Peter Bieringer <pb (at) bieringer.de>"
IPV6CALC_OUTPUT_VERSION=4



[ how to assign a fixed IPv6 address ]

- prepare IPv6 address

prefix is fe80:123:456:1 ( /64 )
create interface ID based on MAC address.
# ipv6calc --in prefix+mac --action prefixmac2ipv6 --out ipv6addr fe80:123:456:1::/64 00:26:55:e1:e8:3a
fe80:123:456:1:226:55ff:fee1:e83a/64

# ipv6calc --showinfo -m fe80:123:456:1:226:55ff:fee1:e83a
No input type specified, try autodetection...found type: ipv6addr
No output type specified, try autodetection...found type: ipv6addr
IPV6=fe80:0123:0456:0001:0226:55ff:fee1:e83a
TYPE=unicast,link-local
IPV6_REGISTRY=reserved
IID=0226:55ff:fee1:e83a
EUI48=00:26:55:e1:e8:3a
EUI48_SCOPE=global
EUI48_TYPE=unicast
IPV6CALC_NAME=ipv6calc
IPV6CALC_VERSION=0.61.0
IPV6CALC_COPYRIGHT="(P) & (C) 2001-2006 by Peter Bieringer <pb (at) bieringer.de>"
IPV6CALC_OUTPUT_VERSION=3

assign IPv6 temporally

# ifconfig eth2 add fe80:0123:0456:0001:0226:55ff:fee1:e83a/64

# ifconfig eth2 | grep inet6 | egrep "fe80:123"
      inet6 addr: fe80:123:456:1:226:55ff:fee1:e83a/64 Scope:Link

assign IPv6 permanently

- CentOS

edit /etc/sysconfig/network-scripts/ifcfg-ethX file like this:
IPV6INIT=yes
IPV6ADDR=fe80:0123:0456:0001:0226:55ff:fee1:e83a/64
IPV6_DEFAULTGW=fe80:0123:0456:0001:0226:55ff:fee1:e83b

n’ then restart network scripts of ifdown ethX ; ifup ethX
# /etc/init.d/network restart
or
# ifdown ethX; ifup ethX

- Ubuntu

edit /etc/network/interfaces file
auto br0
iface br0 inet static
    address 192.168.10.14
    netmask 255.255.255.0
    network 192.168.10.0
    gateway 192.168.10.254
    bridge_ports eth2
    bridge_stp off
    bridge_fd 0
    bridge_maxwait 0
iface br0 inet6 static
    pre-up modprobe ipv6
    address fe80:0123:0456:0001:0226:55ff:fee1:e83a
    netmask 64
   gateway fe80:0123:0456:0001:0226:55ff:fee1:e83b

restart network script
# /etc/init.d/networking restart

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.