Machines are Linux and Windows virtual machines with persistent storage, GPU options, and free unlimited bandwidth. They’re designed for high-performance computing (HPC) workloads.
You can assign or unassign a persistent hostname on Linux- and Windows-based machines. Persistent hostnames remain the same even after the machine shuts down or restarts.
To assign a hostname, you first need the IP address of your machine.
In the Paperspace console, in the top-left corner, click the dropdown menu and select CORE. Click the Machines tab, then find and select the machine that you need the IP address for.
On the machine’s overview page, click the Details tab. On the right, under Public IP (if your machine is public) or Private IP (if your machine is private) section, your machine’s IP address is listed.
Once you have the IP address of your machine, need to connect to your machine and follow the instructions below for Linux machines.
In your machine, open a terminal, then open the /etc/hosts
file with a text editor of your choice.
sudo nano /etc/hosts
In /etc/hosts
, look for the localhost
entry and update it to use your new hostname and the IP address of your machine. If there isn’t a localhost
entry, add one on a new line.
198.51.100.0 localhost your-new-hostname
Then, save and exit the file.
If system updates affect /etc/hosts
or the hostname utility, you must re-add your hostname. For more information about the hosts file on Linux, see the hosts file man page.
Then, set your new hostname by running the hostnamectl
command with your new hostname.
sudo hostnamectl set-hostname your-new-hostname
In the Paperspace console, in your machine’s overview page, click RESTART to apply your hostname changes to your machine.
Then, reconnect to your machine, open a terminal, and run the hostname
command to verify that the hostname change persisted. The command should output the new hostname you added.
The hosts file on Windows-based machines is C:\Windows\System32\drivers\etc\hosts
. You can’t directly modify the hosts file within the system directory, so you first need to copy it to a location where you can edit it, like your desktop:
copy C:\Windows\System32\drivers\etc\hosts Desktop\hosts
Open the hosts file using a text editor of your choice.
notepad Desktop\hosts
Add your new hostname to the hosts file by adding the new hostname alongside the IP address of your machine.
198.51.100.0 your-new-hostname
After you’ve added your new hostname, save and exit the file. Then, copy the modified hosts file back into the system directory, which replaces the old hosts file.
move /Y Desktop\hosts C:\Windows\System32\drivers\etc\hosts
In the Paperspace console, in your machine’s overview page, click RESTART to apply your hostname changes to your machine.
Then, reconnect to your machine, open a terminal, and run the ping
command with your new hostname to verify that the hostname change persisted. The command should output the new hostname you added.
ping your-new-hostname
If you want to unassign a hostname on your machine, you need to follow the steps for assigning a hostname for either your Linux-based machine or Windows-based machine, except instead of adding a new hostname, you remove the hostname you want to unassign to your machine from the hosts file.