内容纲要

apt install network-manager

# 查看网络接口
nmcli d
DEVICE  TYPE      STATE      CONNECTION 
enp0s3  ethernet  unmanaged  --         
lo      loopback  unmanaged  -- 
ip route
default via 192.168.1.1 dev enp0s3 proto dhcp src 192.168.1.111 metric 100 
192.168.0.0/22 dev enp0s3 proto kernel scope link src 192.168.1.111 
192.168.1.1 dev enp0s3 proto dhcp scope link src 192.168.1.111 metric 100 
sudo nano /etc/netplan/01-netcfg.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s25:
      dhcp4: no
      addresses:
        - 192.168.31.16/24
      gateway4: 192.168.31.1
      nameservers:
          addresses: [8.8.8.8, 1.1.1.1]
sudo netplan apply
ip a

发表评论

电子邮件地址不会被公开。 必填项已用*标注