DHCP server speed and network ID

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DHCP server speed and network ID

1,342 Views
seandema
Contributor IV

I'm using MQX 4.0.2 on a Kinetis K60 with the DHCP server running so I can connect a PC directly via Ethernet and then access web pages hosted by the MQX web server. This all works but when I connect my Ethernet cable to my windows 7 PC it seems to take a while (30 or more seconds) to get an IP address and get to the point where I can put in the IP assigned to the K60 Ethernet port and load the web pages. It does not take nearly as long (2 or 3 seconds) to do this when I connect to a router or any other networking equipment. Is there anything I can do on the MQX side to speed up this process?

Also is there a way to get a network name to appear? Usually when I connect to a network I'll at least get a name like "Network 1". When connected to the ethernet port on the K60 my PC just says "Unidentified network" even after and IP is assigned.No Net Name.JPG.jpg

Thanks,

Sean

Labels (1)
Tags (3)
5 Replies

803 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Sean,

It is because the board is waitings for an IP to be assigned. As the PC does not assign an IP, after the timeout it uses static IP. You can either use static binding instead DHCP or use function RTCS_if_bind_DHCP_timed() in which you can set the timeout. You can find this function in chapter 7.1.126 of RTCS users guide.

Regards,

Carlos

0 Kudos

803 Views
seandema
Contributor IV

Hi Carlos,

     Thanks for getting back to me.

I looked at RTCS_if_bind_DHCP_timed() but it appears that is for allowing the K60 to acquire and IP from an external DHCP server. I think I need the K60 to assign an IP to my PC. Allow me to explain my scenario a bit.

The desire is for a user to walk up to my K60 powered device, plug in their laptop to the Ethernet port, and be able to access a web page hosted by the K60 at a known IP address (say 192.168.0.1). The user can then configure my device using a web interface. To accomplish this I think I need the K60 to assign an IP address to my PC when I connect my PC to the K60.


To do this I have been assigning a static IP to the Ethernet interface on the K60 (say 192.168.0.1), and starting the DHCP server with settings to assign IPs in the 192.168.0.100-192.168.0.199 range. I'm also starting the web server. I can then connect my PC to the K60 and eventually get an IP like 192.168.0.100 but it seems to take a while. Once that's done I can ping the K60 and access the web pages by putting K60s IP (192.168.0.1) in my web browser.

The main issue is that it is slow getting to the point where my PC has been assigned an IP and can access the MQX hosted web pages. It eventually does what I want but I would like to speed up that process if possible. Perhaps I have something wrong in my setup that is causing this issue. I'm also wondering if windows is trying to do a bunch of network discovery stuff so it can assign a name and whatever else it's looking for. A router seems to handle this much faster than I can get MQX to.

Hope that clears things up.


Thanks,

Sean

0 Kudos

803 Views
CaesarI
Contributor III

Hi Sean, hi Dears,

do you or somebody else have a solution to avoid the Windows network status 'unidentified network'?

@Sean: Our DHCP-Server needs 10 seconds in maximum to give a IP address to a Windows computer. We use MQX 3.8 and 4.0. I think this lapse is ok. Perhaps it is your huge range of 100 addresses ore an unsuitable lease time that longs the process. We only have 3 adresses with lease time of 300 seconds.

regards,

Caesar

0 Kudos

803 Views
seandema
Contributor IV

I have not figured anything out for the "unidentified network" issue. I have however fixed the slowness to get an IP problem.

The issue I was having is that my PC was starting the DHCP process with a DHCP Request not a discover packet. MQX wants it to start with discover for unknown MACs. I think my PC was trying to request the last address it had obtained even if that address was assigned by another device like a router. To solve this I modified dhcpsrv.c to send a NAK when it gets a request from a MAC it doesn't already know. This causes the PC to start over with DHCP Discover and the whole process happens almost instantly.

All I did was add an else case to if (addrp) in DHCPSRV_service_request function.

if (addrp) {

...

{

else  //(SMD) Adding a NAK when a request from an unknown IP/MAC is received. Helps client start DHCP over at DHCP discovery.

  {

      DHCPSRV_write_header(state, NULL, 0, DHCPTYPE_DHCPNAK);

      DHCPSRV_write_end(state);

      reply = TRUE;

  }

Sorry I don't know how to fix the "unidentified network" issue but I hope this helps.

-Sean

803 Views
patrickcaujan
Contributor II

Hello Sean,

Thanks a lot for your modification in dhcpsrv.c :-)

I was going mad to see my Windows PC waits 1mn each time I want to connect to my target !!

Now everything is good.