IPv6: Bermain Dengan ipv6calc

From OnnoWiki
Jump to navigation Jump to search

ipv6calc adalah sebuah utility kecil yang di tulis menggunakan bahasa C untuk memanipulasi IPv6 address maupun berbagai trick lainya. Keterangan lebih lanjut dari ipv6calc bisa di baca di http://www.deepspace6.net/projects/ipv6calc.html

Instalasi ipv6calc dapat dilakukan menggunakan perintah

# sudo apt-get install ipv6calc

Melihat kemampuan built in ipv6calc

# ipv6calc -vvv

akan keluar kira-kira

ipv6calc: version 0.95.0 GeoIP GeoIPv6 DB_AS DB_IPV4 DB_IPV6 DB_IPV4_CC DB_IPV6_CC DB_CC_REG DB_IEEE ANON_ZEROISE ANON_ANONYMIZE 

GeoIP support enabled, compiled with IPv4 & IPv6 support 
GeoIP dynamic library version (on this system): 1.6.0 
GeoIP available databases: Country4=1 Country6=1 ASN4=0 ASN6=0 City4=0 City6=0 
IP2Location support not enabled 
BuiltIn databases available: ASN=1 IPv4=1 IPv6=1 IEEE=1 CC_REG=1 
DB features: 0x0000130f 
GeoIP: features: 0x00000300 
GeoIP: info of available databases in directory: /usr/share/GeoIP (max: 38) 
GeoIP: GeoIP Country Edition     :[ 1] /usr/share/GeoIP/GeoIP.dat        (GEO-106FREE 20140407 Build) 
GeoIP: GeoIP Country V6 Edition  :[12] /usr/share/GeoIP/GeoIPv6.dat      (GEO-106FREE 20140407 Build) 
BuiltIn: features: 0x0000100f 
BuiltIn: info of available databases 
BuiltIn: ASN  : IANA/20130730 
BuiltIn: CC   : AFRINIC/20130806 APNIC/20130805 ARIN/20130805 LACNIC/20130805 RIPENCC/20130805 
BuiltIn: IPv4 : AFRINIC/20131117 APNIC/20131115 ARIN/20131116 IANA/20130520 LACNIC/20131115 RIPENCC/20131116 
BuiltIn: IPv6 : AFRINIC/20131117 APNIC/20131115 ARIN/20131116 IANA/20130215 LACNIC/20131115 RIPENCC/20131116 
BuiltIn: IEEE : IAB/20131117 OUI/20131117 OUI36/20131117 

Contoh paling sederhana adalah konversi IPv6 address ke DNS PTR query string:

$ ipv6calc --out revnibbles.arpa 2001:db8::1 

Hasilnya

No input type specified, try autodetection...found type: ipv6addr 
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa. 

Seperti yang kita lihat, format input auto detect. Ipv6calc juga mengerti tentang masking / nilai panjang prefix

$ ipv6calc -q --out revnibbles.arpa 2001:db8::1/64 

Hasilnya

0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.

Kita juga belajar bawa switch '-q' (quiet) akan menghilangkan message yang sifatnya informasi. Ipv6calc dapat kita gunakan untuk melakukan query DNS PTR, contoh

$ dig PTR `ipv6calc -q --out revnibbles.arpa 2001:db8::1/64`

Akan keluar:

; <<>> DiG 9.9.5-3-Ubuntu <<>> PTR 0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa. 
;; global options: +cmd 
;; Got answer: 
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 38359 
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1  

;; OPT PSEUDOSECTION: 
; EDNS: version: 0, flags:; udp: 4096 
;; QUESTION SECTION: 
;0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa. IN PTR 

;; AUTHORITY SECTION: 
8.b.d.0.1.0.0.2.ip6.arpa. 10800	IN	SOA	localhost. nobody.invalid. 1 3600 1200 604800 10800 

;; Query time: 12 msec 
;; SERVER: 127.0.1.1#53(127.0.1.1) 
;; WHEN: Sun Jul 05 06:28:46 WIB 2015 
;; MSG SIZE  rcvd: 128 

Tentunya ipv6calc dapat melakukan lebih banyak hal untuk kita. Contoh berikut adalah mengekstrak IPv4 address yang berada dalam 6to4 IPv6 address:

$ ipv6calc -q --action conv6to4 --in ipv6 2002:c0a8:fb61::1 --out ipv4 

Hasilnya

192.168.251.97 

Atau sebaliknya, kita ingin mengkonversikan IPv4 ke format IPv6.

$ ipv6calc -q --action conv6to4 --in ipv4 192.168.251.97 --out ipv6 

Hasilnya

2002:c0a8:fb61:: 

Kita juga dapat memperoleh informasi tentang sebuah IPv6 yang sederhana:

$ ipv6calc -q -i 2404:6800:4001:c01::67 

Hasilnya

Address type: unicast, global-unicast, productive, iid, iid-local 
Address type has SLA: 0c01 
Registry for address: APNIC 
Country Code: AU 
Interface identifier: 0000:0000:0000:0067 
Interface identifier is probably manual set 
 GeoIP country name and code: Australia (AU) 

Contoh lain

$ ipv6calc -q -i 2404:6800:4001:c01::67 

Hasilnya

Address type: unicast, global-unicast, productive, iid, iid-local 
Address type has SLA: 0c01 
Registry for address: APNIC 
Country Code: AU 
Interface identifier: 0000:0000:0000:0067 
Interface identifier is probably manual set 
 GeoIP country name and code: Australia (AU) 

Contoh Lain

$ ipv6calc -q -i 3ffe:ffff::210:a4ff:fe01:2345 

Hasilnya

Address type: unicast, 6bone, global-unicast, iid, iid-global, iid-eui48 
Address type has SLA: 0000 
Registry for address: IANA 
Error getting country code for IPv6 address 
Interface identifier: 0210:a4ff:fe01:2345 
EUI-48/MAC address: 00:10:a4:01:23:45 
MAC is a global unique one 
MAC is an unicast one 
OUI is: XIRCOM 

Informasi tentang sebuah Teredo IPv6 address:

$ ipv6calc -q -i 3ffe:831f:ce49:7601:8000:efff:af4a:86BF 

Hasilnya

Address type: unicast, 6bone, global-unicast, teredo 
IPv4 address: 80.181.121.64 
IPv4 address type: unicast, global 
Country Code: IT 
IPv4 registry[80.181.121.64]: RIPENCC 
 GeoIP country name and code: Italy (IT) 
IPv4 address: 206.73.118.1 
IPv4 address type: unicast, global 
Country Code: US 
IPv4 registry[206.73.118.1]: ARIN 
 GeoIP country name and code: United States (US) 
Address type is Teredo and included IPv4 server address is: 206.73.118.1 and client port: 4096 
IPv4 registry for Teredo server address: ARIN 
Registry for address: IANA 
Error getting country code for IPv6 address 

Memang ada mechine readable output (seperti 'ipv6calcweb.cgi') – sebagai tambahan, berikut adalah IP2Location dan atau GeoIP information yang dapat di tampilkan jika database di berikan.

$ ipv6calc -q -i -m 2001:470:36:ab6:203:dff:fee3:db76 

Hasilnya

IPV6=2001:0470:0036:0ab6:0203:0dff:fee3:db76 
IPV6_ANON=2001:0470:0036:0a09:a929:4291:4020:30d3 
IPV6_TYPE=unicast,global-unicast,productive,iid,iid-global,iid-eui48 
SLA=0ab6 
IPV6_REGISTRY=ARIN 
IPV6_COUNTRYCODE=US 
IID=0203:0dff:fee3:db76 
EUI48=00:03:0d:e3:db:76 
EUI48_SCOPE=global 
EUI48_TYPE=unicast 
OUI="Uniwill Computer Corp." 
GEOIP_COUNTRY_SHORT=US 
GEOIP_COUNTRY_LONG=United States 
GEOIP_DATABASE_INFO=GEO-106FREE 20140407 Build 
IPV6CALC_NAME=ipv6calc 
IPV6CALC_VERSION=0.95.0 
IPV6CALC_COPYRIGHT="(P) & (C) 2001-2013 by Peter Bieringer <pb (at) bieringer.de>" 
IPV6CALC_OUTPUT_VERSION=7 
IPV6CALC_SETTINGS_ANON="set=anonymize-standard,mask-ipv6=56,mask-ipv4=24,mask-eui64=40,mask-mac=24,method=anonymize" 
IPV6CALC_FEATURES="GeoIP GeoIPv6 ANON_ZEROISE ANON_ANONYMIZE DB_AS DB_IPV4 DB_IPV6 DB_IPV4_CC DB_IPV6_CC DB_CC_REG DB_IEEE"


Youtube


Pranala Menarik