在Ubuntu中,可通过编辑/etc/resolv.conf文件或配置Netplan YAML文件(如/etc/netplan/01netcfg.yaml)设置DNS,保存后执行`sudo netplan