# 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:
ethernets:
eth0:
dhcp4: true
version: 2
這裡我透過編輯器將內容修改如下:
```
# 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:
ethernets:
eth0:
dhcp4: no
addresses: [192.168.88.88/24]
gateway4: 192.168.88.254
nameservers:
addresses: [168.95.1.1, 8.8.8.8]
version: 2
```
* eth0: 網路介面卡名稱
* dhcp4 或 dhcp6: dhcp 設定,各別是 IPv4 或 IPv6。yes|no
* addresses: 靜態IP設定
* gateway4: IPv4 的網路閘道
* nameservers: 域名解析伺服器
設定完後後要將設定套用
1 則留言:
if config -a
if與config中間不應有空格
張貼留言