How to modify rancher os /etc/hosts


#1

Hi,
How can I add entries to the /etc/hosts file? I need to statically map machine-names to IPs(localmachine 10.1.0.1) what is the method I can do to add these entries.

Thanks,

Ali


#2

I try to use (for example): “echo 192.168.1.130 us.archive.ubuntu.com >> /etc/hosts”" but is not working.
Do you have any solutions to add an entry in /etc/hosts?

EDIT:
Problem solve, inside cloud-config use:
runcmd:


#3

I’m running RancherOS. It works by editing /etc/hosts directly. The records remain in the system after rebooting.
Is this the normal way?