LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-22-2002, 07:55 PM   #1
robeb
Member
 
Registered: May 2002
Posts: 113

Rep: Reputation: 15
/etc/hosts and routers


How can I configure my router in terms of the /etc/hosts file? For example, if my router's name is "mybox" then the /etc/hosts file would read "mybox.mydomain.com". So, if I have 2 IP's then which IP should be assinged mybox? Should both be assinged mybox?

- Thank you
 
Old 05-24-2002, 11:11 PM   #2
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
If the machine has two network cards then it will most likely have two IP addresses. One for the external network and one for the internal.
 
Old 05-25-2002, 12:05 AM   #3
geoffm33
Member
 
Registered: May 2002
Distribution: RH 7.3 - YDL 2.3
Posts: 63

Rep: Reputation: 15
An entry for localhost using a FQDN in the /etc/hosts file is to save your box from making a DNS request to resolve itself. I suppose in the instance your router wanted to do a reverse lookup of itself, it would help to have your public IP address listed in the /etc/hosts file.

This is only if I understood your question correctly!
 
Old 05-25-2002, 03:23 AM   #4
Noerr
Member
 
Registered: May 2002
Location: Dalec, HU
Distribution: Redhat 7.3
Posts: 696

Rep: Reputation: 30
putting ip/name pairs in hosts file makes your box resolve all ip's instantly and it is not necessary to use fqdn ie you can put something like
myweb 1.2.3.4

and then you can simply ping/ssh/ftp.. your webserver by:
ping myweb
It is nice to put all local and known ips into hosts so you see nicely who logged in to your box + easier to access their machines
 
Old 05-25-2002, 10:47 AM   #5
geoffm33
Member
 
Registered: May 2002
Distribution: RH 7.3 - YDL 2.3
Posts: 63

Rep: Reputation: 15
I agree Noerr, I think my answer was misleading.

I think the question was which IP (public or private) should robeb put in his router's /etc/hosts file on his router. I don't think you need an entry for your router on your router in /etc/hosts, other than 127.0.0.1 mybox.mydomain.com

You definitely do not want to put both IP's in /etc/hosts because that file is read top to bottom so the first entry that matches wins.
 
Old 05-25-2002, 03:51 PM   #6
Noerr
Member
 
Registered: May 2002
Location: Dalec, HU
Distribution: Redhat 7.3
Posts: 696

Rep: Reputation: 30
i always put 127.0.0.1 localhost
to serve its purpuse (if any)
 
  


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
External Hosts Resolve but Local Hosts Do Not kjm9 Linux - Networking 7 11-19-2005 04:51 PM
hosts.allow & hosts.deny question... jonc Linux - Security 9 03-05-2005 10:41 PM
Adding shell commands to hosts.deny and hosts.allow ridertech Linux - Security 3 12-29-2003 04:52 PM
hosts.deny and hosts.allow defaults? gui10 Linux - Security 5 12-20-2001 02:57 AM
hosts.allow / hosts.deny fistz Linux - Newbie 1 04-19-2001 08:00 PM

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

All times are GMT -5. The time now is 07:09 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration