ubuntu22 修改ip方法

 

 

1 安装必备软件

1
apt install vim curl wget -y

  

2 查看ip配置

1
cat /etc/netplan/00-installer-config.yaml

 结果

1
2
3
4
5
6
# This is the network config written by 'subiquity'
network:
  ethernets:
    eth0:
      dhcp4: true
  version: 2

 

3 设置IP

1
vim /etc/netplan/00-installer-config.yaml

  这里是原文的配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
network:
  ethernets:
    eth0:
      dhcp4: false
      dhcp6: false
      addresses:
        - 192.168.10.120/24
      optional: true
      routes:
        - to: default
          via: 192.168.10.1
      set-name: eth0
      nameservers:
        addresses:
          - 223.5.5.5
          - 223.6.6.6
        search:
          - localhost
          - local
  version: 2

  这是我的配置

1
2
3
4
5
6
7
8
9
10
11
# This is the network config written by 'subiquity'
network:
  ethernets:
    ens160:
      addresses:
        - 192.168.1.233/24
      optional: true
      nameservers:
        addresses: []
        search: []
  version: 2

4 执行

1
netplan apply

  

参考

https://blog.csdn.net/m0_37052320/article/details/100107557

https://blog.csdn.net/fenglailea/article/details/125426306

 

https://www.cnblogs.com/xingsiyue/p/16557428.html

https://www.jb51.net/article/187742.htm

posted @   lovleo  阅读(3047)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
点击右上角即可分享
微信分享提示