Configure Raspberry Pi host settings
Set the hostname and ensure hostname preservation on reboot.
To give each robot a unique identity on your network you should set the system hostname. These commands modify the cloud‑init configuration to prevent overwriting the hostname, set the hostname files, and apply the changes.
bash
sudo nano /etc/cloud/cloud.cfg
In the editor, find the line beginning with preserve_hostname and set it to true:
preserve_hostname: true
Save and exit (Ctrl+O, Enter, Ctrl+X).
bash
sudo nano /etc/hostname
sudo nano /etc/hosts
Replace occurrences of the old hostname with your robot’s desired name (e.g. rcr001). In /etc/hosts update the line beginning with 127.0.1.1 to reference your new hostname.
bash
sudo hostnamectl set-hostname rcr001
sudo reboot