LinuxQuestions.org
Visit Jeremy's Blog.
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 03-24-2006, 01:47 AM   #1
Niceman2005
Member
 
Registered: Nov 2004
Distribution: Fedora Core 2
Posts: 330

Rep: Reputation: 30
what should be in the /etc/hosts file if I have dynamic ip?


Dear friends,

In the /etc/hosts file, we usually put the localhost IP with localhost.localdomain, and if we have the IP for the ethernet interface we can state the IP with the domain.

But what if I only have a dynamic ip that changes every network restart or reboot, what should stated in the /etc/hosts file?

if I have fixed IP i can do this in /etc/hosts:
127.0.0.1 localhost.localdomain
192.168.100.100 saturn.cbc.com

if I do not have fixed ip, what can i put as ip in the 2nd line?

please help...thanks for taking time reading my thread, thanks.

regards
yong
 
Old 03-24-2006, 06:45 PM   #2
ARC1450
Member
 
Registered: Jun 2005
Location: Odenton, MD
Distribution: Gentoo
Posts: 290

Rep: Reputation: 30
Don't put anything as the second line. Do something like:

Code:
arcruea@zeus ~ $ cat /etc/hosts
# /etc/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...
#

127.0.0.1       zeus.cruea.net zeus localhost
arcruea@zeus ~ $
 
Old 03-24-2006, 08:19 PM   #3
Niceman2005
Member
 
Registered: Nov 2004
Distribution: Fedora Core 2
Posts: 330

Original Poster
Rep: Reputation: 30
thanks a lot friend!
 
  


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
Dynamic internet sharing among several hosts fillgood Linux - Networking 5 07-04-2006 05:16 AM
Possible to have a dynamic host entry in hosts file? bbarron Linux - Networking 3 06-28-2006 07:01 PM
Apache2 Virtual Dynamic Hosts and defaults techrolla Linux - Networking 1 11-01-2004 04:01 PM
Virtual Hosts with Dynamic IP and dyndns.org lexton Linux - Networking 1 08-11-2004 04:06 AM
does the /etc/hosts file work same as the M$ hosts file? Lleb_KCir Linux - Software 6 04-03-2004 04:33 PM

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

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