Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

DHCP fails with Win2k

I'm using ecos with a Nios II dev board based on a Cyclone II. I am using v5.1 of Quartus and Nios with service pack 2, and I downloaded ecos very recently so I tihnk I have the latest versions of everything.

Everything works well if I assign a static IP address, but I cannot get the DHCP client to work with my Win2K server. Looking at the diagnostic log and using a packet sniffer it seems that the process goes very well at first: the server sends a response to the discovery message which contains a valid IP address. The problem seems to be that the server does not acknowledge the next request from ecos, and the dhcp client then starts over.

I have spent several hours today reading this forum and the ecos websites and I have found a few threads of conversation on the same topic, but none of the conversations seemed to end with a solution. Does anyone know how to solve this problem?

Here is a copy of the diagnostic information logged on the console:

---------DHCPSTATE_INIT sending:

BOOTP[eth0] op: REQUEST

htype: Ethernet

hlen: 6

hops: 0

xid: 0xcdcd634a

secs: 3

flags: 0x80

hw_addr: 00:07:ed:0f:63:4a

client IP: 0.0.0.0

my IP: 0.0.0.0

server IP: 0.0.0.0

gateway IP: 0.0.0.0

options:

DHCP message: 1 DISCOVER

DHCP option: 37/55.9: 54 51 58 59 1 3 6 15 28

host name: Talisker

DHCP option: 3d/61.7: 1 0 7 237 15 99 74

DHCP option: 39/57.2: 576

---------DHCPSTATE_INIT sending:

BOOTP[eth0] op: REQUEST

htype: Ethernet

hlen: 6

hops: 0

xid: 0xcdcd634a

secs: 3

flags: 0x80

hw_addr: 00:07:ed:0f:63:4a

client IP: 0.0.0.0

my IP: 0.0.0.0

server IP: 0.0.0.0

gateway IP: 0.0.0.0

options:

DHCP message: 1 DISCOVER

DHCP option: 37/55.9: 54 51 58 59 1 3 6 15 28

host name: Talisker

DHCP option: 3d/61.7: 1 0 7 237 15 99 74

DHCP option: 39/57.2: 576

---------DHCPSTATE_INIT sending:

BOOTP[eth0] op: REQUEST

htype: Ethernet

hlen: 6

hops: 0

xid: 0xcdcd634a

secs: 4

flags: 0x80

hw_addr: 00:07:ed:0f:63:4a

client IP: 0.0.0.0

my IP: 0.0.0.0

server IP: 0.0.0.0

gateway IP: 0.0.0.0

options:

DHCP message: 1 DISCOVER

DHCP option: 37/55.9: 54 51 58 59 1 3 6 15 28

host name: Talisker

DHCP option: 3d/61.7: 1 0 7 237 15 99 74

DHCP option: 39/57.2: 576

---------DHCPSTATE_INIT sending:

BOOTP[eth0] op: REQUEST

htype: Ethernet

hlen: 6

hops: 0

xid: 0xcdcd634a

secs: 4

flags: 0x80

hw_addr: 00:07:ed:0f:63:4a

client IP: 0.0.0.0

my IP: 0.0.0.0

server IP: 0.0.0.0

gateway IP: 0.0.0.0

options:

DHCP message: 1 DISCOVER

DHCP option: 37/55.9: 54 51 58 59 1 3 6 15 28

host name: Talisker

DHCP option: 3d/61.7: 1 0 7 237 15 99 74

DHCP option: 39/57.2: 576

---------DHCPSTATE_INIT sending:

BOOTP[eth0] op: REQUEST

htype: Ethernet

hlen: 6

hops: 0

xid: 0xcdcd634a

secs: 4

flags: 0x80

hw_addr: 00:07:ed:0f:63:4a

client IP: 0.0.0.0

my IP: 0.0.0.0

server IP: 0.0.0.0

gateway IP: 0.0.0.0

options:

DHCP message: 1 DISCOVER

DHCP option: 37/55.9: 54 51 58 59 1 3 6 15 28

host name: Talisker

DHCP option: 3d/61.7: 1 0 7 237 15 99 74

DHCP option: 39/57.2: 576

---------DHCPSTATE_INIT sending:

BOOTP[eth0] op: REQUEST

htype: Ethernet

hlen: 6

hops: 0

xid: 0xcdcd634a

secs: 4

flags: 0x80

hw_addr: 00:07:ed:0f:63:4a

client IP: 0.0.0.0

my IP: 0.0.0.0

server IP: 0.0.0.0

gateway IP: 0.0.0.0

options:

DHCP message: 1 DISCOVER

DHCP option: 37/55.9: 54 51 58 59 1 3 6 15 28

host name: Talisker

DHCP option: 3d/61.7: 1 0 7 237 15 99 74

DHCP option: 39/57.2: 576

---------DHCPSTATE_INIT sending:

BOOTP[eth0] op: REQUEST

htype: Ethernet

hlen: 6

hops: 0

xid: 0xcdcd634a

secs: 9

flags: 0x80

hw_addr: 00:07:ed:0f:63:4a

client IP: 0.0.0.0

my IP: 0.0.0.0

server IP: 0.0.0.0

gateway IP: 0.0.0.0

options:

DHCP message: 1 DISCOVER

DHCP option: 37/55.9: 54 51 58 59 1 3 6 15 28

host name: Talisker

DHCP option: 3d/61.7: 1 0 7 237 15 99 74

DHCP option: 39/57.2: 576

---------DHCPSTATE_SELECTING received:

...rx_addr is family 2, addr 64cca8c0, port 17152

BOOTP[eth0] op: REPLY

htype: Ethernet

hlen: 6

hops: 0

xid: 0xcdcd634a

secs: 0

flags: 0x0

hw_addr: 00:07:ed:0f:63:4a

client IP: 0.0.0.0

my IP: 192.168.205.50

server IP: 192.168.204.100

gateway IP: 0.0.0.0

options:

DHCP message: 2 OFFER

subnet mask: 255.255.252.0

DHCP time 58: 345600

DHCP time 59: 604800

DHCP time 51: 691200

DHCP server id: 192.168.204.100

gateway: 192.168.204.250, 192.168.204.248

domain server: 192.168.204.100, 192.168.204.101

domain name: eu.coherentinc.com

---------DHCPSTATE_REQUESTING sending:

BOOTP[eth0] op: REQUEST

htype: Ethernet

hlen: 6

hops: 0

xid: 0xcdce634a

secs: 0

flags: 0x80

hw_addr: 00:07:ed:0f:63:4a

client IP: 0.0.0.0

my IP: 192.168.205.50

server IP: 192.168.204.100

gateway IP: 0.0.0.0

options:

DHCP message: 3 REQUEST

subnet mask: 255.255.252.0

DHCP time 58: 345600

DHCP time 59: 604800

DHCP time 51: 691200

DHCP server id: 192.168.204.100

gateway: 192.168.204.250, 192.168.204.248

domain server: 192.168.204.100, 192.168.204.101

domain name: eu.coherentinc.com

DHCP option: 37/55.9: 54 51 58 59 1 3 6 15 28

host name: Talisker

DHCP option: 3d/61.7: 1 0 7 237 15 99 74

DHCP option: 39/57.2: 576

DHCP requested ip: 192.168.205.50

---------DHCPSTATE_REQUESTING sending:

BOOTP[eth0] op: REQUEST

htype: Ethernet

hlen: 6

hops: 0

xid: 0xcdce634a

secs: 0

flags: 0x80

hw_addr: 00:07:ed:0f:63:4a

client IP: 0.0.0.0

my IP: 192.168.205.50

server IP: 192.168.204.100

gateway IP: 0.0.0.0

options:

DHCP message: 3 REQUEST

subnet mask: 255.255.252.0

DHCP time 58: 345600

DHCP time 59: 604800

DHCP time 51: 691200

DHCP server id: 192.168.204.100

gateway: 192.168.204.250, 192.168.204.248

domain server: 192.168.204.100, 192.168.204.101

domain name: eu.coherentinc.com

DHCP option: 37/55.9: 54 51 58 59 1 3 6 15 28

host name: Talisker

DHCP option: 3d/61.7: 1 0 7 237 15 99 74

DHCP option: 39/57.2: 576

DHCP requested ip: 192.168.205.50

Thanks,

Mike

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    To check that this is a Win2k related problem I have brought my Nios dev board home and tried it with the DHCP server built into my cable modem & router at home. It worked first time (As I suspected it would!).

    My next move is going to be to try and modify the ecos DHCP client code to make it use the IP address it received from the server even if the server doesn't follow up with an ACK in reply. I'm not too happy about doing that but I can't think of another solution right now.

    Mike
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I just built a poject using MicroC/OS-II and the lw-IP stack and it runs perfectly on my board: the DHCP sequence goes through DISCOVER, OFFER, REQUEST, ACK.

    When I use ecos on the same board the DHCP server does not send the ACK packet.

    I haved used Ethereal to capture the packets when ecos and lw-IP attempt a DHCP transaction on the same Nios II dev board and I hope to figure out what is different.

    Mike
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I was able to fix this problem by changing the code in dhcp_prot.c which sends the request packet. The existing code builds the request packet by copying the offer packer from the server and then changing a couple of fields. By examing how lw-ip and Windows XP systems drive a DHCP transaction I thought that it would be better to create the request packet from scratch in a manner very similar to the discover packet. This worked well and DHCP is now working perfectly for me. I now know more about DHCP than I wanted to know when I started this exercise. If anyone wants more details of my solution then please email me (Or post to this topic).

    Mike
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Mike,

    > I now know more about DHCP than I wanted to know when I started this exercise.

    We will now expect you to provide your expert advice in all matters DHCP! ;-)

    > If anyone wants more details of my solution then please email me (Or post to this topic).

    How would you classify this issue? a bug, an API short-coming, configuration problem, etc?

    What was causing the server to withhold the ACK?

    Regards,

    --Scott