Quantcast
Channel: mattintosh note
Viewing all articles
Browse latest Browse all 892

Raspbian + DHCP で DNS サーバの固定

$
0
0

Raspberry Pi Zero で /etc/network/interfacesに以下のように設定した。

iface wlan0 inet manual
    dns-nameservers 8.8.8.8
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

/etc/resolv.confは以下のようになった。

# Generated by resolvconf
nameserver 192.168.1.1
nameserver 8.8.8.8

違う!違うよ!!!

Raspbian だと /etc/dhcpcd.confの設定が優先されるらしい。

man dhcpcd.confには以下のように書いてあった。

Here is an example which configures a static address, routes and dns.
    interface eth0
    static ip_address=192.168.0.10/24
    static routers=192.168.0.1
    static domain_name_servers=192.168.0.1

static domain_name_servers=で固定できそうだ。しかし、serversと言うからには複数設定できると思われるのだが、デリミタが何なのかが書いてない。man -K domain_name_serversで全マニュアルを検索してみたがやっぱり書いてない。

とりあえず当てずっぽうで space にして /etc/dhcpcd.confに書いてみた。。

interface wlan0
static domain_name_servers=8.8.8.8 8.8.4.4

期待通りになった。

# Generated by resolvconf
nameserver 8.8.8.8
nameserver 8.8.4.4

NetworkConfiguration - Debian Wikiに似た書式で書いてあったけど微妙に違う。

Linuxはほんとこの辺統一してほしい…。


Viewing all articles
Browse latest Browse all 892

Trending Articles