Linux - NewbieThis 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
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.
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.
Is there any way to associate a name with a dynamic IP address? I have five machines, each of which are assigned dynamic IP addresses by a router which acts as a DHCP server. When they are all running, I can go around to each of them individually and use ifconfig (or ipconfig for Windows machines) and see what the IP address is for each one. From any machine I can ping any other machine, using that IP address.
However, when I try to ping using a hostname rather than the assigned IP address, it doesn't work. I tried assigning each Linux machine a static IP address (which is not the same as any dynamic IP address that is going to be assigned) but it still doesn't work.
you need to put entries into /etc/hosts for each computer. These names can only be used on the network, not the Internet at large. DHCP can act just like static IP if the lease period is indefinite.
So then how do I make the lease period indefinite? And does this mean that after everything is shut down, and then booted back up, that each machine will get the exact same IP address assigned by the router as it had before?
Originally posted by moonmoth So then how do I make the lease period indefinite? And does this mean that after everything is shut down, and then booted back up, that each machine will get the exact same IP address assigned by the router as it had before?
As long as the router/DHCP server is not rebooted, the machines will have teh exact same IP. You can make the lease time indefinite through your router's configuration.
Usually you should be able to access a router through a web interface to tweak its settings. Perhaps you should read the manual of your router.
And in fact, I have had 5 computers connected to a ADSL modem with a built-in router function. And the lease period is set to 72 hours. But the assigned IP's seem pretty stable to me. They never changed in one year or two as long as I remember.
So you may be OK to get along with it.
Of course it depends on how your router assign IP addresses.
RTFM on the router, eh? :-) Well, I had hoped not to have to get involved with the router. My wife has threatened to do terrible things to me if I screw up her internet access (from Windows XP) with my "fooling around" (her term for it) with Linux. Since the Windows machines seem to hum along happily, sharing files and printers, they must have some mechanism for dealing with the dynamic IP addresses. Surely anything Windows can do, Linxux can do better. Can't it?? :-)
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940
Rep:
a computer may generally request a previousely leased ip address, if it is still avail, the dhcp server most likely will hand it out!
some adsl routers are able to make reservations - this means you assign an ip-address to the requesting mac-address.
when it comes to networks, definitely. ;-)
It's *theoretically* possible to cut the router out of the network entirely and manage the network with just your Linux computer and a hub or switch (I think).
Since it is just your home network. I think maybe you can just leave it as it is now. If problems(change of IP addresses) show up later(which probably won't), what you have to do is just to edit some /etc/hosts files. Right?
Well, the fallback is going to be just that when I turn everything on I go around and get the IP address for each machine and edit the /etc/hosts file. Kind of pain in the rear, but guess it is one way to do it. :-(
Your router should allow you the option of assigning a specific IP address to a specific MAC (Ethernet) address. Then all you have to do is make a list of the MAC addresses on your computers and set your router up to assign them the same IP address every time they request one.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.