LinuxQuestions.org
Help answer threads with 0 replies.
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 06-06-2006, 04:11 PM   #1
RoughEdge
Member
 
Registered: Jan 2004
Location: Scotland
Distribution: Slackware 12
Posts: 67

Rep: Reputation: 15
Problems using hostname and ssh


Hi folks,

I have read over quite a few articles and post about hostnames. I have two boxes, both running Fedora Core 4, and one Windows box, all of which are connected through my netgear router. I want to be able to ssh to my apache box to have access to files using my computers name rather than the IP address. My router is set up for DHCP but it doesn't seem to change IP address and I have tried setting up the hostname using hostname mybox.mynetwork on both computers and have also edited both /etc/hosts to read:

192.168.0.3 mybox.mynetwork mybox

in the first linux box (non apache)

192.168.0.4 mybox2.mynetwork mybox2

in the second linux box (apache).

I am getting confused with DHCP servers and FQDN, do I need to have a real domain name to get this to work? Sorry if the answer is staring me in the face but I am really stressing over this now, I kknow it should be simple, but it aint!

Any help is appreciated
 
Old 06-06-2006, 05:30 PM   #2
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
If you have following in the hosts file:

192.168.0.3 mybox.mynetwork mybox
192.168.0.4 mybox2.mynetwork mybox2

then 'ssh mybox' will connect you to 192.168.0.3, 'ssh mybox2' to 192.168.0.4

and so on.
 
Old 06-06-2006, 05:35 PM   #3
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
I would use the same hosts file on all machines even if the machine is listed.
192.168.0.3 mybox.mynetwork.com mybox
192.168.0.4 mybox2.mynetwork.com mybox2

/etc/host.conf should look like this to check hostnames first.
order hosts,bind

Also you should setup the ethernet as static and not as dhcp so they will always have the same IP on boot.
Example of /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
BROADCAST='tion: --broadcast'
# HWADDR=00:90:32:0D:2F:58
IPADDR=192.168.231.58
NETMASK=255.255.255.0
NETWORK='option: --network'
ONBOOT=no
TYPE=Ethernet
GATEWAY=192.168.231.1

Brian1
 
Old 06-07-2006, 03:25 AM   #4
RoughEdge
Member
 
Registered: Jan 2004
Location: Scotland
Distribution: Slackware 12
Posts: 67

Original Poster
Rep: Reputation: 15
Hey guys,

Thanks for all the help. I can't check out what you said until I finish work but I think the problem was I was only putting the IP address of the host computer in the etc/hosts file, I never thought about putting both IP addresses on, I must have thought that it would mess up with that individual computers IP or something. I'll post back later on to let you know how it goes. And thanks Brian1, I will be sure to disable DHCP.

Cheers again
 
Old 06-08-2006, 02:07 PM   #5
RoughEdge
Member
 
Registered: Jan 2004
Location: Scotland
Distribution: Slackware 12
Posts: 67

Original Poster
Rep: Reputation: 15
Hi guys,

This is honestly the first chance I've had to post back (2 jobs...getting to old for this :P). Ok, I changed the hosts file on both computers to allow access using the hostnames.

Files looked like this
Code:
# Do not remove the following line, or various programs
# that require network functionality will fail.
192.168.0.3		ozone.alpha ozone
192.168.0.4		joker.alpha joker
This has allowed me to connect to my machine as I wanted, so thanks very much guys! Again, sorry I couldn't post back sooner. I also setup my router to give me a static IP address, thanks Brian.
 
  


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
Cannot SSH/FTP by hostname, but ip works joshtt Linux - Networking 3 09-20-2005 05:08 AM
can ssh by IP, can't by hostname. FLOODS Linux - Networking 7 09-19-2005 01:41 PM
Ping or SSh by hostname ElectroLinux Linux - Newbie 2 10-26-2004 03:21 AM
can't ssh through hostname romel Linux - Networking 4 07-25-2004 01:54 PM
Do after changed the hostname, can't connection by SSH again? explorer1979 Linux - Networking 2 03-30-2004 10:15 PM

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

All times are GMT -5. The time now is 01:11 AM.

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