Ubuntu 24.04 静态网卡配置
编辑网卡:
/etc/netplan/< 看看自己是的多少 >-cloud-init.yaml
添加以下配置:
network:
version: 2
renderer: networkd
ethernets:
enp0s5:
dhcp4: no
addresses:
- 192.168.20.100/24
routes:
- to: 0.0.0.0/0
via: 192.168.20.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
应用网卡内容:
netplan apply