Ubuntu 22.04配置静态IP地址
1、查看ip地址网卡名称:ifconfig
2、编辑网卡配置文件:sudo vim /etc/netplan/01-network-manager-all.yaml 默认样式:
network:
version: 2
renderer: NetworkManager
3、修改为:
network:
ethernets:
enp7s0:
dhcp4: no
dhcp6: no
addresses:
- 192.168.50.250/24
routes:
- to: default
via: 192.168.50.1
nameservers:
addresses:
- 114.114.114.114
- 223.5.5.5
version: 2
renderer: networkd
4、 更新网卡:sudo netplan apply 即可完成