[TUTORIAL] Modify an entry in the hosts file of an lxc container that persists after a restart.

sharbich

Member
Nov 7, 2024
48
1
8
Hello,
i installed an LXC container under Proxmox.
I would like to change the following entry in the file "/etc/hosts"
Code:
bareos@bareos:~$ cat /etc/hosts
127.0.0.1    localhost
::1        localhost ip6-localhost ip6-loopback
ff02::1        ip6-allnodes
ff02::2        ip6-allrouters
# --- BEGIN PVE ---
127.0.1.1 bareos.intern.example.com bareos
# --- END PVE ---
as follows?
Code:
bareos@bareos:~$ cat /etc/hosts
127.0.0.1    localhost
::1        localhost ip6-localhost ip6-loopback
ff02::1        ip6-allnodes
ff02::2        ip6-allrouters
# --- BEGIN PVE ---
192.168.20.131 bareos.intern.example.com bareos
# --- END PVE ---
If I manually change this in the hosts file, it will be overwritten after a restart. How can I change this?
Regards, Stefan