ubuntu 修改网络 静态IP

network:
  version: 2
  renderer: networkd
  ethernets:
    ## 可以ip a查看以太网连接名称
    eth0:
      dhcp4: no
      dhcp6: no
      ## addresses添加网络掩码,如192.168.56.3/24
      addresses:
        - 192.168.38.105/24
      routes:
        - to: default
          via: 192.168.38.99
      nameservers:
        addresses:
          - 223.5.5.5
          - 1.1.1.1

# nano /etc/netplan/*** 文件名排序排在前面的有效
# sudo netplan try
# sudo netplan generate
# sudo netplan apply
posted @ 2023-08-16 21:03  ChasingDreams  阅读(28)  评论(0编辑  收藏  举报