Ubuntu 17.10 以降 (18.04 LTS以降)
netplan
1. 設定ファイル
/etc/netplan/50-cloud-init.yaml
: 自動生成ファイル。ユーザによる編集は非推奨。/etc/netplan/99_config.yaml
: Ubuntu公式ドキュメント例示ファイル名
2. 設定反映コマンド
1 |
$ sudo netplan apply |
3. 設定例
3.1. WiFi
1 2 3 4 5 6 7 8 9 |
# 99_config.yaml network: version: 2 wifis: wlan0: dhcp4: true access-points: SSID_NAME: password: "password" |
1 2 3 4 5 6 7 8 9 |
# 99_config.yaml network: version: 2 wifis: wlan0: dhcp4: true access-points: Buffalo-G-XXXX: password: "1234567890abc" |
3.2. 固定IPアドレス
1 2 3 4 5 6 7 8 9 10 11 12 |
# 99_config.yaml network: version: 2 ethernets: eth0: dhcp4: false addresses: [192.168.1.10/24] nameservers: addresses: [192.168.1.1, 8.8.8.8] routes: - to: default via: 192.168.1.1 |
3.3. Gatewayアドレスの指定方法
1 2 3 4 5 |
# 前略 eth0: dhcp4: false addresses: [192.168.1.10/24] gateway4: 192.168.1.1 |
上記はGatewayアドレスの指定方法として非推奨(deprecated)である。
非推奨のGatewayアドレス指定に対する警告
1 2 3 4 5 6 7 8 9 10 11 |
** (generate:1510): WARNING **: 00:39:37.596: `gateway4` has been deprecated, use default routes instead. See the 'Default routes' section of the documentation for more details. ** (generate:1510): WARNING **: 00:39:37.597: Problem encountered while validating default route consistency.Please set up multiple routing tables and use `routing-policy` instead. Error: Conflicting default route declarations for IPv4 (table: main, metric: default), first declared in eth0 but also in eth0 ** (process:1508): WARNING **: 00:39:40.572: `gateway4` has been deprecated, use default routes instead. See the 'Default routes' section of the documentation for more details. ** (process:1508): WARNING **: 00:39:40.574: Problem encountered while validating default route consistency.Please set up multiple routing tables and use `routing-policy` instead. Error: Conflicting default route declarations for IPv4 (table: main, metric: default), first declared in eth0 but also in eth0 |