Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to get same IP from DHCP every time?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
jsridhar
n00b
n00b


Joined: 13 Jan 2004
Posts: 9

PostPosted: Wed Apr 27, 2005 2:35 am    Post subject: How to get same IP from DHCP every time? Reply with quote

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
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20630

PostPosted: Wed Apr 27, 2005 2:37 am    Post subject: Reply with quote

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
View user's profile Send private message
Base
n00b
n00b


Joined: 22 Apr 2005
Posts: 17

PostPosted: Wed Apr 27, 2005 2:59 am    Post subject: Reply with quote

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
View user's profile Send private message
FloppyMaster0
n00b
n00b


Joined: 07 May 2004
Posts: 62
Location: Detroit, MI, USA

PostPosted: Wed Apr 27, 2005 3:12 am    Post subject: Reply with quote

Your Dlink router should have a configuration page that looks like this one. You'll want to look at the Static DHCP section.

http://support.dlink.com/emulators/di624_revc/h_dhcp.html
Back to top
View user's profile Send private message
Avernus-
n00b
n00b


Joined: 04 Feb 2004
Posts: 15

PostPosted: Wed Apr 27, 2005 3:17 am    Post subject: Well... Reply with quote

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
View user's profile Send private message
jsridhar
n00b
n00b


Joined: 13 Jan 2004
Posts: 9

PostPosted: Wed Apr 27, 2005 3:34 am    Post subject: Reply with quote

FloppyMaster0 wrote:
Your Dlink router should have a configuration page that looks like this one. You'll want to look at the Static DHCP section.

http://support.dlink.com/emulators/di624_revc/h_dhcp.html


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
View user's profile Send private message
jsridhar
n00b
n00b


Joined: 13 Jan 2004
Posts: 9

PostPosted: Wed Apr 27, 2005 3:35 am    Post subject: Re: Well... Reply with quote

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
View user's profile Send private message
davecorder
n00b
n00b


Joined: 03 Sep 2004
Posts: 10

PostPosted: Fri Apr 29, 2005 7:02 pm    Post subject: Re: Well... Reply with quote

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
View user's profile Send private message
jsridhar
n00b
n00b


Joined: 13 Jan 2004
Posts: 9

PostPosted: Sat Apr 30, 2005 1:44 am    Post subject: Re: Well... Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum