打开网络配置文件
sudo vi /etc/network/interfaces
结果发现如下内容:
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown
接下来,查看 /etc/netplan文件夹
tacgui@tacgui:~$ ll /etc/netplan/
total 12
drwxr-xr-x 2 root root 4096 Oct 11 08:11 ./
drwxr-xr-x 98 root root 4096 Aug 23 2019 ../
-rw-r--r-- 1 root root 348 Oct 11 08:11 01-netcfg.yaml
里面只有一个文件 01-netcfg.yaml
打开 01-netcfg.yaml
sudo vi /etc/netplan/01-netcfg.yaml
原来,这里修改IP地址
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
ens160:
addresses: [ 192.168.250.113/20 ]
gateway4: 192.168.240.1
nameservers:
search: [ abc ]
addresses:
- "202.115.128.35"