Jump to content


implementing a DHCP client


7 replies to this topic

#1 hunguptodry

    New Member

  • Members
  • PipPip
  • 31 posts

Posted 08 May 2006 - 11:19 AM

I'm trying to make an embedded device an obedient network citizen by making it talk DHCP. Hopefully there is an IP guru here who can help. Here is what i have done and where i'm stuck at ...

1) My device uses a chip called wiznet to do this network thing. I have managed to get it to send and receive UDP packets without problems.
2) I use ethereal to check and everything seems in order.
3) After reading some RFCs i figure i need to send out a DHCP Discover packet to get things started.
4) Since I'm not very sure of what this packet would look like. i whip up ethereal to see what happens when i do an ipconfig /renew on my PC.
5) Indeed a DHCP Discover packet is sent out. The DHCP server also responds with DHCP Offer as outlined in the RFCs.
6) So i duplicate this Discover packet (changing only the MAC address) on my embedded device and send it out.
7) I watch this packet come out on ethereal. it looks correct.
8) but there is no response from the server.
9) what am I doing wrong?

thanks

#2 .oisyn

    DevMaster Staff

  • Moderators
  • 1822 posts

Posted 08 May 2006 - 11:25 AM

What network infrastructure are you using, and how are you monitoring the packets?

If you monitor the packets on the PC and you are using a switching hub, you're not going to see the response as it is directed at your embedded device, not your PC. So you should either use a non-switching hub or make the PC route the packets between the DHCP server and your device.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#3 hunguptodry

    New Member

  • Members
  • PipPip
  • 31 posts

Posted 08 May 2006 - 11:31 AM

1) I'm using Ethereal (great piece of sw and free too) to monitor the packets.
2) my test network is straight-forward. a single subnet with non-switching hub.
3) the only switch on the net is and ADSL router which is also my DHCP server.
4) if anyone wants to look at the packets i can put them up here too.
5) just hoping that it is something stupid that i forgot to do.

thanks again.

#4 Borogove

    New Member

  • Members
  • PipPip
  • 16 posts

Posted 18 May 2006 - 05:11 AM

According to http://support.micro...om/?kbid=169289, the client's MAC address appears two places in the discover packet: in the CHADDR field and in the DCHP Client Identifier field. Are you setting both?

#5 hunguptodry

    New Member

  • Members
  • PipPip
  • 31 posts

Posted 18 May 2006 - 09:53 AM

just an update. it seems the problem is with this particular ADSL router which is serving as my DHCP server (Aztech ADSL Wireless G Router).

i downloaded another DHCP server (tftpd32) from the net and ran it on my PC and everything worked beautifully.

the weird thing is, though the server refuses to respond to the DHCP DISCOVER packets from my embedded device it responds to those sent by a windows PC that boots or does "ipconfig /renew".

as i mentioned before the DISCOVER packets are identical except for the MAC address when seen from Ethereal.

Borogove: yes i am setting the client address option.

#6 baldurk

    Senior Member

  • Members
  • PipPipPipPip
  • 1057 posts

Posted 18 May 2006 - 11:26 AM

Is there possibly a MAC address limiter on your router, to prevent just any device/PC from connecting to the network?
baldurk
He who knows not and knows that he knows not is ignorant. Teach him.
He who knows not and knows not that he knows not is a fool. Shun him.

#7 hunguptodry

    New Member

  • Members
  • PipPip
  • 31 posts

Posted 22 May 2006 - 08:29 AM

Is there possibly a MAC address limiter on your router, to prevent just any device/PC from connecting to the network?

yes, this seems to be the problem. the WIZ chip i use allows u to set the MAC address to anything i like. it seems i'm using something illegal or unregistered.
when i used the MAC address of another PC (not on same network) everything worked.

so how do u get hold of unused MAC addresses?

#8 geon

    Senior Member

  • Members
  • PipPipPipPip
  • 893 posts

Posted 22 May 2006 - 07:17 PM

hunguptodry said:

so how do u get hold of unused MAC addresses?

http://standards.iee.../pilot-ind.html

$550.00(US) for a 4096 block.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users