2021/08/01

在proxmox上的LXC一直有個問題 今天終於解決了

記錄一下

當部屬完LXC要更新時出現以下的情況


#dnf -y update

Extra Packages for Enterprise Linux 8 - Next - x86_64          0.0  B/s |   0  B     00:00    

Errors during downloading metadata for repository 'epel-next':

  - Curl error (6): Couldn't resolve host name for https://mirrors.fedoraproject.org/metalink?repo=epel-next-8&arch=x86_64&infra=stock&content=centos [Could not resolve host: mirrors.fedoraproject.org]

Error: Failed to download metadata for repo 'epel-next': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for https://mirrors.fedoraproject.org/metalink?repo=epel-next-8&arch=x86_64&infra=stock&content=centos [Could not resolve host: mirrors.fedoraproject.org]


檢查一下 /etc/resolv.conf


cat /etc/resolv.conf 

# Generated by NetworkManager

search abc.com


發現沒有設定nameserver


可是這個值在佈署LXC時確實有輸入


後來發現可能是 NetworkManager 的問題

導致proxmox 要修改 /etc/resolv.conf 的時候出問題

本來是想直接用 NetworkManager 來處理

直接 nmtui 

結果預設沒有安裝

只好再自己裝

# dnf install -y NetworkManager-tui

在 nmtui 裡設定好 nameserver 後重開

在 /etc/resolv.conf 裡還是沒看到 nameserver


手動把nameserver 加入/etc/resolv.conf 也沒用

重開後就會消失了


於是決定把 NetworkManager 停掉

# systemctl stop NetworkManager.service

# systemctl disable NetworkManager.service


再安裝使用 network-scripts

# dnf install -y network-scripts

# systemctl enable network


改完後重開

再看一下 /etc/resolv.conf

# cat /etc/resolv.conf 

# --- BEGIN PVE ---

search abc.com

nameserver 8.8.8.8

# --- END PVE ---

醬就正常了


https://forum.proxmox.com/threads/proxmox-6-0-9-dns-host-settings-reset-every-time.59434/

https://www.thegeekdiary.com/how-to-disable-networkmanager-in-centos-rhel-8/


沒有留言: