Java教程

ubuntu22 修改ip方法

本文主要是介绍ubuntu22 修改ip方法,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

 

 

1 安装必备软件

apt install vim curl wget -y

  

2 查看ip配置

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

 结果

# This is the network config written by 'subiquity'
network:
  ethernets:
    eth0:
      dhcp4: true
  version: 2

 

3 设置IP

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

  这里是原文的配置

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

  这是我的配置

# This is the network config written by 'subiquity'
network:
  ethernets:
    ens160:
      addresses:
        - 192.168.1.233/24
      optional: true
      nameservers:
        addresses: []
        search: []
  version: 2

  

 

参考

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

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

这篇关于ubuntu22 修改ip方法的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!