Ubuntu20.04 网络配置
Ubuntu20.04 网络配置
设置 ROOT 密码
- 先设置 root 密码,后面直接使用 root 用户操作
it@it:~$ sudo passwd root
[sudo] password for it:
New password:
Retype new password:
passwd: password updated successfully
网络管理工具 netplan
- 在 Ubuntu20.04 版本中使用 netplan 管理网络
- 在安装好的 Ubuntu20.04 中没有 networking 和 NetworkManage 服务
- netplan 配置文件:/etc/netplan/*.yaml ,文件名每个不一样
- netplan 示例文件: /usr/share/doc/netplan/example/ 目录下,在该目录下有各种示例文件,可以提供帮助

修改网卡配置
- 编辑网络配置文件
root@it:~# vim /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
ethernets:
ens32:
addresses:
- 192.168.121.25/24
gateway4: 192.168.121.2
nameservers:
addresses:
- 8.8.8.8
version: 2
- 加载刚刚修改的配置文件信息
root@it:~# netplan apply
root@it:~#
- 没有提示报错信息,说明配置成功
root@it:~# ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:16:8d:18 brd ff:ff:ff:ff:ff:ff
inet 192.168.121.25/24 brd 192.168.121.255 scope global ens32
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe16:8d18/64 scope link
valid_lft forever preferred_lft forever
netplan 帮助信息
root@it:~# netplan help
usage: /usr/sbin/netplan [-h] [--debug] ...
Network configuration in YAML #YAML中的网络配置
optional arguments:
-h, --help show this help message and exit #显示此帮助信息并退出
--debug Enable debug messages #启用调试消息
Available commands:
help Show this help message #显示帮助信息
apply Apply current netplan config to running system #应用当前netplan配置到运行系统
generate Generate backend specific configuration files from /etc/netplan/*.yaml #从/etc/netplan/*.yaml中生成特定后端配置文件
info Show current netplan version and available features #显示当前netplan版本和可用特性
ip Retrieve IP information from the system #从系统中检索IP信息
try Try to apply a new netplan config to running system, with automatic rollback #尝试将新的netplan配置应用到正在运行的系统,并自动回滚
- 启用调试信息
root@it:~# netplan --debug apply
** (generate:3189): DEBUG: 01:15:27.908: Processing input file /etc/netplan/00-installer-config.yaml..
** (generate:3189): DEBUG: 01:15:27.908: starting new processing pass
** (generate:3189): DEBUG: 01:15:27.908: We have some netdefs, pass them through a final round of validation
** (generate:3189): DEBUG: 01:15:27.908: ens32: setting default backend to 1
** (generate:3189): DEBUG: 01:15:27.908: Configuration is valid
** (generate:3189): DEBUG: 01:15:27.908: Generating output files..
** (generate:3189): DEBUG: 01:15:27.908: NetworkManager: definition ens32 is not for us (backend 1)
(generate:3189): GLib-DEBUG: 01:15:27.908: posix_spawn avoided (fd close requested)
DEBUG:netplan generated networkd configuration changed, restarting networkd
DEBUG:no netplan generated NM configuration exists
DEBUG:ens32 not found in {}
DEBUG:Merged config:
network:
bonds: {}
bridges: {}
ethernets:
ens32:
addresses:
- 192.168.121.25/24
gateway4: 192.168.121.2
nameservers:
addresses:
- 8.8.8.8
vlans: {}
wifis: {}
DEBUG:Skipping non-physical interface: lo
DEBUG:device ens32 operstate is up, not changing
DEBUG:{}
DEBUG:netplan triggering .link rules for lo
DEBUG:netplan triggering .link rules for ens32
Ubuntu20.04 网络配置的更多相关文章
- ubuntu20.04 apache2 配置安装ssl证书
1. 获取SSL证书 根据自己的网站服务器来获取不同的ssl证书,我的服务器是ubuntu20.04. 证书如下: 00_***.key ## 私钥文件 01_CERTIFICATE_***_***. ...
- ubuntu12.04网络配置
1.配置/etc/network/interfaces #静态IP地址 auto lo iface lo inet loopback #loopback虚拟网络设备,使TCP/IP能以127.0.0. ...
- Ubuntu16.04 网络配置
Ubuntu 网络配置 安装Ubuntu操作系统之后,为了通过Xshell连接主机,或者连接其他主机.需要进行如下网络配置和ssh服务配置. 1 网络配置 1.1 修改网络配置信息 sudo vi / ...
- ubuntu14.04 网络配置
流程分析: 在Ubuntu系统网络设备启动的流程中,会依赖/etc/network/interface的配置文件初始化网络接口,所以直接在/etc/network/interface之中配置好对应的d ...
- ubuntu 16.04 网络配置之虚拟网卡的配置
关于图形界面的配置,我这里就不多介绍了,这个很简单.这里介绍的是如何通过修改配置文件来实现虚拟网卡. 首先介绍ubuntu(我这里使用的是ubuntu-16.04)下虚拟网卡的配置 1.先用ifcon ...
- ubuntu 12.04网络配置之设置静态iP
step: 1.输入命令: sudo vi /etc/network/interfaces 看到如下内容: 2.追加以下内容: iface eth0 inet static address 192.1 ...
- ubuntu-server14.04 网络配置
一.启动网卡 ubuntu server 安装后,ifconfig 发现只有一个lo 和一个p1p1 网卡, 先查看服务器网卡:ifconfig -a ,发现有lo ,p1p1,p2p1,p3p1,p ...
- ubuntu server 18.04 网络配置
从17.10开始放弃在/etc/network/interfaces里固定IP的配置 配置文件是:/etc/netplan/50-cloud-init.yaml .用缩进来表示层级关系 冒号之后要有个 ...
- vmwareubuntu18.04网络配置
用vm安装ubuntu的时候要如果使用的是net模式,要确保vm的net服务和dhcp服务开启了,右键我的电脑-管理-服务和应用程序-服务找到对应的vm net服务和dhcp服务启动.
随机推荐
- String 的不可变真的是因为 final 吗?
尽人事,听天命.博主东南大学硕士在读,热爱健身和篮球,乐于分享技术相关的所见所得,关注公众号 @ 飞天小牛肉,第一时间获取文章更新,成长的路上我们一起进步 本文已收录于 「CS-Wiki」Gitee ...
- SpringCloud+Nacos实现服务配置中心(Hoxton版本)
关于 Nacos Spring Cloud 的详细文档请参看:Nacos Config和Nacos Discovery. 通过 Nacos Server 和 spring-cloud-starter- ...
- WordPress的SEO优化技巧
世界上大约有30%的网站都是由Wordpress搭建的,因为Wordpress自身构架清晰,代码规范,且网页评论直接书写在整个页面里,能够被搜索引擎检索到,因此对搜索引擎很友好.但有时候还是会出现只被 ...
- pwnable.tw 3x17
3x17 文章主要是参考了https://xuanxuanblingbling.github.io/ctf/pwn/2019/09/06/317/ 首先我们检查一下开启的保护 运行一下,先让输入add ...
- Spring Boot demo系列(四):Spring Web+Validation
2021.2.24 更新 1 概述 本文主要讲述了如何使用Hibernate Validator以及@Valid/@Validate注解. 2 校验 对于一个普通的Spring Boot应用,经常可以 ...
- Mysql之Mycat读写分离及分库分表
## 什么是mycat ```basic 1.一个彻底开源的,面向企业应用开发的大数据库集群 2.支持事务.ACID.可以替代MySQL的加强版数据库 3.一个可以视为MySQL集群的企业级数据库,用 ...
- 12- APP接口测试以及接口文档的分析
什么是接口? 为什么要做接口测试? 接口测试流程 需求评审 需求分析 接口用例设计 执行测试用例 bug的定位于追踪 接口文档分析 接口文档分析:开发 内容: 1.接口名称 2.接口地址 3.支持方式 ...
- 千位分隔符,音频音量加强,transform 垂直居中
1.最近做阴阳师日本官网,其中有个功能是获取预约人数,设计稿上的人数是这样151,567,000,想了想自己写还有点麻烦,于是网上copy了代码,再修改了下. 其中,有一点需要注意的是:函数中的str ...
- hdu5246超级赛亚ACMer
题意(中文题意直接粘吧) 超级赛亚ACMer Problem Description 百小度是一个ACMer,也是一个超级赛亚人,每个ACM ...
- Windows PE导出表编程4(重构导出表实现私有函数导出)
本次是尝试调用DLL里面的私有函数. 一: 之前先探索一下,首先可以考虑用偏移量来调用,就是如果知道了某个私有函数和某个导出的公共函数的相对便宜的话,直接加载dll获取公共函数地址,然后自己手动去偏移 ...