据了解一个双网卡才可以同时设置内外网Ip
ubuntu 18以后设置内外网IP在/etc/netplan目录下,新建51-cloud-init.yaml (以..yaml结尾的文件即可,此处为什么用51,随意即可)
内网IP
network:
version: 2
ethernets:
ens255f1:(此处提示一下,ens255f0这个是你的网卡,要提前看好你的网卡哦 ifconfig)
dhcp4: no
dhcp6: no
addresses: [192.168.*.*/24]
外网IP
network:
ethernets:
enp7s0f0:(此处提示一下,ens255f0这个是你的网卡,要提前看好你的网卡哦 ifconfig)
addresses: [*.*.*.*/24](外网IP)
dhcp4: no
gateway4: *.*.*.* (网关)
nameservers:
addresses: [114.114.114.114]
version: 2