View previous topic :: View next topic |
Author |
Message |
jsridhar n00b

Joined: 13 Jan 2004 Posts: 9
|
Posted: Wed Apr 27, 2005 2:35 am Post subject: How to get same IP from DHCP every time? |
|
|
Hi all,
I have a DLink router and am using it to assign IP addresses to hosts on my network. How can I set up things so that I get the same IP address for a particular host every time? I am tired of changing /etc/hosts file every time the DHCP server decides to assign a different IP address.
Thanks in advance |
|
Back to top |
|
 |
pjp Administrator


Joined: 16 Apr 2002 Posts: 20630
|
Posted: Wed Apr 27, 2005 2:37 am Post subject: |
|
|
Why are you using dynamic addressing if you want static addressing? I don't think its possible to permanently set an IP address dynamically, but you may be able to configure the duration of a lease for a long time. |
|
Back to top |
|
 |
Base n00b

Joined: 22 Apr 2005 Posts: 17
|
Posted: Wed Apr 27, 2005 2:59 am Post subject: |
|
|
Setting so that you get the same ip on a certain machine is on most routers/gateways no problem. But it has to be set on the dhcp server.
You reserve an ip adress for the mac adress of your networkcard.
How you configure this depends on what u use as dhcp server.
It can be good to do this for many scenarios, for example if certain info changes like dns servers or something else you only need to set it on the dhcp server. |
|
Back to top |
|
 |
FloppyMaster0 n00b

Joined: 07 May 2004 Posts: 62 Location: Detroit, MI, USA
|
|
Back to top |
|
 |
Avernus- n00b

Joined: 04 Feb 2004 Posts: 15
|
Posted: Wed Apr 27, 2005 3:17 am Post subject: Well... |
|
|
Correct Way:
Assign a DHCP reservation for the client you wish to get the same IP every time. You will need to know the MAC Address of the client to do this IF the DLink router supports this functionality.
If DLink Router does not support this:
WorkAround #1:
Set a static IP on the client. Will work great for a desktop, a real pain for laptops.
WorkAround #2 (really a hack at best):
Up the DHCP Expiration Timeout on the router to some very high value. This way if your client is gone/powered off for a while when it returns it will still get the same IP. However, if the router itself gets rebooted the timeout period is reset. |
|
Back to top |
|
 |
jsridhar n00b

Joined: 13 Jan 2004 Posts: 9
|
Posted: Wed Apr 27, 2005 3:34 am Post subject: |
|
|
Would have worked for me if this option existed in my router. Unfortunately my router is DI-614+ and it does not have that option. Thanks anyway. |
|
Back to top |
|
 |
jsridhar n00b

Joined: 13 Jan 2004 Posts: 9
|
Posted: Wed Apr 27, 2005 3:35 am Post subject: Re: Well... |
|
|
Avernus- wrote: | Correct Way:
Assign a DHCP reservation for the client you wish to get the same IP every time. You will need to know the MAC Address of the client to do this IF the DLink router supports this functionality.
If DLink Router does not support this:
WorkAround #1:
Set a static IP on the client. Will work great for a desktop, a real pain for laptops.
WorkAround #2 (really a hack at best):
Up the DHCP Expiration Timeout on the router to some very high value. This way if your client is gone/powered off for a while when it returns it will still get the same IP. However, if the router itself gets rebooted the timeout period is reset. |
I think I will try setting static IP address and see how everything works. Thanks everyone for the (fast!) replies. |
|
Back to top |
|
 |
davecorder n00b

Joined: 03 Sep 2004 Posts: 10
|
Posted: Fri Apr 29, 2005 7:02 pm Post subject: Re: Well... |
|
|
jsridhar wrote: | Avernus- wrote: | Correct Way:
Assign a DHCP reservation for the client you wish to get the same IP every time. You will need to know the MAC Address of the client to do this IF the DLink router supports this functionality.
If DLink Router does not support this:
WorkAround #1:
Set a static IP on the client. Will work great for a desktop, a real pain for laptops.
WorkAround #2 (really a hack at best):
Up the DHCP Expiration Timeout on the router to some very high value. This way if your client is gone/powered off for a while when it returns it will still get the same IP. However, if the router itself gets rebooted the timeout period is reset. |
I think I will try setting static IP address and see how everything works. Thanks everyone for the (fast!) replies. |
If you're going to leave the DHCP server enabled on your router, be sure to choose IP addresses outside of it's DHCP lease range when you assign static IPs to your network devices.
For me, I tend to use x.x.x.1-x.x.x.10 for routers, wireless access points, and other core network devices, x.x.x.11-x.x.x.50 for any fixed IP addresses (whether they are manually assigned, or have a static entry in the LAN DHCP server's config file), and then I set the DHCP range to x.x.x.100-x.x.x199. YMMV, of course, but this seems to work well for me.
There have been a couple cases where I have a network device with no DHCP client (e.g., a wireless router that I want to have function as a dumb access point on the LAN interface), so I just manually configure it with an IP address outside my DHCP server's lease range and all is well (that way, I don't have to worry about the DHCP server accidentially giving the IP address to another machine on the network and screwing up ARP tables and the like).
-Dave |
|
Back to top |
|
 |
jsridhar n00b

Joined: 13 Jan 2004 Posts: 9
|
Posted: Sat Apr 30, 2005 1:44 am Post subject: Re: Well... |
|
|
davecorder wrote: | jsridhar wrote: | Avernus- wrote: | Correct Way:
Assign a DHCP reservation for the client you wish to get the same IP every time. You will need to know the MAC Address of the client to do this IF the DLink router supports this functionality.
If DLink Router does not support this:
WorkAround #1:
Set a static IP on the client. Will work great for a desktop, a real pain for laptops.
WorkAround #2 (really a hack at best):
Up the DHCP Expiration Timeout on the router to some very high value. This way if your client is gone/powered off for a while when it returns it will still get the same IP. However, if the router itself gets rebooted the timeout period is reset. |
I think I will try setting static IP address and see how everything works. Thanks everyone for the (fast!) replies. |
If you're going to leave the DHCP server enabled on your router, be sure to choose IP addresses outside of it's DHCP lease range when you assign static IPs to your network devices.
For me, I tend to use x.x.x.1-x.x.x.10 for routers, wireless access points, and other core network devices, x.x.x.11-x.x.x.50 for any fixed IP addresses (whether they are manually assigned, or have a static entry in the LAN DHCP server's config file), and then I set the DHCP range to x.x.x.100-x.x.x199. YMMV, of course, but this seems to work well for me.
There have been a couple cases where I have a network device with no DHCP client (e.g., a wireless router that I want to have function as a dumb access point on the LAN interface), so I just manually configure it with an IP address outside my DHCP server's lease range and all is well (that way, I don't have to worry about the DHCP server accidentially giving the IP address to another machine on the network and screwing up ARP tables and the like).
-Dave |
That's a good suggestion. I have a similar situation. |
|
Back to top |
|
 |
|