LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-03-2016, 10:35 AM   #1
lectraplayer
Member
 
Registered: Mar 2003
Location: a little west of Birmingham, AL, USA.
Distribution: Porteus 3.1
Posts: 934

Rep: Reputation: 32
Set hostname or otherwise make it findable


I have most of my hardware the way I want, but am trying to set each system up where I can reliably know which computer is which over my network. I can also find and ping each computer without issue.

I am connecting several computers and a couple cell phones. Each computer runs Porteus, which come from Slackware. A few hook in via a Cat5e, and a couple via WiFi. I expect the IPs to change occasionally due to rebooting and then having to hit DHCP again. Would the hostname be what I need to set here? ...and how would I set it permanently?

Once configured, I intend to start grabbing files off of each computer and syncing them between each machine, as well as to share internet.
 
Old 10-03-2016, 11:10 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,574
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
Create a file /etc/hostname on each computer and put your desired hostname in there. It will then be set each time you boot. You probably want to add the other computers' hostnames to /etc/hosts as well.
 
Old 10-03-2016, 11:43 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,703

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
The /etc/hosts file will only work if the devices have static IP addresses. This can be configured on each computer or you can through address reservation via your router's or DHCP server's configuration. Otherwise you need a local DNS service like dnsmasq.

If you transfer files via scp/sftp you still need to use static IP addresses but you can create something similar to a host file via the ~/.ssh/config file
 
Old 10-03-2016, 08:43 PM   #4
lectraplayer
Member
 
Registered: Mar 2003
Location: a little west of Birmingham, AL, USA.
Distribution: Porteus 3.1
Posts: 934

Original Poster
Rep: Reputation: 32
So far, nothing.

I made me an /etc/hostname file, though I haven't found anything that tells me how to format it under Porteus. I gather it depends on the distro as to what defines the system name. There has to be something local setting the name or I'd expect to see a list of Sys1, Sys2, etc. and not porteus, porteus, etc.

It also doesn't help that I am rusty to Linux 2.2.24, and to Linux networking.
 
Old 10-03-2016, 09:55 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
/etc/hostname file,

the name of the file is supposed to be hosts

https://en.wikipedia.org/wiki/Hosts_(file)


Ramble below.

There are generally 4 ways a computer looks up a resource. Generally it looks to hosts first but that can be set to use other lookups first.

Remember that hosts file can be an issue if you forget about it.

To get really wild you can make a static arp entry and then make a hosts no matter what your dhcp does but again that can really make an issue if you forget.

Last edited by jefro; 10-03-2016 at 09:59 PM.
 
Old 10-03-2016, 10:07 PM   #6
lectraplayer
Member
 
Registered: Mar 2003
Location: a little west of Birmingham, AL, USA.
Distribution: Porteus 3.1
Posts: 934

Original Poster
Rep: Reputation: 32
I've found and edited that file, but the reboot didn't make a difference.
 
Old 10-04-2016, 02:36 PM   #7
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 421

Rep: Reputation: 74
As michaelk said already, best option would be to setup a central DHCP, DNS server. Optionally, you might want to setup ddns as well in the future.

Last edited by c0wb0y; 10-04-2016 at 02:36 PM. Reason: added text
 
Old 10-04-2016, 02:47 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
Many home routers can set permanent IP leases.

You can make most of the systems static also.

When you set hosts and tried ping by name what happens?

Are you using some odd name or not a proper name?

Last edited by jefro; 10-04-2016 at 02:49 PM.
 
Old 10-05-2016, 05:43 PM   #9
crazyhawk
LQ Newbie
 
Registered: Sep 2015
Distribution: openSUSE
Posts: 6

Rep: Reputation: 10
On my system it's /etc/HOSTNAME (capital letters)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
set linux hostname & question about set multiple domain on one ip l0pht Linux - Networking 4 06-08-2012 10:14 AM
how to set hostname? cylarz Linux - Networking 5 07-23-2006 02:48 PM
cannot set hostname kpachopoulos Debian 1 02-27-2006 12:13 AM
how to set the hostname? harys Ubuntu 1 02-15-2006 05:35 AM
set hostname allelopath Linux - Software 10 04-30-2003 06:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration