ubuntu的网络配置 官网:https://help.ubuntu.com/

docker/k8s--------------Ubuntu

修改网卡名:eth0 egrep -v "^$|#" /etc/default/grub sed -i 's/(GRUB_CMDLINE_LINUX=")/\1net.ifnames=0/g' /etc/default/grub grub-mkconfig -o /boot/grub/grub.cfg update-grub

配置网卡: cat /etc/netplan/eth0.yaml

network: ethernets: eth0: dhcp4: true version: 2

启动配置: netplan apply

重启服务器: reboot

配置静态IP [21:01:47-root@jack netplan]#egrep -v ^# eth0.yaml network: version: 2 renderer: networkd ethernets: eth0: addresses: [192.168.179.200/24] gateway4: 192.168.179.2 nameservers: addresses: [8.8.8.8,114.114.114.114]

查看DNS: [21:02:02-root@jack netplan]#systemd-resolve --status Link 2 (eth0) Current Scopes: DNS LLMNR setting: yes MulticastDNS setting: no DNSSEC setting: no DNSSEC supported: no DNS Servers: 8.8.8.8 114.114.114.114

多网卡绑定 [21:31:51-root@jack netplan]#egrep -v "^#" bond.yaml network: version: 2 renderer: networkd ethernets: eth1: dhcp4: no dhcp6: no eth2: dhcp4: no dhcp6: no bonds: bond0: interfaces: - eth1 - eth2 addresses: [192.168.179.200/24] gateway4: 192.168.179.2 nameservers: addresses: [8.8.8.8,114.114.114.114] parameters: mode: active-backup mii-monitor-interval: 100