1.更改动态IP为固定IP Ubuntu22.04
sudo vim /etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
enp0s5:
addresses:
- 192.168.1.7/24
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
routes:
- to: default
via: 192.168.1.1
sudo netplan try
sudo netplan apply