---
title: "linux shell 配置固定ip"
author: "sunj"
date: "2026-04-21T10:11:18Z"
tags: []
categories: ["操作系统"]
slug: "linux-shell-ip"
draft: false
lastmod: "2026-04-21T10:11:18Z"
id: 2540502
url: "https://sunj.iteye.com/blog/2540502"
---

root用户切到 /etc/netplan

vim 01-network-manager-all.yaml   // 注意如果多个此文件会默认用号小的

network:
  ethernets:
    enp3s0:
      dhcp4: false
      addresses: 
      gateway4: 192.168.1.1
      nameservers:
        addresses: 
  version: 2
  renderer: NetworkManager

保存后执行 netplan apply

注意：每个冒号后面要加一个空格，否应用时会报错