blog/source/_posts/pve-copy-centos-network-fai...

47 lines
1.3 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

title: PVE复制CentOS导致网卡启动失败的问题
tags: []
categories: []
date: 2023-11-30 14:42:03
---
# 背景
因为最近在折腾一些linux相关的软件所以需要频繁创建Centos虚拟机故使用了PVE的模板功能配置好必须的软件作为一个模板这样虚拟机创建更快。
缺点:
- hostname一样每个虚拟机需要改一下
- 网络因为使用的静态IP复制完成后需要改一下IP
修改完IP后发现网络无法启动了
# 排查
查看日志:`journalctl -xe`
![image](https://static.lianglianglee.com/assets/image-20231129104735-a92h5s7.png)
核心报错:
```sql
connection activation failed no suitable device found for this connection
```
连接激活失败,未找到适合此连接的设备。
也就是说网卡找不到。
查看配置
![image](https://static.lianglianglee.com/assets/image-20231129105007-obzvhzr.png)
发现网卡物理地址有配置而且复制虚拟机基于虚拟磁盘复制此文件肯定不会变。故这个网卡地址是一样的。PVE复制的时候又会生成新的网卡地址。
# 修复
变更网卡地址即可寻找PVE生成的网卡地址
![image](https://static.lianglianglee.com/assets/image-20231129105152-ina6aoi.png)
然后更新到centos配置文件中重启网络即可解决。