LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 01-03-2014, 01:22 AM   #1
yogesh_attarde
Member
 
Registered: Jan 2010
Posts: 82

Rep: Reputation: 1
/etc/hosts entry for DHCP IP


Hi All,

I knew the file format for /etc/hosts

The question is what could be the entry for DHCP IP?


Regards,
Yogesh
 
Old 01-03-2014, 02:24 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
there wouldn't be an entry, if the IP isn't fixed, an entry for it makes no sense. If you have a reservation on the DHCP server and the address therefore IS fixed, then the entry is exactly the same as for any other.
 
Old 01-07-2014, 09:28 AM   #3
Mani84
LQ Newbie
 
Registered: Dec 2013
Posts: 11
Blog Entries: 1

Rep: Reputation: Disabled
There wouldn't be any entry. Could you please ellaborate why you want to add dhcp ip in hosts file? Normally dhcp server provides the DNS information to dhcp clients.

Also

Refer http://stackoverflow.com/questions/5...hosts-in-linux

Last edited by Mani84; 01-09-2014 at 09:55 AM.
 
Old 01-12-2014, 06:24 AM   #4
wstewart90
Member
 
Registered: May 2013
Distribution: Arch Linux
Posts: 86

Rep: Reputation: Disabled
Just use 127.0.0.1 to access your local machine or write a script to change the ip in the hosts file as suggested in the article posted by Mani84.
 
Old 01-13-2014, 05:32 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,020

Rep: Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630
To expand. Hosts file is a way to force static IP's to outbound names. DHCP can be used to assign ip addresses to systems both your local ip and networked ip. So if your lan's ip changes because of lease changes you have to follow names by some other method usually. I would consider static arp entries instead. A static arp entry would force the local machine to always connect to some lan mac address at the static ip in the arp table.
 
Old 01-17-2014, 06:17 AM   #6
yogesh_attarde
Member
 
Registered: Jan 2010
Posts: 82

Original Poster
Rep: Reputation: 1
Hi All,

I wanted this entry because we are using flexlm on the machine and if I didn't enter my hostname in hosts file. it gave the error for starting flexlm license server.

Please suggest me the solution for this.


Regards,
Yogesh
 
Old 01-17-2014, 07:22 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
we already have, please read our responses.
 
Old 01-17-2014, 09:59 AM   #8
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
You can put a dhcp machine in /etc/hosts like normal, but you'll have to change the entry every time the IP changes.
 
Old 01-20-2014, 02:49 AM   #9
yogesh_attarde
Member
 
Registered: Jan 2010
Posts: 82

Original Poster
Rep: Reputation: 1
Thanks all for your replies. The solution for this is I bind the IP address in the DHCP and made static entry in /etc/hosts file.
 
Old 01-20-2014, 10:17 AM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
which is what I said originally.
 
  


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
entry in /etc/hosts zafar466 Programming 1 06-09-2008 02:51 PM
Hosts file entry with DHCP hutyerah Slackware 7 02-04-2006 04:13 AM
/etc/hosts entry? batard Linux - Newbie 5 03-25-2005 01:22 PM
hosts MX entry twistedpair Linux - Networking 1 01-10-2004 03:01 AM
hosts entry for a lan unit with no dns entry linxtc Linux - Networking 1 10-03-2003 08:05 AM

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

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