banner
年糕

年糕日记

此站为备份站点,最新文章请访问 oior.net
telegram
email

防止LXC小雞(PVE環境)中系統文件每次重啟後自動修改

在 PVE 環境下的 LXC 容器每次啟動時 PVE 都會自動探測容器中運行的作業系統,並自動修改某些作業系統配置文件,以 Alpine Linux 為例,會自動修改以下配置文件:

  • /etc/hostname
  • /etc/hosts
  • /etc/resolv.conf
  • /etc/network/interfaces

自行修改這些文件內容後,如果不想每次重啟後被 PVE 自動修改,可以在該文件同目錄下創建文件名為 [.pve-ignore.+ 文件名] 的空文件,這樣 PVE 就不會自動修改這個文件內容了。
例如:

1. 禁止PVE自動修改網路介面設置
$ touch /etc/network/.pve-ignore.interfaces

2. 禁止PVE自動修改DNS設置
$ touch /etc/.pve-ignore.resolv.conf

3. 禁止PVE自動修改主機名設置
$ touch /etc/.pve-ignore.hosts
$ touch /etc/.pve-ignore.hostname

官方文件在這裡:
https://pve.proxmox.com/wiki/Linux_Container#_guest_operating_system_configuration

載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。