Hosts file?


Recommended Posts

It is actually a part of the operating system that gets installed in the RAM of your server as it unzips the bz* files in the root of your Flash Drive. 

 

You need to go the command line to actually find the hosts file at /etc/hosts.  To get to the command line, log in on the console or via a PuTTY session from your PC. You will need to learn some Linux Commands at this point to do but a google search should get a link to a introductory text. 

Link to comment
1 hour ago, squirrellydw said:

thanks, so I found it and trying to add an IP to it but it doesn't seem to save it.  

sudo nano /etc/hosts

control x  and Y to save but when I look at the hosts file again what I added isn't there

 

 

 

Nano is confusing on what actually causes the file to updated.   On exiting,  You have to agree to save  the changes.   Use the following command to see if the date and time have been updated   

ls -al /etc

 

Link to comment

Quick check though is that if you're running a Plex docker, then you have to start / stop the container for the local version of hosts that it uses to re-grab the one that unRaid uses.  IE:  You're going to have to make a separate hosts file on the flash drive and then edit /boot/config/go and add the line

 

cp /boot/hosts  /etc/hosts

 

before the line that has emhttp  in it so that it'll take effect with every boot.

Link to comment

Because the default one is unpacked from bzroot at boot, overriding any changes you made.  Any changes made to the "OS" are non-persistent across reboots, bzroot contains all the OS files and are unpacked to RAM.

Edited by CHBMB
Link to comment

You have to understand that unRAID does NOT run from the Flash Drive.  The OS is stored in the files on that Drive and the actual OS is loaded into RAM --- think of it as a RAM disk --- and that unRAID uses those files in RAM to actually run the system.  (Basically, unRAID uses Flash drive to initially load the OS into RAM and grabs some information from a few files in the config folder to modify some default settings. This takes most MB's about two minutes to do.  The Flash Drive is basically unaccessed by the OS until you are ready to shut the system down.  It will then write  a Flag bit to a file in the config folder to indicate a proper shutdown.)

 

If you want to modify a built-in configuration file, you have to do it every time that the OS loads.  Most folks who do this simply copy the modified file from the RAM disk file to a folder on the Flash Drive and put a line in the go file as Squid suggested.

 

Another way to thing about it is that the Flash Dive in unRAID is what the DVD Installation Disk is to Windows.  And that RAM Disk is to unRAID as the hard drive  (C:\)  is to Windows!

Link to comment
7 hours ago, Squid said:

Quick check though is that if you're running a Plex docker, then you have to start / stop the container for the local version of hosts that it uses to re-grab the one that unRaid uses.  IE:  You're going to have to make a separate hosts file on the flash drive and then edit /boot/config/go and add the line

 

cp /boot/hosts  /etc/hosts

 

before the line that has emhttp  in it so that it'll take effect with every boot.

 

No, don't do that !!!

 

The hosts file is dynamically generated by unRAID to ensure it contains the proper entries, do NOT overwrite this file.

 

You can however add entries to the hosts file from your go file:

 

echo "[ip] [name]" >> /etc/hosts

 

For example

echo "192.168.111.10 hostname.mydomain.com" >> /etc/hosts

 

 

Link to comment
6 hours ago, bonienl said:

 

No, don't do that !!!

 

The hosts file is dynamically generated by unRAID to ensure it contains the proper entries, do NOT overwrite this file.

 

You can however add entries to the hosts file from your go file:

 

echo "[ip] [name]" >> /etc/hosts

 

For example


echo "192.168.111.10 hostname.mydomain.com" >> /etc/hosts

 

 

Only problem then with appending the entries within go is that you can't guarantee when in the boot process unRaid creates the file.  OP would be better off setting up a user script (set to run at array start) with the appropriate echo command.

Link to comment

A better alternative might be to request that LimeTech provide for the appending of a user generated hosts file to the default one that LimeTech provides.  This could be done in much the same manner as is currently done with the  smb-extra.conf  file. 

 

Of course, this will require that someone with a truly vested interest in acquiring such an feature make the request and support that request with valid reasons for its need. 

Link to comment
10 hours ago, Squid said:

Only problem then with appending the entries within go is that you can't guarantee when in the boot process unRaid creates the file.  OP would be better off setting up a user script (set to run at array start) with the appropriate echo command.

 

would you like to mike that script?  I have no idea how to do that.  I could fill in the IP and name if you tell me where to put it.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.