找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: golang Linux PHP
查看: 487|回复: 0

Ubuntu 24.04 LTS修改和配置IP地址

[复制链接]

81

主题

31

回帖

768

积分

管理员

积分
768
发表于 2024-6-15 19:48:17 | 显示全部楼层 |阅读模式
1.修改网络配置
  1. vi /etc/netplan/50-cloud-init.yaml
复制代码
  1. # This file is generated from information provided by the datasource.  Changes
  2. # to it will not persist across an instance reboot.  To disable cloud-init's
  3. # network configuration capabilities, write a file
  4. # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
  5. # network: {config: disabled}
  6. network:
  7.     ethernets:
  8.         enp1s0:
  9.             addresses:
  10.             - 192.168.1.20/24
  11.             nameservers:
  12.                 addresses:
  13.                 - 222.74.1.200
  14.                 search:
  15.                 - 222.74.126.230
  16.             routes:
  17.             -   to: default
  18.                 via: 192.168.1.1
  19.     version: 2
  20.     wifis: {}
复制代码
2.使之生效
  1. netplan apply
复制代码



您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表