- 1,系统版本
- 2,修改IP配置文件
- 3,Ubuntu 18.04.4
# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.3 LTS Release: 18.04 Codename: bionic2,修改IP配置文件
- /etc/netplan 配置文件目录
# cat 01-network-manager-all.yaml
network:
version: 2
renderer: NetworkManager
ethernets:
enp9s0f0:
dhcp4: no
addresses: [192.168.0.112/24]
gateway4: 192.168.0.1
nameservers:
addresses: [114.114.114.114]
- 重启网络服务
# netplan apply3,Ubuntu 18.04.4
# cat /etc/issue Ubuntu 18.04.4 LTS n l
- 默认配置
# cat /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 reboot. 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:
eno2:
dhcp4: true
version: 2
- 应用配置
netplan apply
network:
ethernets:
eno1:
dhcp4: true
eno2:
dhcp4: no
addresses: [192.168.0.11/24]
gateway4: 192.168.0.1
nameservers:
addresses: [114.114.114.114]
version: 2
systemctl status systemd-networkd
netplan --debug apply
network:
renderer: networkd
ethernets:
eno1:
dhcp4: no
addresses: [192.168.0.100/24]
gateway4: 192.168.0.1
nameservers:
addresses: [114.114.114.114]
eno2:
dhcp4: no
addresses: [192.168.0.101/24]
gateway4: 192.168.0.1
nameservers:
addresses: [114.114.114.114]
version: 2
参考:
- ubuntu18.04LTS设置静态IP
- Ubuntu 18.04 LTS 使用 Netplan 配置网络教程
- How to configure static IP address on Ubuntu 18.04 Bionic Beaver Linux



