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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-31-2003, 03:20 PM
|
#1
|
Senior Member
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503
Rep:
|
/etc/hosts File
Big question here. I own the domain name www.myspecificdomainname.com. In my /etc/hosts file I have:
69.69.65.65 www.myspecificdomainname.com
127.0.0.1 localhost
I don't even know if this is right but my webserver works. Anyway, could I put in a line like:
69.69.65.65 ssh.myspecificdomainname.com
and then people could ssh into ssh.myspecificdomainname.com
I see people who have machine names like "the_matrix" and "lin-serv". When I boot up the GUI logon says "Welcome to myspecificdomainname.com" Can I change my computers name.
Yes I know this is extremly NOOBISH but thats why I put it here. I missed this part of Linux class.
|
|
|
01-31-2003, 03:56 PM
|
#2
|
LQ Newbie
Registered: Jan 2003
Posts: 15
Rep:
|
I believe the /etc/hosts file is for you own local machine only.
I don't think it involves any of the outside world.
I use it for DNS'ing local ips.
Lets say you have a computer beside you on the LAN.
It's IP is 192.168.1.3
You can put:
192.168.1.3 computerbesideme
...in your hosts file.
then, you can ssh/ftp/ping/telnet computerbesideme
and it will use 192.168.1.3
Ringo..........
|
|
|
01-31-2003, 03:56 PM
|
#3
|
Member
Registered: Nov 2002
Location: Chicago, IL
Distribution: Rasbian, Debian, Gentoo, RHEL
Posts: 65
Rep:
|
The actual hostname of your box should be some kind of name, for example let's assume it is anubis. Then the FQDN would be:
anubis.myspecificdomainname.com
and the hostname would be:
anubis
Your /etc/hosts should have:
69.69.65.65 anubis.myspecificdomainname.com anubis
where the ip address is available on the outside.
www.myspecificdomainname.com should be an alias to
myspecificdomainname.com which should be handled by your specific nameserver.
As for ssh-ing to the box, the only requirement is that you have the ssh port 22 enabled. Then all you need to do is ssh to ANY name that resolves to your address. you can even ssh directly to the ip address if you want to.
|
|
|
01-31-2003, 04:13 PM
|
#4
|
Senior Member
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503
Original Poster
Rep:
|
Okay so here is my situation. I purchased the address www.mydomainname.com from domainmonger.com. I have it configured there to resolve www.mydomainname.com to 68.69.65.65.
Are you saying that I could change my /etc/hosts file to look like this:
68.69.65.65 anubis.mydomainname.com anubis
no 68.69.65.65 localhost right? If I change this nothing will happen to www.mydomainname.com right?
|
|
|
01-31-2003, 05:06 PM
|
#5
|
Member
Registered: Jan 2003
Posts: 195
Rep:
|
You would still want
127.0.0.1 localhost
to be in there.
Simply put, the /etc/hosts file is so YOUR machine will override the DNS settings of the internet. (VERY simply put, and somewhat erroneous, but works in the context of this situation.)
What exactly is it you are trying to accomplish with this?
The DNS server that is managing mydomainname.com will handle all of the resolving for the rest of the world.
|
|
|
01-31-2003, 07:17 PM
|
#6
|
Senior Member
Registered: Nov 2002
Location: British Columbia, Canada
Distribution: Gentoo x86_64; FreeBSD; OS X
Posts: 3,762
Rep:
|
Just to confuse issues more.... I have a FQDN that resolves to a DHCP IP address, using a free service on some DNS...
What do I put in /etc/hosts for my IP?
|
|
|
01-31-2003, 09:05 PM
|
#7
|
LQ Newbie
Registered: Jan 2003
Posts: 15
Rep:
|
if your FQDN is already DNS'd on a DNS server, you don't need to put anything in the /etc/hosts file.
that file is only for DNS'ing things on your local computer only.
It is normally not used.
Ringo....
|
|
|
02-01-2003, 01:04 AM
|
#8
|
Senior Member
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152
Rep:
|
The /etc/hosts file is basically so that your machine doesn't have
to look for a DNS server for the machine names that are in the
hosts file. For example, if I knew that Crashed_Again's IP
address was 68.69.65.65 and I didn't want to do name resolution
every time I connect to that machine, I could put a line in my
/etc/hosts file like so:
68.69.65.65 crash crashed_again twww.crashspecificdomainname.com
Or what ever other alia I wanted for it.
My /etc/hosts file contains all the hostnames from my work so
that when I need to connect to work I can use a short alias for
those machines, and it doesn't have to go through my ISP's slow
DNS server, it just connects to a specific IP address.
The /etc/hosts file is almost completely useless for connecting to
the machine it exists on. . . Use or $HOSTNAME localhost.
|
|
|
All times are GMT -5. The time now is 04:16 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|