一、图像化方式

 

 

 

 

 二、旧版本的 Ubuntu 使用 /etc/network/interfaces 这个文件来配置网络接口了

auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

三、最新的版本的 Ubuntu 已经不再使用 /etc/network/interfaces 这个文件来配置网络接口了。而是使用 netplan 工具来进行网络配置。

找到需要修改的网络接口名称:根据需要修改的网络接口名称(如 eth0 或 enp3s0 等)找到该网卡的配置文件,文件路径一般为 /etc/netplan/ 目录下以 .yaml 结尾的文件。

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses: [192.168.1.10/24]
      gateway4: 192.168.1.1
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]

保存并退出文件

配置生效:sudo netplan apply

 

posted on 2023-03-27 18:00  属于我的梦,明明还在  阅读(222)  评论(0)    收藏  举报