お知らせ

  • 利用規約を守って投稿してください。また、よくある質問および投稿の手引きも参照してください。
  • メッセージの投稿にはアカウントが必要です。未登録の方は、ユーザ登録ページからアカウントを作成することができます。

#1 2024-11-07 16:00:18

hanaguro
新しいメンバ
登録日: 2024-11-07

dhcpcdを利用してネットワーク接続

はじめまして。
吉澤と申します。

現在Ubuntu24.04でdhcpcdを利用してネットワーク接続をしようとしているのですが、DHCPサーバからDNS情報が取得できず困っています。
何か私が勘違いして見当違いのことをしているのか、dhcpcdをデフォルト設定で使用しているのが悪いのか、原因が分かりません。

以下に行っていることを記載します。

コード:

$ dig www.google.com

; <<>> DiG 9.18.28-0ubuntu0.24.04.1-Ubuntu <<>> www.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 21746
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;www.google.com.            IN    A

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Thu Nov 07 15:27:25 JST 2024
;; MSG SIZE  rcvd: 43

コード:

$ systemctl status NetworkManager
○ NetworkManager.service - Network Manager
     Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; disabled; >
     Active: inactive (dead)
       Docs: man:NetworkManager(8)

コード:

$ sudo wpa_supplicant -B -i wlx9c5322063537 -c wpa_supplicant.conf
Successfully initialized wpa_supplicant

コード:

$ iwconfig
lo        no wireless extensions.

enp0s3    no wireless extensions.

wlx9c5322063537  IEEE 802.11  ESSID:"tanukigoten2"  
          Mode:Managed  Frequency:2.412 GHz  Access Point: 50:41:B9:24:61:9F   
          Bit Rate=65 Mb/s   Tx-Power=20 dBm   
          Retry short limit:7   RTS thr=2347 B   Fragment thr:off
          Power Management:off
          Link Quality=55/70  Signal level=-55 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:8   Missed beacon:0

コード:

$ sudo dhcpcd -dddd -K -f /etc/dhcpcd.conf wlx9c5322063537
dhcpcd-10.0.6 starting
chrooting as dhcpcd to /usr/lib/dhcpcd
sandbox: seccomp
spawned manager process on PID 4575
spawned privileged proxy on PID 4576
spawned network proxy on PID 4577
spawned controller proxy on PID 4578
DUID 00:01:00:01:2e:bf:16:fe:9c:53:22:06:35:37
wlx9c5322063537: spawned DHCP6 proxy 2404:7a82:5200:4500:bd1b:4e4c:ff0b:78ad on PID 4579
wlx9c5322063537: executing: /usr/lib/dhcpcd/dhcpcd-run-hooks PREINIT
wlx9c5322063537: connected to Access Point: tanukigoten2
wlx9c5322063537: IAID 22:06:35:37
wlx9c5322063537: adding address fe80::f855:64ad:76fd:d4b3
wlx9c5322063537: pltime infinity, vltime infinity
wlx9c5322063537: delaying IPv6 router solicitation for 0.2 seconds
wlx9c5322063537: delaying IPv4 for 0.8 seconds
wlx9c5322063537: soliciting an IPv6 router
wlx9c5322063537: delaying Router Solicitation for LL address
wlx9c5322063537: reading lease: /var/lib/dhcpcd/wlx9c5322063537-tanukigoten2.lease
wlx9c5322063537: soliciting a DHCP lease
wlx9c5322063537: spawned BPF BOOTP on PID 4585
wlx9c5322063537: sending DISCOVER (xid 0x98055f51), next in 4.7 seconds
wlx9c5322063537: sending Router Solicitation
wlx9c5322063537: spawned DHCP6 proxy fe80::f855:64ad:76fd:d4b3 on PID 4588
wlx9c5322063537: Router Advertisement from fe80::207:7dff:fea7:5ca
wlx9c5322063537: adding address 2404:7a82:5200:4500:c0e3:1f4b:8716:6105/64
wlx9c5322063537: pltime 604800 seconds, vltime 2592000 seconds
wlx9c5322063537: adding route to 2404:7a82:5200:4500::/64
wlx9c5322063537: adding default route via fe80::207:7dff:fea7:5ca
wlx9c5322063537: waiting for Router Advertisement DAD to complete
wlx9c5322063537: requesting DHCPv6 information
wlx9c5322063537: delaying INFORM6 (xid 0xf34670), next in 1.0 seconds
wlx9c5322063537: multicasting INFORM6 (xid 0xf34670), next in 1.1 seconds
wlx9c5322063537: REPLY6 received from fe80::207:7dff:fea7:5ca
wlx9c5322063537: refresh in 86400 seconds
wlx9c5322063537: writing lease: /var/lib/dhcpcd/wlx9c5322063537-tanukigoten2.lease6
wlx9c5322063537: executing: /usr/lib/dhcpcd/dhcpcd-run-hooks INFORM6
Dropped protocol specifier '.dhcp6' from 'wlx9c5322063537.dhcp6'. Using 'wlx9c5322063537' (ifindex=3).
waiting for an IP address
wlx9c5322063537: offered 192.168.1.181 from 192.168.1.2
wlx9c5322063537: process BPF BOOTP already started on pid 4585
wlx9c5322063537: sending REQUEST (xid 0x98055f51), next in 3.6 seconds
wlx9c5322063537: acknowledged 192.168.1.181 from 192.168.1.2
wlx9c5322063537: spawned BPF ARP 192.168.1.181 on PID 4608
wlx9c5322063537: probing address 192.168.1.181/24
wlx9c5322063537: probing for 192.168.1.181
wlx9c5322063537: ARP probing 192.168.1.181 (1 of 3), next in 1.1 seconds
wlx9c5322063537: ARP probing 192.168.1.181 (2 of 3), next in 1.5 seconds
wlx9c5322063537: ARP probing 192.168.1.181 (3 of 3), next in 2.0 seconds
wlx9c5322063537: DAD completed for 192.168.1.181
wlx9c5322063537: leased 192.168.1.181 for 600 seconds
wlx9c5322063537: renew in 300 seconds, rebind in 525 seconds
wlx9c5322063537: writing lease: /var/lib/dhcpcd/wlx9c5322063537-tanukigoten2.lease
wlx9c5322063537: adding IP address 192.168.1.181/24 broadcast 192.168.1.255
wlx9c5322063537: adding route to 192.168.1.0/24
wlx9c5322063537: adding default route via 192.168.1.1
wlx9c5322063537: ARP announcing 192.168.1.181 (1 of 2), next in 2.0 seconds
wlx9c5322063537: executing: /usr/lib/dhcpcd/dhcpcd-run-hooks BOUND
Dropped protocol specifier '.dhcp' from 'wlx9c5322063537.dhcp'. Using 'wlx9c5322063537' (ifindex=3).
forked to background

dhcpcdコマンドを実行中に
tcpdump -i wlx9c5322063537 -nnvv port 67 or port 68
を行った結果が次になります。

コード:

tcpdump: listening on wlx9c5322063537, link-type EN10MB (Ethernet), snapshot length 262144 bytes
15:41:52.450590 IP (tos 0x0, ttl 64, id 35164, 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 9c:53:22:06:35:37, length 300, xid 0x98055f51, Flags [none] (0x0000)
      Client-Ethernet-Address 9c:53:22:06:35:37
      Vendor-rfc1048 Extensions
        Magic Cookie 0x63825363
        DHCP-Message (53), length 1: Discover
        Parameter-Request (55), length 14: 
          Subnet-Mask (1), Classless-Static-Route (121), Default-Gateway (3), Domain-Name-Server (6)
          Hostname (12), Domain-Name (15), MTU (26), BR (28)
          Static-Route (33), Lease-Time (51), Server-ID (54), RN (58)
          RB (59), Unknown (119)
        MSZ (57), length 2: 1472
        Client-ID (61), length 19: hardware-type 255, 22:06:35:37:00:01:00:01:2e:bf:16:fe:9c:53:22:06:35:37
        SLP-NA (80), length 0""
        NOAUTO (116), length 1: Y
        Unknown (145), length 1: 1
15:41:55.564970 IP (tos 0xc0, ttl 64, id 53922, offset 0, flags [none], proto UDP (17), length 354)
    192.168.1.2.67 > 192.168.1.181.68: [udp sum ok] BOOTP/DHCP, Reply, length 326, xid 0x98055f51, Flags [none] (0x0000)
      Your-IP 192.168.1.181
      Server-IP 192.168.1.2
      Client-Ethernet-Address 9c:53:22:06:35:37
      Vendor-rfc1048 Extensions
        Magic Cookie 0x63825363
        DHCP-Message (53), length 1: Offer
        Server-ID (54), length 4: 192.168.1.2
        Lease-Time (51), length 4: 600
        RN (58), length 4: 300
        RB (59), length 4: 525
        Subnet-Mask (1), length 4: 255.255.255.0
        BR (28), length 4: 192.168.1.255
        Domain-Name-Server (6), length 8: 192.168.1.2,1.1.1.1
        Domain-Name (15), length 12: "takahiro.org"
        Unknown (119), length 14: 2164,24939,24936,26994,28419,28530,26368
        Default-Gateway (3), length 4: 192.168.1.1
15:41:55.565791 IP (tos 0x0, ttl 64, id 41856, 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 9c:53:22:06:35:37, length 300, xid 0x98055f51, secs 3, Flags [none] (0x0000)
      Client-Ethernet-Address 9c:53:22:06:35:37
      Vendor-rfc1048 Extensions
        Magic Cookie 0x63825363
        Requested-IP (50), length 4: 192.168.1.181
        DHCP-Message (53), length 1: Request
        Server-ID (54), length 4: 192.168.1.2
        Parameter-Request (55), length 14: 
          Subnet-Mask (1), Classless-Static-Route (121), Default-Gateway (3), Domain-Name-Server (6)
          Hostname (12), Domain-Name (15), MTU (26), BR (28)
          Static-Route (33), Lease-Time (51), Server-ID (54), RN (58)
          RB (59), Unknown (119)
        MSZ (57), length 2: 1472
        Client-ID (61), length 19: hardware-type 255, 22:06:35:37:00:01:00:01:2e:bf:16:fe:9c:53:22:06:35:37
        Unknown (145), length 1: 1
15:41:55.613529 IP (tos 0xc0, ttl 64, id 53943, offset 0, flags [none], proto UDP (17), length 354)
    192.168.1.2.67 > 192.168.1.181.68: [udp sum ok] BOOTP/DHCP, Reply, length 326, xid 0x98055f51, secs 3, Flags [none] (0x0000)
      Your-IP 192.168.1.181
      Server-IP 192.168.1.2
      Client-Ethernet-Address 9c:53:22:06:35:37
      Vendor-rfc1048 Extensions
        Magic Cookie 0x63825363
        DHCP-Message (53), length 1: ACK
        Server-ID (54), length 4: 192.168.1.2
        Lease-Time (51), length 4: 600
        RN (58), length 4: 300
        RB (59), length 4: 525
        Subnet-Mask (1), length 4: 255.255.255.0
        BR (28), length 4: 192.168.1.255
        Domain-Name-Server (6), length 8: 192.168.1.2,1.1.1.1
        Domain-Name (15), length 12: "takahiro.org"
        Unknown (119), length 14: 2164,24939,24936,26994,28419,28530,26368
        Default-Gateway (3), length 4: 192.168.1.1

4 packets captured
4 packets received by filter
0 packets dropped by kernel

コード:

$ dig www.google.com

; <<>> DiG 9.18.28-0ubuntu0.24.04.1-Ubuntu <<>> www.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 34834
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;www.google.com.            IN    A

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Thu Nov 07 15:53:40 JST 2024
;; MSG SIZE  rcvd: 43

コード:

$ ls -l /etc/resolv.conf 
lrwxrwxrwx 1 root root 39  8月 28 00:37 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

コード:

$ cat /etc/resolv.conf 
# This is /run/systemd/resolve/stub-resolv.conf managed by man:systemd-resolved(8).
# Do not edit.
#
# This file might be symlinked as /etc/resolv.conf. If you're looking at
# /etc/resolv.conf and seeing this text, you have followed the symlink.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs should typically not access this file directly, but only
# through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a
# different way, replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
options edns0 trust-ad
search .

tcpdumpの出力に
Domain-Name-Server (6), length 8: 192.168.1.2,1.1.1.1
とありますので、DNS情報はDHCPサーバから受け取っているのではないかと考えています。


何かありましたら、ご指摘いただけると幸いです。

オフライン

 

Board footer

Powered by FluxBB