如果你用的是Digitalocean VPS主机,用上了Ubuntu 18.04 LTS,可以参考以下示例:
#修改/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: addresses: - 公共ipv4地址/20 - 私有ipv4地址/16 - 公共ipv6地址/64 gateway4: 公共ipv4网关 gateway6: 公共ipv6网关 match: macaddress: MAC地址 nameservers: addresses: - 67.207.67.2 - 67.207.67.3 set-name: eth0 #最后执行命令,应用此文件: netplan apply
8.2 DEBIAN 和 UBUNTU 16.04 或更早
谢谢, 有收获. 昨晚俺的网络IP没了, *连不上, CPU一度50+, 后来降到个位数*还是连不上, web都看不到.
只好从web console 看, ping #不通, 应该是路由IP没了, reboot解决问题. 是Vultr VPS
Qi姐有啥建议? 今天改了10-ens3.yaml , dns 8.8.8.8, dhcp关了, 不知道合适不合适…