NetX Duo dhcp server share same ip instance with dhcp client on SSP 1.4.0

Hi all,

 

I'd like to implement a multi-role which contains dhcp server and client on S5,

should I create only one IP instance for both sharing or independent two for each role?

I create one for sharing now and it goes wrong. I the problem is about addresses of IPv4 and Gateway.

 

Wei Lu

  • Hi Wei Lu,

    Most likely you'll need two separate instances, but please write what you're trying to achieve. Would you like to create a router? Then I recommend to go with NetX Duo NAT module and separate IP instances.

    Regards,
    adboc
  • In reply to adboc:

    Hi,

    Thanks for reply the question,
    I was trying to make it provision with mobile device as a server role, after receiving information of AP station from mobile device, it turns into station mode and connect to the AP assigned by mobile device.
    So two separate instances it is. Thanks.

    Wei Lu
  • In reply to adboc:

    Hi,

    I cannot create two independent IP instances successfully,
    on AP mode, I can see the WIFI signal on my cell but it cannot be connected.
    Do you have sample code for reference?

    Wei Lu
  • In reply to Wei:

    Hi Wei Lu,

    In this case the application can run only one IP instance. Please see an example project for GT202 that runs DHCP client at the beginning (in WiFi client mode) and later switches to WiFi AP mode and enables DHCP server.

    S7G2_SK_WiFi_AP_Client_Toggle_1_4_0.zip

    Regards,
    adboc

  • In reply to adboc:

    Hi adboc,

    This is good example for me,
    however, I cannot enable the client role after delete dhcp server for server mode.
    It always goes to error SSP_ERR_WIFI_FAILED.
    Any suggestion?

    Wei Lu
  • In reply to Wei:

    Hi Wei Lu,

    Are you using GT202 WiFi module?

    Regards,
    adboc
  • In reply to adboc:

    Hi,

    I'm using RTL8189EM as WiFi module.

    Wei Lu
  • In reply to Wei:

    Hi Wei Lu,

    Could you check where exactly the driver returns SSP_ERR_WIFI_FAILED? The driver is maintained by Jorjin, contact details can be found at http://www.jorjin.com/

    Regards,
    adboc
  • In reply to adboc:

    Hi,

    I think it's not about WiFi driver,
    I can successfully switch to station mode from AP mode without HTTPS server enabled(only dhcp),
    however, even I delete all the parameters or sources related with HTTPS, it still not works.
    Should I modify the priority or size of packet pool?
    It's really hard for me to figure it out...
    Thanks for reply.

    Wei Lu
  • Hi Renesas-Support,

    i got a similar problem.

    we have the following constellation:
    - SSP 1.3.3
    - One IP-instance with two interfaces (PRI: WiFi WINC1500, SEC: Ethernet)
    - A DHCP-Client (working on both interfaces)
    - A DNS-Client (working on both interfaces)
    - A DHCP-Server (working with WiFi in AP-Mode only)

    If we start the WiFi-Module in Client-Mode everything is fine; we get a correct IP-Address by the DHCP-client (192.168.1.105). If we change to the AP-mode, it still seems to work correctly (we stop the DHCP-client, and start the DHCP-server and set the IP-Address manually to 192.168.0.1).
    But, if we change back to Client-Mode (the Mode-change runs correctly on the WINC1500-WiFi-module (link-callback is hit with SF_WIFI_EVENT_AP_CONNECT, so link is OK), we then tried already different approaches to get an IP-Address again (with DHCP-client):
    - Soft ReInit:
    - DHCP-server-stop, DHCP-client-interface-enable, DHCP-client-interface-stop, IP-Instance-Interface-manual-IP-adr-set (0,0), DHCP-client-interface-reinitialize, DHCP-client-interface-start
    - The DHCP-client-callback reaches at least NX_DHCP_STATE_SELECTING, but never BOUND (and never get a correct IP-address again)
    - Hard ReInit (as mentioned here: renesasrulz.com/.../36114
    - DHCP-client-delete, DHCP-client-init (the created function for autostart of DHCP-client (autostart is deactivated)), DHCP-client-start
    - There seems to be no reaction (of the DHCP-client) at all
    - The same if the IP-Instance-Interface-IP-adr is reset manually (to zero)

    Please help (how can we solve this? Is it an DHCP-client-issue? Or maybe this deals with IP-Instance (multi-home)?).

    Regards,
    Peter Weichselbaumer
  • In reply to PWeixi:

    Hi Wei Lu, Peter Weichselbaumer,

    I cannot reproduce such issue on GT202. A slightly modified version of net_thread_entry comparing to version posted earlier:

    1373.net_thread_entry.c.txt
    /* Net Thread entry function */
    void net_thread_entry(void)
    {
        ULONG ip_address;
        ULONG network_mask;
        ULONG ip_address2;
        ULONG network_mask2;
    
        initialise_monitor_handles();
    
        net_wifi_init(&g_ip);
    
        net_wifi_dhcp_client_start(&g_dhcp_client, &g_ip, &ip_address, &network_mask);
        net_wifi_dhcp_client_stop(&g_dhcp_client);
    
        printf("1: %lx\n%lx\n", ip_address, network_mask);
    
        net_wifi_dhcp_server_start(&g_dhcp_server);
    
        tx_thread_sleep(1000);
    
        net_wifi_dhcp_server_stop(&g_dhcp_server);
    
        nx_ip_address_set(&g_ip, 0, 0);
    
        tx_thread_sleep(1000);
    
        net_wifi_dhcp_client_start(&g_dhcp_client, &g_ip, &ip_address2, &network_mask2);
    
        tx_thread_sleep(500);
    
        net_wifi_dhcp_client_stop(&g_dhcp_client);
    
        printf("2: %lx\n%lx\n", ip_address2, network_mask2);
    
        while (1)
        {
            tx_thread_sleep (1);
        }
    }

    It successfully receives IP address from DHCP server before and after changing to AP mode.

    Regards,
    adboc

  • In reply to PWeixi:

    Peter,

    Which version of the WINC1500 pack file are you using? The latest version is available here:-

    www.reloc.it/.../

    Regards

    Jeremy
  • In reply to Jeremy:

    Hi Jeremy,

    we could manage to get the dhcp-client running properly (nx_dhcp_interface_stop, nx_dhcp_interface_disable when switching wifi to AP-mode).

    But unfortunately we're facing another problem, now with the dhcp-server (that is activated when AP-mode is on).
    This is our Multi-home setting (ETH and WiFi sharing the same IP-instance):
    - ETH connected, DHCP-client active on ETH-only, valid IP-address by DHCP
    - and WiFi (WINC1500) in AP-mode (with static IP-address (for the AP) and DHCP-server activated
    --> we have configured the WiFi-interface only (nx_ip_interface_address_set, nx_dhcp_create_server_ip_address_list, nx_dhcp_set_interface_network_parameters for the DHCP-server), but the DHCP-server also seems to reply to ETH-clients!!!
    How can we avoid this? Do we need special settings for the ETH-interface either?

    Regards
    Peter
  • In reply to PWeixi:

    What SSP are you using? There was a bug fixed in the NetX DHCP Server not properly processing the interface index:

    "When DHCP Server is sending data on secondary interfaces, packets are transferred in the primary interface itself since the underlying NetX cannot figure out which interface data is sent from the destination (broadcast) IP address. "

    This is fixed in SSP 1.6.0. The fact that the DHCP Server is responding to packets on the primary (Ethernet) interface makes it sound like you have run into this problem. If that is the case, there is no workaround other than modify your configuration such that the DHCP Server runs on the primary interface. Then the bug is avoided.

    Janet
  • In reply to JanetC:

    Hi Janet,

    we're using SSP 1.5.0.

    Because we can't exchange the interfaces (WiFi isn't always on, so it would be no good idea making it primary), it seems that we have to wait on SSP 1.6.0.

    Do you know when SSP 1.6.0 will be available?

    Regards
    Peter