LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-21-2010, 08:23 AM   #1
bluegospel
Member
 
Registered: Jan 2010
Distribution: centOS
Posts: 404

Rep: Reputation: 53
/etc/hosts setup--3 questions


Hi.

1) I'm not sure which IP address to use when I list my machine name in /etc/hosts, particularly after reading:


Quote:
By the w]ay, Arnt Gulbrandsen <agulbra@nvg.unit.no> says that 127.0.0.1 # should NEVER be named with the name of the machine. It causes problems # for some (stupid) programs, irc and reputedly talk. :^)
Here's what I have now:


Code:
root@eagleswing:~# hostname
eagleswing
root@eagleswing:~# cat /etc/HOSTNAME
eagleswing.5binc
root@eagleswing:~# cat /etc/hosts
#
# hosts		This file describes a number of hostname-to-address
#		mappings for the TCP/IP subsystem.  It is mostly
#		used at boot time, when no name servers are running.
#		On small systems, this file can be used instead of a
#		"named" name server.  Just add the names, addresses
#		and any aliases to this file...
#
# By the way, Arnt Gulbrandsen <agulbra@nvg.unit.no> says that 127.0.0.1
# should NEVER be named with the name of the machine.  It causes problems
# for some (stupid) programs, irc and reputedly talk. :^)
#

# For loopbacking.
127.0.0.1		localhost


# End of hosts.

root@eagleswing:~#
2) Also, I want to connect my computers at home & I'm not sure how to go about it. I found the following link for my belkin router: http://192.168.2.1/

I'm not certain how to include my router in /etc/hosts so I can use it to link my PCs as stated above. I was thinking of writing (see above link):

192.168.2.1 localbelkin

Will this work & is it proper?

3) Do I need to make use of any other IP addresses at this link? What are the WAN IP & Default Gateway addresses used for? I am going to be serving documents & running scripts on Apache.

Edit: when I run hostname -f I get: "Unknown host".

Last edited by bluegospel; 07-21-2010 at 10:09 AM.
 
Old 07-21-2010, 01:14 PM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
  1. Assuming your machine has a fixed address in the 192.168.2.x range, not dynamic (it does not use DHCP to get its address from a DHCP server such as the router) then a suitable entry for it in /etc/hosts would be (replace 45 with the actual value)
    Code:
    192.168.2.45 eagleswing.5binc eagleswing
  2. "I want to connect my computers at home" ... to the Internet? ... to each other? Assuming to the Internet then they do not need to be able to resolve a name to the router's IP address but they do need to have the router's IP address configured as their default gateway.
    .
  3. The WAN IP is the router's IP address on the Internet.

    The Default Gateway address is the address on the LAN that computers will send IP traffic to when they do not know where else to send it; the assumption is that the default gateway will know. In your scenario the default gateway is your router and it will forward IP traffic for the Internet to your ISP.

    Regards "serving documents & running scripts on Apache", is that to service clients on the Internet or on the LAN?

hostname -f is looking in /etc/hosts for the fully qualified domain name and not finding it. Should work with the suggested hosts entry above.

Last edited by catkin; 07-21-2010 at 01:16 PM. Reason: fur matting
 
  


Reply

Tags
dhcp, hostname, ip



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
Virtual hosts setup mbedzymt Linux - Networking 1 03-30-2010 07:31 AM
Virtual Hosts Setup LazerPhreak Linux - Server 11 01-26-2010 07:00 AM
hosts.allow/deny questions kkjensen Linux - Security 10 03-03-2007 09:12 PM
setup domains in /etc/hosts tommy916 Linux - Networking 1 07-28-2006 05:19 PM
hosts.allow questions paleogryph Linux - Security 3 06-15-2005 11:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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