修改配置IP地址对应参数即可
sudo vim /etc/netplan/01-network-manager-all.yml
network:
ethernets: #你当前的网卡名称;
ens192:
dhcp4: false· #ipv4接口的dhcp开关,false为关闭,true为开启
optional: true
addresses: [11.11.11.1/24] #静态IP地址/掩码
gateway4: 11.11.11.254 #ipv4网关
nameservers:
addresses: [114.114.114.114,8.8.8.8] #DNS服务器 逗号分割
version: 2
执行命令重启网络服务生效
sudo netplan apply
配置DNS
/etc/resolv.conf
———————————————————–
sudo vim /etc/netplan/01-network-manager-all.yml
network:
ethernets:
ens192:
dhcp4: false·
optional: true
addresses: [11.11.11.1/24]
gateway4: 11.11.11.254
nameservers:
addresses: [11.11.11.254,11.11.11.1]
执行命令重启网络服务生效
sudo netplan apply