The story of IPv6 address that I want to keep at a minimum

Introduction

This article was posted as the 17th day article of IPv6 Advent Calendar 2019.

About this page

At the very least, wouldn't it be a problem if I knew this about IPv6 addresses? I wrote it appropriately. Accuracy? Don `t worry.

IPv6 address is like this

IPv4 divides the 32-bit address space every 8 bits with a. In decimal numbers.

192.0.2.1

For IPv6 addresses, the 128-bit address space is separated by ":" every 16 bits.

2001:db8:1:2:8:800:dead:beaf

I will write it like this. Anyway, because the address space is wide, I try to write IPv6 addresses short by using hexadecimal notation, but since it is long after all, there are several abbreviation methods available to try to shorten it.

::

You can think of it as a way of writing by omitting consecutive 0s as much as possible [^ 1].

[^ 1]: See RFC5952-Recommended IPv6 Address Notation for detailed abbreviations.

2001:db8::1 = 2001:db8:0:0:0:0:0:1

Like this. Well, no matter what, the IPv6 address is long after all.

Various names

IPv6 addresses have various names depending on their behavior and scope of application. I feel that this is causing confusion, but even if you look at the same car, from what side you look at the car, whether it is called a "sports car", a "sedan", or a "FF car" It depends on what you are doing, right? The IPv6 address is the same. In this article

--Behavior --Scope --Special address

I would like to divide by.

Classification by behavior

Like this

--Unicast address --Address used on a one-to-one basis. In particular, it refers to a global address and is sometimes called a global unicast address. In IPv4, private addresses are called unique local addresses (ULA: Yueru) [^ 2]. Sometimes called a unique local IPv6 unicast address, but the shorter one.

--Multicast address --An address that represents a group. If you throw it to this address, it will be delivered to all the nodes that belong to that group. Used for one-to-many communication. Broadcast addresses in IPv4 have been abolished and integrated into multicast addresses. --Anycast address ――Well, don't worry

[^ 2]: Forget the old site local address as it is obsolete.

About scope

It distinguishes by which scope (range) the address is valid.

--Global address (currently 2000 :: / 3) --An address unique to the world. IPv6 addresses that start with 2 are generally OK if you think of them as so-called global addresses (although it's a lie [^ 3]) --Unique local address (ULA: fc00 :: / 7) --Also called a unique local IPv6 unicast address (substantially fd00 :: / 8 [^ 4]) --Link local address (fe80 :: / 10) --An address that is valid only within the link to which the node is directly connected. When the link goes up, it is given to the node without any questions. --The address starting with fe80 is that, like fe80 :: a00: 27ff: fef2: 2a39.

[^ 3]: Even if it starts from 2001, 2001: 0000 :: / 23 seems to be a special purpose address space, but it is spatially global. For more information, see IPv6 Global Unicast Address Assignments. Please give me.

[^ 4]: See RFC4193 for details. Usable addresses are randomly generated and used under certain conditions. Unlike IPv4 private addresses, the feature is that addresses do not basically collide. So be careful not to generate it with my rules! .. If you want to use it, go to ʻULA generator` or something!

Also, be careful about link-local addresses. Since the address is valid only in the link, if there are eth0, eth1, eth2, it is not possible to know which interface the address is on by looking at the address alone. So be sure to use it with the scope ID

$ ssh fe80::a00:27ff:fef2:2a39%eth1

In the above example,% eth1 represents the scope ID.

Special address

--Unspecified address - ::/128 --Something like 0.0.0.0/32 in IPv4. You use it with bind addresses! - ::/0 --The one like 0.0.0.0/0 in IPv4. You use it with default gw! --loopback address - ::1 --Something like 127.0.0.1 in IPv4 --Multicast to all nodes on the same link - ff02::1 --A guy like 192.0.2.255 in IPv4 --Multicast to all routers on the same link - ff02::2 --Is there anything similar in IPv4? --IPv4 projected address (also called IPv4-mapped address) - ::ffff:192.0.2.1 --Since the IPv6 address space is wide, the system in which the IPv4 address is embedded involuntarily --Even with an IPv6 socket, an IPv4 address can be treated internally as an IPv6 address for communication. But I'm not communicating with IPv6. --Not all operating systems support it. ――Well, you may see it in the log once in a while, but you should think about it like "Ah, this address is spit out, it supports IPv6."

What do you call this address?

What does it look like on Linux?

# ip -6 addr show dev eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
    inet6 2001:db8::cafe/64 scope global
       valid_lft forever preferred_lft forever
    inet6 2001:db8::a00:27ff:fef2:2a39/64 scope global dynamic
       valid_lft 86124sec preferred_lft 14124sec
    inet6 fe80::a00:27ff:fef2:2a39/64 scope link
       valid_lft forever preferred_lft forever

If you add a little explanation, it looks like this.

IPv6-addr.png

Other

Enter the IPv6 address in Qiita

Unfortunately input example

Sometimes when I enter an IPv6 address

2001:db8:abcd:defg::1

Like this, pictograms are input. This is because it is batting with the pictogram notation by:, which is the delimiter of the IPv6 address. Originally, escaping with \ should work, but with Qiita, it does not work, so

`2001:db8:abcd:defg::1`

Like this, I think that it is easy to input by enclosing with `and it is good to input without stress.

Finally

For those who want to know more about IPv6, Distribute amazing IPv6 books for free! , I think you should download or purchase "Professional IPv6"! It seems that there will probably be no recommended books that cover IPv6 that exceed this in the future.

Recommended Posts

The story of IPv6 address that I want to keep at a minimum
The story of Linux that I want to teach myself half a year ago
A story that I was addicted to at np.where
I want to record the execution time and keep a log.
A story that struggled to handle the Python package of PocketSphinx
zoom I tried to quantify the degree of excitement of the story at the meeting
I want to sort a list in the order of other lists
I want to identify the alert email. --Is that x a wildcard? ---
Python: I want to measure the processing time of a function neatly
I want to customize the appearance of zabbix
[AtCoder for beginners] A story about the amount of calculation that you want to know very roughly
I want to make a music player and file music at the same time
I want to set a life cycle in the task definition of ECS
I want to add silence to the beginning of a wav file for 1 second
I want to see a list of WebDAV files in the Requests module
I want to create a web application that uses League of Legends data ①
A story that reduces the effort of operation / maintenance
I want to grep the execution result of strace
I want to fully understand the basics of Bokeh
I want to install a package of Php Redis
A story that analyzed the delivery of Nico Nama.
I want to publish the product at the lowest cost
I want to increase the security of ssh connections
A story that was convenient when I tried using the python ip address module
I can't find the clocksource tsc! ?? The story of trying to write a kernel patch
I want to take a screenshot of the site on Docker using any font
I want to use Linux commands at the command prompt! Use Linux commands at the command prompt instead of Git Bash
I want to start a lot of processes from python
I want to use only the normalization process of SudachiPy
NikuGan ~ I want to see a lot of delicious meat! !!
I want to get the operation information of yahoo route
I made a function to check the model of DCGAN
I want to judge the authenticity of the elements of numpy array
I want to know the features of Python and pip
I tried to fight the Local Minimum of Goldstein-Price Function
Keras I want to get the output of any layer !!
I want to know the legend of the IT technology world
I want to create a Dockerfile for the time being.
I made a tool to get the answer links of OpenAI Gym all at once
[Python] I want to make a 3D scatter plot of the epicenter with Cartopy + Matplotlib!
I want to find a stock that will rise 5 minutes after the Nikkei Stock Average rises
I want to find the intersection of a Bezier curve and a straight line (Bezier Clipping method)
I want to output a beautifully customized heat map of the correlation matrix. matplotlib edition
The story of writing a program
A story that I was addicted to calling Lambda from AWS Lambda.
I want to get the name of the function / method being executed
The story that the version of python 3.7.7 was not adapted to Heroku
I want to use a wildcard that I want to shell with Python remove
I want to read the html version of "OpenCV-Python Tutorials" OpenCV 3.1 version
[Introduction to StyleGAN] I played with "The Life of a Man" ♬
I want to output the beginning of the next month with Python
Qiskit: I want to create a circuit that creates arbitrary states! !!
How to find the memory address of a Pandas dataframe value
I want to create a system to prevent forgetting to tighten the key 1
The story of creating a site that lists the release dates of books
I made a slack bot that notifies me of the temperature
I want to check the position of my face with OpenCV!
I want to know the population of each country in the world.
[python] A note that started to understand the behavior of matplotlib.pyplot
The story of making a module that skips mail with python
[Python] A program that rotates the contents of the list to the left