Linux で IPv6 を利用する際の基本的なコマンドメモ
インタフェイスに付与されたアドレス確認
$ ip address show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc pfifo_fast state UP group default qlen 1000
link/ether 06:a3:df:xx:xx:xx brd ff:ff:ff:ff:ff:ff
inet 172.31.xx.xx/20 brd 172.31.xx.xx scope global eth0
valid_lft forever preferred_lft forever
inet6 2xxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::xxxx:xxxx:xxxx:xxxx/64 scope link
valid_lft forever preferred_lft forever
ルーティングテーブル
$ ip -6 route list type unicast
2xxx:xxxx:xxxx:xxxx::/64 dev eth0 proto kernel metric 256 pref medium
fe80::/64 dev eth0 proto kernel metric 256 pref medium
default via fe80::xxxx:xxxx:xxxx:xxxx dev eth0 proto ra metric 1024 expires xxxsec hoplimit 64 pref medium
Ping 疎通確認
- localhost
$ ping6 ::1
$ ping6 2001:4860:4860::8888
curl 接続確認
$ curl -6 -i https://www.jpn.earth/remote_addr.cgi
HTTP/2 200
date: Mon, 29 Jul 2019 14:54:49 GMT
content-type: text/plain; charset=UTF-8
2xxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
DNS
$ dig aaaa www.google.com +rec +short
2404:6800:4004:81a::2004
公開サービス
$ ss -al -6
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
raw UNCONN 0 0 *:ipv6-icmp *:*
udp UNCONN 0 0 *:dhcpv6-client *:*
udp UNCONN 0 0 *:45617 *:*
udp UNCONN 0 0 *:mdns *:*
tcp LISTEN 0 128 [::]:ssh [::]:*