ラズパイを固定IP化するときは手持ちのルーターでDHCP固定割当をする[raspi]

LAN(ローカル)環境でラズパイを使うときは,ルーターで設定をおこなうことでIPの固定化ができる.

Buffaloのルーターでのやりかた

www.buffalo.jp

JessieのRaspiでの設定

/etc/dhcpcd.confvimなどで開く

以下の内容を追記

interface wlan0
static ip_address=192.168.11.40/24
static routers=192.168.11.1
static domain_name_servers=192.168.11.1

Ubuntu18での設定

sudo vim /etc/netplan/50-cloud-init.yaml

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
version: 2
ethernets:
eth0:
dhcp4: true
match:
macaddress: b8:27:eb:33:39:36
set-name: eth0
addresses: [192.168.11.19/24]
gateway4: 192.168.11.1
nameservers:
addresses: [192.168.11.1]
search: []
optional: true
Pocket