Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
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-03-2014, 01:22 AM
|
#1
|
Member
Registered: Jan 2010
Posts: 82
Rep:
|
/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
|
|
|
01-03-2014, 02:24 AM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
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.
|
|
|
01-07-2014, 09:28 AM
|
#3
|
LQ Newbie
Registered: Dec 2013
Posts: 11
Rep: 
|
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.
|
|
|
01-12-2014, 06:24 AM
|
#4
|
Member
Registered: May 2013
Distribution: Arch Linux
Posts: 86
Rep: 
|
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.
|
|
|
01-13-2014, 05:32 PM
|
#5
|
Moderator
Registered: Mar 2008
Posts: 22,361
|
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.
|
|
|
01-17-2014, 06:17 AM
|
#6
|
Member
Registered: Jan 2010
Posts: 82
Original Poster
Rep:
|
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
|
|
|
01-17-2014, 07:22 AM
|
#7
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
we already have, please read our responses.
|
|
|
01-17-2014, 09:59 AM
|
#8
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
You can put a dhcp machine in /etc/hosts like normal, but you'll have to change the entry every time the IP changes.
|
|
|
01-20-2014, 02:49 AM
|
#9
|
Member
Registered: Jan 2010
Posts: 82
Original Poster
Rep:
|
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.
|
|
|
01-20-2014, 10:17 AM
|
#10
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
which is what I said originally.
|
|
|
All times are GMT -5. The time now is 10:08 AM.
|
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
|
|