Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
dhcp getting wrong adress from server/uses cache?
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
ingemar
Tux's lil' helper
Tux's lil' helper


Joined: 21 May 2005
Posts: 83
Location: Gothenburg, Sweden

PostPosted: Wed Nov 14, 2007 7:53 pm    Post subject: dhcp getting wrong adress from server/uses cache? Reply with quote

Hi!

I'm using Linksys router with DD-WRT firmware, but there's some sort of problem, and I think its my machine that's causing it. I have set up static leases for my computer, so that port forwarding and such can work easily, but I never seem to get the right ip adress! In the web interface for dd-wrt I can see all the active leases, and when they are bound to end, and my static is there, next to the new one, except for it having the wrong ip adress.

I've tried removing the faulty lease from the dd-wrt interface, and running dhclient (after removing some files from /var/lib/dhcp/), and that results in giving me the correct ip adress, but when using the standard way in gentoo (/etc/init.d/net.eth0 blah) which uses dhcpcd, it doesn't work. I keep getting the same ip, but it's not the desired one.. Could it be that dhcpcd uses some kind of cache it uses if it once have worked? I know dhclient has this feature.. Is there some file I can delete so that dhcpcd gets the correct adress?
_________________
iBook G4 12" & AMD X2 4200+
Back to top
View user's profile Send private message
darkphader
Veteran
Veteran


Joined: 09 May 2002
Posts: 1225
Location: Motown

PostPosted: Wed Nov 14, 2007 8:46 pm    Post subject: Reply with quote

I think the dhcp client asks for the ip address it had previously but if you have a lease tied to a mac address the server should nak the old address and present the new one. Suggest a remerge of the latest dhcp client and a double-check of the mac address for the reservation in your dhcp server settings.

Chris
_________________
WYSIWYG - What You See Is What You Grep
Back to top
View user's profile Send private message
ingemar
Tux's lil' helper
Tux's lil' helper


Joined: 21 May 2005
Posts: 83
Location: Gothenburg, Sweden

PostPosted: Wed Nov 14, 2007 9:00 pm    Post subject: Reply with quote

The mac address specified in the router interface is of course correct. It exists two leases in the router with the exact same mac adress, one which is the one I want it to be, and the other, which isn't. And a reemerge doesn't help here..
_________________
iBook G4 12" & AMD X2 4200+
Back to top
View user's profile Send private message
cyrillic
Watchman
Watchman


Joined: 19 Feb 2003
Posts: 7313
Location: Groton, Massachusetts USA

PostPosted: Wed Nov 14, 2007 9:07 pm    Post subject: Reply with quote

If dhclient works better than dhcpcd for you, then just put this in /etc/conf.d/net
Code:
modules=( "dhclient" )
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Nov 14, 2007 11:44 pm    Post subject: Reply with quote

dhcpcd-3.1 uses a DUID in the client ID instead of the MAC address.
This is RFC compliant as the Client ID could technically hold anything.

To change to a MAC address, use dhcpcd_eth0="-I ''" or emerge dhcpcd with the vram flag.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
MickKi
Veteran
Veteran


Joined: 08 Feb 2004
Posts: 1177

PostPosted: Sat Nov 17, 2007 6:00 pm    Post subject: Reply with quote

UberLord wrote:
dhcpcd-3.1 uses a DUID in the client ID instead of the MAC address.
This is RFC compliant as the Client ID could technically hold anything.

To change to a MAC address, use dhcpcd_eth0="-I ''" or emerge dhcpcd with the vram flag.
Thanks, the vram flag solved my problem (different router, but it would not see the MAC address no matter what I passed on to it via dhcpcd and /etc/conf.d/net.eth0). What does vram do? What is it there for?
_________________
Regards,
Mick
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Mon Nov 19, 2007 7:13 am    Post subject: Reply with quote

vram = volatile ram.
Or in more simple terms, storage is nor permament.

This means we cannot store the DUID and use that in a client node identifier as it would change all the time.
Instead we revert to using the MAC address
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
darkphader
Veteran
Veteran


Joined: 09 May 2002
Posts: 1225
Location: Motown

PostPosted: Mon Nov 19, 2007 6:04 pm    Post subject: Reply with quote

UberLord wrote:
dhcpcd-3.1 uses a DUID in the client ID instead of the MAC address.

Is this what appears in the uid field when examaming the dhcpd.leases file?
Code:
lease 192.168.1.183 {
  starts 1 2007/11/19 17:49:54;
  ends 1 2007/11/19 19:49:54;
  binding state active;
  next binding state free;
  hardware ethernet 00:a0:d1:2c:19:1b;
  uid "\001\000\240\321,\031\033";

So that in the above case "\001\000\240\321,\031\033" would be the DUID you speak of?

Thanks.

Chris
_________________
WYSIWYG - What You See Is What You Grep
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Mon Nov 19, 2007 9:14 pm    Post subject: Reply with quote

Right field, but wrong value - your's looke like a standard MAC address.
Here's how one looks with a Client Node Identifer (IAID + DUID)

Code:
uid "\377bge0\000\001\000\001\015\325\4444\000\0261!\372y";


As you can see, it's a little bit longer.
I've changed a few of my values to obscure it a little.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
darkphader
Veteran
Veteran


Joined: 09 May 2002
Posts: 1225
Location: Motown

PostPosted: Mon Nov 19, 2007 9:35 pm    Post subject: Reply with quote

It's just the value that is there. I didn't make it up :)

Just wondered if I can use that value as the data in the 'option dhcp-client-identifier' parameter for dhcpd instead of the MAC address as the data to 'hardware ethernet'.

As in:
Code:
host myhostname {
  option dhcp-client-identifier "\001\000\035\0150\226\371";
  fixed-address myhostname.mydomain;
  }

Intead of:
Code:
host myhostname {
  hardware ethernet 20:17:e9:01:67:5b;
  fixed-address myhostname.mydomain;
  }


It does appear to work just fine.

Thanks.

Chris
_________________
WYSIWYG - What You See Is What You Grep
Back to top
View user's profile Send private message
trailnut
n00b
n00b


Joined: 16 Nov 2007
Posts: 21

PostPosted: Mon Nov 19, 2007 10:19 pm    Post subject: Reply with quote

I don't have one of those DD-WRT routers so I'll just throw this out here, if it doesn't apply sorry for the noise. I once had a router that allowed me to specify a static address that was inside my dynamic address range. This of course didn't work out very well and it silently ignored my static setting until I corrected it and moved it outside the range.
Back to top
View user's profile Send private message
darkphader
Veteran
Veteran


Joined: 09 May 2002
Posts: 1225
Location: Motown

PostPosted: Tue Nov 20, 2007 1:28 am    Post subject: Reply with quote

I'm getting timeouts from dhcpd:
Code:
  * Stopping eth0
 *   Bringing down eth0
 *     Stopping dhcpcd on eth0 ...                                                             
 *     Shutting down eth0 ...                                                                 
 * Starting eth0
 *   Bringing up eth0
 *     dhcp
 *       Running dhcpcd ...
Error, eth0: timed out                                                                         
 *       eth0 received address 169.254.228.177/16

Yet in a about 40 more seconds ifconfig will finally show the dhcp assigned address:
Code:
ifconfig
eth0      Link encap:Ethernet  HWaddr 00:16:76:AA:BF:70
          inet addr:192.168.107.6  Bcast:192.168.107.255  Mask:255.255.255.0
          inet6 addr: fe80::216:76ff:feaa:bf70/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:78269 errors:0 dropped:0 overruns:0 frame:0
          TX packets:99231 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:37954624 (36.1 Mb)  TX bytes:105903847 (100.9 Mb)
          Base address:0x1000 Memory:e5000000-e5020000

I notice the same problem with my Sony PS3 - takes a long time to get an IP address. The server is a Gentoo box running net-misc/dhcp-3.1.0. Any clues on troubleshooting this?
_________________
WYSIWYG - What You See Is What You Grep
Back to top
View user's profile Send private message
MickKi
Veteran
Veteran


Joined: 08 Feb 2004
Posts: 1177

PostPosted: Tue Nov 20, 2007 7:04 am    Post subject: Reply with quote

Is this new DUID thingy an IPv6 feature? Googling for it shows it referenced within an IPv6 context and I do not have IPv6 enabled in my kernel.
_________________
Regards,
Mick
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Tue Nov 20, 2007 9:39 am    Post subject: Reply with quote

darkphader wrote:
I'm getting timeouts from dhcpd:
Yet in a about 40 more seconds ifconfig will finally show the dhcp assigned address
I notice the same problem with my Sony PS3 - takes a long time to get an IP address. The server is a Gentoo box running net-misc/dhcp-3.1.0. Any clues on troubleshooting this?


Interesting. That shows a problem probably with the dhcp server as I doubt the PS3 uses dhcpcd.
Maybe postup your config (but not here directly lol) somewhere or try other dhcp versions in portage?
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Tue Nov 20, 2007 9:41 am    Post subject: Reply with quote

MickKi wrote:
Is this new DUID thingy an IPv6 feature? Googling for it shows it referenced within an IPv6 context and I do not have IPv6 enabled in my kernel.


It's required for IPv6.
It's required for IPv4 over infiniband which dhcpcd-3.1 supports, hence it's enabled by default.
Aside from that it's optional.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
darkphader
Veteran
Veteran


Joined: 09 May 2002
Posts: 1225
Location: Motown

PostPosted: Tue Nov 20, 2007 3:03 pm    Post subject: Reply with quote

UberLord wrote:
Interesting. That shows a problem probably with the dhcp server as I doubt the PS3 uses dhcpcd.

Turned out to be more nebulous than that. Stupid Dell switch defaults to STP and no portfast, wrecks havoc with dhcp. Arrrr...

Thanks again.

Chris
_________________
WYSIWYG - What You See Is What You Grep
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