ubuntu 20.04 修改静态IP和dhcp自动分配IP
2024-10-21 09:59:45
一、静态分配固定IP
kuaibang@k8smaster:~$ sudo nano /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
ethernets:
ens160:
addresses:
- 192.168.1.155/24
gateway4: 192.168.1.1
nameservers:
addresses:
- 192.168.1.1
search:
- localhost
version: 2
说明:
1、ens160 网卡名称(配置的网卡名称要和修改的一样)
2、addresses 固定IP
3、gateway4 网关
4、nameservers 设置DNS
二、dhcp自动分配IP
kuaibang@k8smaster:~$ sudo nano /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
ethernets:
enp2s0:
dhcp4: true
version: 2
三、使其配置文件生效
sudo netplan apply
四、查看是否生效
ifconfig
最新文章
- 部署wcf到IIS时的问题
- 作业七:团队项目——Alpha版本冲刺阶段010
- Mapped Statements collection does not contain value fo
- 据说最近IMO中国队失利的一题
- Smart210学习记录------nor flash驱动
- 'dict' object has no attribute 'a'
- C++读入两个参数
- 为CentOS 加入�本地源
- IOS的 testflight测试设置
- jQuery----blur()方法
- C#中给线程传值并启动
- adb server is out of date.
- MySQL错误:You are using safe update mode and you tried to update a table without a WHERE that uses a K
- Android 7.0 Power 按键处理流程
- mysql也有complex view merging 这个特性(5.6 , 5.7)
- [OpenCV] 编译源程序 2.4.10 以支持 CUDA
- poj 3468 A Simple Problem with Integers(线段树区间更新)
- 判断文本是否溢出/hover显示全部
- GitHub上个最有意思的项目合集(技术清单系列)
- python语法学习之函数、类、模块
热门文章
- memoの关于Qt的一些用法记录
- Java笔记_this关键字
- 前台主页功能-前台轮播图功能完成-git介绍和安装-git使用流程-git常用命令-git忽略文件
- java工厂方法模式学习
- 19.内容提供者ContentProvider
- docker登录Ubuntu出现error storing credentials - err: exit status 1, out: `Cannot autolaunch D-Bus without X11 $DISPLAY`的解决方法
- JS脱敏姓名、身份证、电话、邮箱
- jekins 入门
- 在idea中查看jar包源码
- 【笔记】BootstrapTable带参数刷新数据的坑