Linux Mint 18.xでIPv6 DNSサーバー設定を変更するには?

Linux Mint 18.xでIPv6 DNSサーバー設定を変更するには?

オペレーティングシステム:Linux Mint 18.2 Cinnamon + Windows 10 Proデュアルブート。

私はこのウェブサイトを利用しました。http://test-ipv6.com/私のIPv6準備状態を確認してください。


Windows 10 Proの結果:

Windows 10 Proの結果

Linux Mint 18.2 Cinnamonの結果:

Linux Mint 18.2 Cinnamonの結果


ご覧のとおり、一部私のLinux MintのDNS設定に問題があります。ただし、たとえば、ネットワーク設定 - IPv6セクションでは、すべてがオンになっているようです。

ネットワーク設定 - IPv6セクション


失敗したDNS設定がどこにあるのかわかりません。それともLinux Mint 18はまだIPv6を使用する準備ができていませんか?


編集1:

$ cat /etc/resolv.conf

nameserver 209.222.18.222
nameserver 209.222.18.218

ただし、Network Managerでは、Google DNSがプライマリDNS、私のIPSがセカンダリDNSとして表示されます。これはルータDHCPのIPv4セクションで設定しました。

ネットワーク管理者にGoogle DNSが表示されます。

私のラップトップはこれを使用していると思います。

$ nmcli dev show | grep DNS

IP4.DNS[1]:                             8.8.8.8
IP4.DNS[2]:                             10.255.255.10
IP6.DNS[1]:                             2a02:768:0:1010::3
IP6.DNS[2]:                             2a02:768:0:1010::2

IPv6をまったく理解していないことは認めますが、Windowsでテストする理由を理解していないため、IPv6は完全に機能しますが、Linuxでは動作しません。

$ cat /etc/gai.conf

# Configuration for getaddrinfo(3).
#
# So far only configuration for the destination address sorting is needed.
# RFC 3484 governs the sorting.  But the RFC also says that system
# administrators should be able to overwrite the defaults.  This can be
# achieved here.
#
# All lines have an initial identifier specifying the option followed by
# up to two values.  Information specified in this file replaces the
# default information.  Complete absence of data of one kind causes the
# appropriate default information to be used.  The supported commands include:
#
# reload  <yes|no>
#    If set to yes, each getaddrinfo(3) call will check whether this file
#    changed and if necessary reload.  This option should not really be
#    used.  There are possible runtime problems.  The default is no.
#
# label   <mask>   <value>
#    Add another rule to the RFC 3484 label table.  See section 2.1 in
#    RFC 3484.  The default is:
#
#label ::1/128       0
#label ::/0          1
#label 2002::/16     2
#label ::/96         3
#label ::ffff:0:0/96 4
#label fec0::/10     5
#label fc00::/7      6
#label 2001:0::/32   7
#
#    This default differs from the tables given in RFC 3484 by handling
#    (now obsolete) site-local IPv6 addresses and Unique Local Addresses.
#    The reason for this difference is that these addresses are never
#    NATed while IPv4 site-local addresses most probably are.  Given
#    the precedence of IPv6 over IPv4 (see below) on machines having only
#    site-local IPv4 and IPv6 addresses a lookup for a global address would
#    see the IPv6 be preferred.  The result is a long delay because the
#    site-local IPv6 addresses cannot be used while the IPv4 address is
#    (at least for the foreseeable future) NATed.  We also treat Teredo
#    tunnels special.
#
# precedence  <mask>   <value>
#    Add another rule to the RFC 3484 precedence table.  See section 2.1
#    and 10.3 in RFC 3484.  The default is:
#
#precedence  ::1/128       50
#precedence  ::/0          40
#precedence  2002::/16     30
#precedence ::/96          20
#precedence ::ffff:0:0/96  10
#
#    For sites which prefer IPv4 connections change the last line to
#
precedence ::ffff:0:0/96  100

#
# scopev4  <mask>  <value>
#    Add another rule to the RFC 6724 scope table for IPv4 addresses.
#    By default the scope IDs described in section 3.2 in RFC 6724 are
#    used.  Changing these defaults should hardly ever be necessary.
#    The defaults are equivalent to:
#
#scopev4 ::ffff:169.254.0.0/112  2
#scopev4 ::ffff:127.0.0.0/104    2
#scopev4 ::ffff:0.0.0.0/96       14

したがって、ほとんどすべてがコメントアウトされています。

また、私はどのDHCPクライアントを使用しているか尋ねました。

$ dhclient --help

Internet Systems Consortium DHCP Client 4.3.3
...

編集2:

$ cat /etc/dhcp/dhclient.conf

# Configuration file for /sbin/dhclient.
#
# This is a sample configuration file for dhclient. See dhclient.conf's
#   man page for more information about the syntax of this file
#   and a more comprehensive list of the parameters understood by
#   dhclient.
#
# Normally, if the DHCP server provides reasonable information and does
#   not leave anything out (like the domain name, for example), then
#   few changes must be made to this file, if any.
#

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
    domain-name, domain-name-servers, domain-search, host-name,
    dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
    netbios-name-servers, netbios-scope, interface-mtu,
    rfc3442-classless-static-routes, ntp-servers;

#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#send dhcp-lease-time 3600;
#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;
#require subnet-mask, domain-name-servers;
timeout 300;
#retry 60;
#reboot 10;
#select-timeout 5;
#initial-interval 2;
#script "/sbin/dhclient-script";
#media "-link0 -link1 -link2", "link0 link1";
#reject 192.33.137.209;

#alias {
#  interface "eth0";
#  fixed-address 192.5.5.213;
#  option subnet-mask 255.255.255.255;
#}

#lease {
#  interface "eth0";
#  fixed-address 192.33.137.200;
#  medium "link0 link1";
#  option host-name "andare.swiftmedia.com";
#  option subnet-mask 255.255.255.0;
#  option broadcast-address 192.33.137.255;
#  option routers 192.33.137.250;
#  option domain-name-servers 127.0.0.1;
#  renew 2 2000/1/12 00:00:01;
#  rebind 2 2000/1/12 00:00:01;
#  expire 2 2000/1/12 00:00:01;
#}

編集3:

上の行の後にIPv6行をコピーして貼り付けます。

cat /etc/dhcp/dhclient.conf 

# Configuration file for /sbin/dhclient.
#
# This is a sample configuration file for dhclient. See dhclient.conf's
#   man page for more information about the syntax of this file
#   and a more comprehensive list of the parameters understood by
#   dhclient.
#
# Normally, if the DHCP server provides reasonable information and does
#   not leave anything out (like the domain name, for example), then
#   few changes must be made to this file, if any.
#

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
    dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
    domain-name, domain-name-servers, domain-search, host-name,
    netbios-name-servers, netbios-scope, interface-mtu,
    rfc3442-classless-static-routes, ntp-servers;

#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#send dhcp-lease-time 3600;
#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;
#require subnet-mask, domain-name-servers;
timeout 300;
#retry 60;
#reboot 10;
#select-timeout 5;
#initial-interval 2;
#script "/sbin/dhclient-script";
#media "-link0 -link1 -link2", "link0 link1";
#reject 192.33.137.209;

#alias {
#  interface "eth0";
#  fixed-address 192.5.5.213;
#  option subnet-mask 255.255.255.255;
#}

#lease {
#  interface "eth0";
#  fixed-address 192.33.137.200;
#  medium "link0 link1";
#  option host-name "andare.swiftmedia.com";
#  option subnet-mask 255.255.255.0;
#  option broadcast-address 192.33.137.255;
#  option routers 192.33.137.250;
#  option domain-name-servers 127.0.0.1;
#  renew 2 2000/1/12 00:00:01;
#  rebind 2 2000/1/12 00:00:01;
#  expire 2 2000/1/12 00:00:01;
#}

編集4:

おそらく私が変更していないVPNプロバイダアプリです。私は現在VPNを使用していないので、私のLinuxがIPv6をサポートしているかどうかをテストしたいと思いました。 resolv.confのネームサーバーは、VPNプロバイダであるPrivate Internet Accessに属します。

resolv.conf更新されない理由を見つけようとしています。

$ lsattr /etc/resolv.conf

-------------e-- /etc/resolv.conf

編集5:

$ sudo tcpdump -i eth0 udp port 53

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
13:28:35.416720 IP 192.168.0.11.46858 > resolver1.privateinternetaccess.com.domain: 22927+ A? imap.gmail.com. (32)
13:28:35.416730 IP 192.168.0.11.46858 > resolver1.privateinternetaccess.com.domain: 8909+ AAAA? imap.gmail.com. (32)
13:28:35.416974 IP 192.168.0.11.39732 > resolver1.privateinternetaccess.com.domain: 35471+ PTR? 222.18.222.209.in-addr.arpa. (45)
13:28:35.436305 IP 192.168.0.11.52326 > resolver1.privateinternetaccess.com.domain: 65414+ A? live.mozillamessaging.com. (43)
13:28:35.436310 IP 192.168.0.11.52326 > resolver1.privateinternetaccess.com.domain: 30886+ AAAA? live.mozillamessaging.com. (43)
13:28:35.478049 IP 192.168.0.11.46175 > resolver1.privateinternetaccess.com.domain: 5292+ A? mx.endora.cz. (30)
13:28:35.478053 IP 192.168.0.11.46175 > resolver1.privateinternetaccess.com.domain: 16624+ AAAA? mx.endora.cz. (30)
13:28:35.815497 IP 192.168.0.11.50734 > resolver1.privateinternetaccess.com.domain: 17117+ A? clients1.google.com. (37)
13:28:35.815508 IP 192.168.0.11.50734 > resolver1.privateinternetaccess.com.domain: 34551+ AAAA? clients1.google.com. (37)
13:28:35.816481 IP resolver1.privateinternetaccess.com.domain > 192.168.0.11.46175: 5292 1/0/0 A 88.86.120.212 (46)
13:28:35.818739 IP resolver1.privateinternetaccess.com.domain > 192.168.0.11.46175: 16624 0/1/0 (86)
13:28:35.959874 IP resolver1.privateinternetaccess.com.domain > 192.168.0.11.50734: 17117 2/0/0 CNAME clients.l.google.com., A 172.217.12.142 (77)
13:28:35.959899 IP resolver1.privateinternetaccess.com.domain > 192.168.0.11.50734: 34551 2/0/0 CNAME clients.l.google.com., AAAA 2607:f8b0:4006:819::200e (89)
13:28:35.972396 IP 192.168.0.11.50409 > resolver1.privateinternetaccess.com.domain: 53313+ A? ocsp2.globalsign.com. (38)
13:28:35.972406 IP 192.168.0.11.50409 > resolver1.privateinternetaccess.com.domain: 62184+ AAAA? ocsp2.globalsign.com. (38)
13:28:36.145921 IP resolver1.privateinternetaccess.com.domain > 192.168.0.11.50409: 62184 3/0/0 CNAME cdn.globalsigncdn.com., AAAA 2400:cb00:2048:1::681f:4a7c, AAAA 2400:cb00:2048:1::681f:4b7c (126)
13:28:36.153394 IP resolver1.privateinternetaccess.com.domain > 192.168.0.11.50409: 53313 3/0/0 CNAME cdn.globalsigncdn.com., A 104.31.75.124, A 104.31.74.124 (102)
13:28:36.345446 IP 192.168.0.11.39036 > resolver1.privateinternetaccess.com.domain: 49155+ A? www.googleapis.com. (36)
13:28:36.345462 IP 192.168.0.11.39036 > resolver1.privateinternetaccess.com.domain: 10791+ AAAA? www.googleapis.com. (36)
13:28:36.483314 IP resolver1.privateinternetaccess.com.domain > 192.168.0.11.39036: 49155 13/0/0 CNAME googleapis.l.google.com., A 172.217.6.234, A 172.217.10.234, A 172.217.12.170, A 172.217.12.202, A 172.217.9.234, A 172.217.10.10, A 172.217.10.42, A 172.217.10.74, A 172.217.10.138, A 172.217.3.106, A 172.217.12.138, A 172.217.6.202 (262)
13:28:36.483344 IP resolver1.privateinternetaccess.com.domain > 192.168.0.11.39036: 10791 2/0/0 CNAME googleapis.l.google.com., AAAA 2607:f8b0:4006:812::200a (98)
^C

編集6:

sudo dhclient -r
sudo dhclient -v eth0


Internet Systems Consortium DHCP Client 4.3.3
Copyright 2004-2015 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0/d8:50:e6:05:e1:db
Sending on   LPF/eth0/d8:50:e6:05:e1:db
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3 (xid=0x3ede007c)
DHCPREQUEST of 192.168.0.11 on eth0 to 255.255.255.255 port 67 (xid=0x7c00de3e)
DHCPOFFER of 192.168.0.11 from 192.168.0.1
DHCPACK of 192.168.0.11 from 192.168.0.1
/etc/resolvconf/update.d/libc: Warning: /etc/resolv.conf is not a symbolic link to /run/resolvconf/resolv.conf
bound to 192.168.0.11 -- renewal in 2147483648 seconds.

編集7:

$ sudo tcpdump -i eth0 -vvv -n port 68

tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
14:30:18.135530 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
    0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from d8:50:e6:05:e1:db, length 300, xid 0x7a30842b, Flags [none] (0x0000)
      Client-Ethernet-Address d8:50:e6:05:e1:db
      Vendor-rfc1048 Extensions
        Magic Cookie 0x63825363
        DHCP-Message Option 53, length 1: Request
        Requested-IP Option 50, length 4: 192.168.0.11
        Hostname Option 12, length 10: "vb-nb-mint"
        Parameter-Request Option 55, length 18: 
          Subnet-Mask, BR, Time-Zone, Default-Gateway
          Domain-Name, Domain-Name-Server, Option 119, Hostname
          Netbios-Name-Server, Netbios-Scope, MTU, Classless-Static-Route
          NTP, Classless-Static-Route, Classless-Static-Route-Microsoft, Static-Route
          Option 252, NTP
        END Option 255, length 0
        PAD Option 0, length 0, occurs 18
14:30:18.136280 IP (tos 0x0, ttl 64, id 15220, offset 0, flags [none], proto UDP (17), length 576)
    192.168.0.1.67 > 192.168.0.11.68: [udp sum ok] BOOTP/DHCP, Reply, length 548, xid 0x7a30842b, Flags [none] (0x0000)
      Your-IP 192.168.0.11
      Client-Ethernet-Address d8:50:e6:05:e1:db
      Vendor-rfc1048 Extensions
        Magic Cookie 0x63825363
        DHCP-Message Option 53, length 1: ACK
        Server-ID Option 54, length 4: 192.168.0.1
        Lease-Time Option 51, length 4: 4294967295
        Subnet-Mask Option 1, length 4: 255.255.255.0
        Default-Gateway Option 3, length 4: 192.168.0.1
        Domain-Name-Server Option 6, length 8: 8.8.8.8,10.255.255.10
        END Option 255, length 0
        PAD Option 0, length 0, occurs 270
^C

+

$ cat /run/resolvconf/resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
nameserver 10.255.255.10
nameserver 127.0.1.1

答え1

/etc/gai.confでは、以下のようにIPv4よりもIPv6を好む行をコメントアウトする必要があります。

# precedence ::ffff:0:0/96  100

また、/etc/dhclient/dhclient6.confを編集する必要があります。これが不十分な場合は、-6パラメータをdhclientに渡すことができます。

また、resolv.confリンクを変更することをお勧めします。

また、dhclientはDHCPを通過した最初の2つのDNSサーバーのみを使用すると断言するかもしれませんが、私が間違っている可能性があります。


編集する:

  1. 上記のステップは正しいです。つまり、最初のステップで次の行をコメントアウトします。

    precedence ::ffff:0:0/96  100
    

    次のファイルから:

    /etc/gai.conf
    
  2. 上記の手順に従ってください。マイクロソフト文書からUbuntu 16.04ベースのLinux Mint 18.xの場合:

    次のファイルを生成します。

    /etc/dhcp/dhclient6.conf
    

    コンテンツ:

    timeout 10;
    

    次のファイルを生成します。

    /etc/network/interfaces.d/50-cloud-init.cfg
    

    コンテンツ:

    iface eth0 inet6 auto
        up sleep 5
        up dhclient -1 -6 -cf /etc/dhcp/dhclient6.conf -lf /var/lib/dhcp/dhclient6.eth0.leases -v eth0 || true
    
  3. 最後に、元のリンクを上書きしてシンボリックリンクを作成しますresolv.conf

    ln -sf /run/resolvconf/resolv.conf /etc/resolv.conf
    
  4. 再起動すると、チャット、DHCPのIPv6が動作します。

答え2

/etc/gai.confファイルにこの行を追加してコメントを付けると、precedence 2001:470::/32 100IPv4よりもIPv6に優先順位を付けることができます。precedence ::ffff:0:0/96 100

関連情報