Beginners Guide: Locating your board, connecting to it.
#3
Information 
Setting up a Hostname 


Preface
Depending on your network configuration, and how often you reboot your Rock 64 or your Router, you might see that the IP Address of the board changes. This is simply the byproduct of the device having a dynamically assigned IP address, most devices on home/small default to that mode.

If you wish to keep logging in or accessing your Board without having to keep track of your IP, there are two strategies. The first is assigning a Hostname to your device, so that even if it's IP address changes in the network, it will still be identifiable (and contactable) via a hostname. The second option is to configure the device to keep its IP address Static. 

In this guide, we will be setting up a Hostname. 



You'll need to make sure you know the current IP address of your device, and be logged in via SSH.  

The easiest way to do this is to use a tool called "nmtui". You'll need superuser privileges to invoke this text user interface, so put the following into the terminal and hit enter: 

Code:
sudo nmtui


Use the arrows key to select "Set System Hostname" and press the tab key to highlight "okay". 

[Image: pBqWZfC.png?1]

Hit enter and you should get a text field to set the hostname of your choice. 

[Image: xx7tvI1.png] 

Press the tab key to highlight "okay" and hit enter to set your new hostname: 

[Image: JFTmrd9.png] 




Not all Distros have this tool installed. If you dont have nmtui installed, there is another fairly simple way.  

You'll need to edit the file /etc/hostname and to do that, you'll need superuser privilege. Type in: 

Code:
sudoedit /etc/hostname



Then type in your password and hit enter. 
[Image: MyDO0De.png]
It will open a basic text editor, in which you put down the hostname you'd like: 
[Image: lWy5nq3.png]
Hold down  the Control key and Hit X to save and exit, you'll be prompted to save. Press the Y key: 
[Image: V4or3Ht.png]
Press enter to save the file, dont worry about the filename: 
[Image: V4or3Ht.png]
You'll need to edit one more file, in a similar way: 
Code:
sudoedit /etc/hosts
 
Change the first line to the same hostname you set prior: 
[Image: VypZIJ5.png]
Save and exit the document the same way: press Control + X, then Y, the Enter to finally save and exit the text editor. 
To immediately change the hostname without a reboot, you'll need to run a script: 

Code:
sudo /etc/init.d/hostname.sh start
It should take a moment to run and return you to prompt. You should have your hostname changed now, confirm it by typing in "hostname" into the terminal: 
[Image: JfKVeyn.png]


To login using a hostname instead of an IP Address, you simply put in the hostname followed by a ".local" into your SSH client. This way, it will connect to the server, regardless of what its IP address may be. In this case, my hostname was rock64.  


So, instead of doing 


Code:
ssh rock64@192.168.1.128


I can simply do 

Code:
ssh rock64@rock64.local

Which follows this notation: 

Code:
ssh username@hostname.local



[Image: FUfbY9k.png]

Using this method, you will be able to access your board, regardless of what the IP address is.
  Reply


Messages In This Thread
Connecting to your board via SSH - by Ptheven - 08-08-2017, 05:17 AM
Setting up a Hostname - by Ptheven - 08-08-2017, 06:53 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Information Beginners Guide: Adding USB Storage, Linux Formatting and Permissions Ptheven 4 7,006 03-06-2021, 01:49 PM
Last Post: helpmerock
  Step by step guide PXE diskless configuration. burglar_ot 13 13,886 11-01-2020, 11:26 PM
Last Post: michael.gruner
  Beginners Guide: Migrating to SSD rontant 17 21,301 05-24-2019, 12:23 PM
Last Post: thatchunkylad1989
Thumbs Up A guide for how I made RetroPie, RetroArch, and EmulationStation Work on the Rock64 Mrfixit2001 4 10,219 12-17-2018, 03:52 AM
Last Post: va88
  Guide - XRDP - Debian Stretch / Ubuntu Xenial / OMV S3phi40T 3 9,951 05-05-2018, 06:08 AM
Last Post: S3phi40T
Information Guide - Raid Array (Raid 0) Ptheven 0 3,031 10-07-2017, 09:22 AM
Last Post: Ptheven
Information Guide - Setting up a NFS Share Ptheven 0 3,601 09-26-2017, 04:44 AM
Last Post: Ptheven
  Guide - Setting up a SMB(Windows) file server Ptheven 0 10,179 08-21-2017, 08:54 AM
Last Post: Ptheven

Forum Jump:


Users browsing this thread: 1 Guest(s)