LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-07-2007, 11:49 PM   #1
JonBL
Member
 
Registered: Oct 2006
Location: Victoria, Australia
Distribution: Fedora 10
Posts: 127

Rep: Reputation: 16
How Do I Assign Hostnames?


Our home network includes two Fedora 8 PC's connected to a Linksys WRT54G router, which has DHCP enabled. I want to assign host names such as newton.home.org and einstein.home.org to these two PC's, so that I can ssh to either of these PC's from the other using these host names. (sshd is running on both PC's.)

How can I set this up so that ssh always starts a secure shell session to the other named F8 PC? I want to keep this simple (eg, somehow assign a fixed IP address to the F8 boxes and edit /etc/hosts, if that's a viable solution). But I don't want it to upset the other PC's and printers that are also connected to our home network.

Can anyone assist?
 
Old 12-08-2007, 01:06 AM   #2
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
You have a lot of questions, of which I do not know if I can answer all.

To set your system's host name, you can go through the pull-down menus to launch the Network Administration GUI (System->Administration->Network) to set the hostname (goto the DNS tab), or you can edit the file /etc/sysconfig/network and set it there. It's easiest to perform a reboot to ensure that the system as a whole picks up the change in the hostname.

As for registering each system with the other, you can create aliases in the /etc/hosts file. Once again, you can use the Network Administration tool referred to above (goto the Hosts tab).

After the changes are made, you should immediately be able to ssh (or ping) the other system using the alias. For instance:
user@PC1 $ ssh PC2
Now, as far as static IPs are concerned, it is not too difficult to set up, however when I first installed F8 I noticed that it did not accept my settings. I've heard through the grapevine that perhaps NetworkManager is to blame. Nevertheless, the easiest way to set it up is to once again rely on the Network Administration tool. You will need to select the interface (e.g. eth0) from the Devices tab, and from there click on the Edit menu button.

In the middle of the dialog that pops-up, the default setting for DHCP is probably selected. You want to select the "Statically set IP addresses", and then enter your information. For instance:
192.168.1.101
255.255.255.0
192.168.1.1
Then reboot and cross your fingers that the settings will remain intact without Network Manager interfering.

P.S. You could always disable Network Manager using the Service Configuration GUI.
 
Old 12-08-2007, 01:12 AM   #3
Slokunshialgo
Member
 
Registered: Jan 2006
Distribution: Ubuntu 9.04, Fedora 10
Posts: 76

Rep: Reputation: 17
Just an added note for the static IP thing... If you're willing to look into your router's setting, you should be able to change your DHCP settings so that a given MAC address can have an assigned IP. For example, I have my desktop set up to always be 192.168.0.102, and my laptop *.100, no matter what OS I'm using. This also prevents other computers from accidentally grabbing the IP when the one you want it assigned to is turned off.
 
Old 12-08-2007, 02:39 PM   #4
mrrangerman
Member
 
Registered: Oct 2007
Location: MI
Distribution: Debian Slackware
Posts: 528

Rep: Reputation: 59
Or you can setup your linksys router with range of addresses for DHCP (which it is by default) to lets say 150 - 200 (100-200 default) and anything below 150 can be used for static ip. Then when you setup a static ip on your pc it will be seen as such by the router. And everyone else will be given a dynamic ip from the router.

Quote:
How can I set this up so that ssh always starts a secure shell session to the other named F8 PC?
By this do you mean at boot up? If thats what your talking about, it wouldn't be a good idea. Other than that just open a terminal window and ssh /ip.add.ress/ and ssh will setup a secure key for you the first time you log in, then after that each other login you will just have to enter the passwd. There is a way to setup a script, for ssh so that when you login the passwd is not transmitted over the line. So all you would need to do is enter ssh ip/or/host name and you would be in without having to enter a passwd each time. Not the best idea, if you have people that would have access to your pc though.
 
Old 12-08-2007, 09:56 PM   #5
JonBL
Member
 
Registered: Oct 2006
Location: Victoria, Australia
Distribution: Fedora 10
Posts: 127

Original Poster
Rep: Reputation: 16
Thanks everyone for your assistance to date! Mrrangerman, I want to be able to start a ssh session after booting both F8 boxes. At the moment, I can use ifconfig to identify the IP addresses that my router has handed out the two boxes, and from a terminal session on one box, I can ssh to the other box by specifying its known current IP address such as 192.168.1.101.

My objective is to use host names such as einstein.home.org instead of having to determine its IP address before I can ssh to it. I'm hoping that I can edit my /etc/hosts file to provide translations of host names to IP addresses to meet this requirement. Following Slokunshiaglo's suggestion, I'm presently trying to sort out how to set up my WRT54G router to assign a fixed IP address to my F8 box MAC addresses, if its possible...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
using windows hostnames JohnLocke Linux - Newbie 7 11-10-2006 08:52 PM
How to assign diffrent ip/hostnames to diffrent services koppaspider Linux - General 1 02-10-2006 10:03 PM
hostnames thenewguy05 Linux - Networking 1 07-12-2004 06:08 PM
Dynamic Hostnames jnoller Linux - Networking 0 08-06-2003 09:39 AM
Hostnames glj Linux - Networking 3 02-12-2002 11:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:46 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