none
Two IP addresses for WEC7 RRS feed

  • Question

  • All,

    We used to use two IP addresses in our CE6 system (one internal and one external). Now, we'd like to use the same with WEC7 (CE7) and with exactly the same settings the second IP address is ignored.

    Our design is very similar to the TI EVM_3730 (EVM_3530) board - we use the SMSC adapter and we set two IP addresses this way:

     [HKEY_LOCAL_MACHINE\Comm\SMSC91181\Parms\TcpIp]
        "EnableDHCP"=dword:0
        "IpAddress"=multi_sz:"192.168.0.22","192.168.1.3"
        "Subnetmask"=multi_sz:"255.255.255.0","255.255.255.0"
        "DefaultGateway"="192.168.1.1"
        "UseZeroBroadcast"=dword:0

    With exactly the same hardware, it doesn't work for CE7.

    The "ipconfig /all" for CE6 shows both IP addresses, for CE7 only the first one is displayed (and used).

    Please let me know if you have any thoughts on this.

    Thank you!

    Best regards,

    Zack

    Tuesday, April 23, 2013 7:53 PM

Answers

  • You can use AddIPAddress() to programmatically add the second IP address.  It is still working.

    Regards,

    Mario

    • Marked as answer by Zack Zadecki Thursday, April 25, 2013 8:35 PM
    Thursday, April 25, 2013 8:13 PM

All replies

  • We reported the same problem to Microsoft and here is their official response to our QFE request:

    ... They have rejected this QFE request and confirmed that current behavior of WEC7 is “by-design”.

    WEC7 implementation for reading static IP for a NIC reads only first static IP address string and WEC7’s NETUI implementation is intended to work with a single static IP internally. Also, this implementation is consistent with Control panel networking applet, through this applet only one static IP can be configured on WEC7 device.

    So they basically broke it in WEC7 but it was intended that way.  Go figure!

    Thursday, April 25, 2013 7:56 PM
  • You can use AddIPAddress() to programmatically add the second IP address.  It is still working.

    Regards,

    Mario

    • Marked as answer by Zack Zadecki Thursday, April 25, 2013 8:35 PM
    Thursday, April 25, 2013 8:13 PM
  • Hi Mario,

    Thank you very much for your responces!

    I've just tested "AddIPAddress" and it works for me.

    Thank you!

    Best regards,

    Zack

    Thursday, April 25, 2013 8:35 PM
  • Hi Zack,

    can you send me a code snippet please, how you use AddIpAddress.

    I always get the return value 87.

    Thanks.

    Walter

    Tuesday, July 29, 2014 8:53 AM
  • This code will add 192.168.1.2 mask 255.255.255.0 to adapter ENET1.

    Replace ENET1 with the name of your adapter.

    #include <windows.h>
    #include <iphlpapi.h>

    #pragma comment (lib, "iphlpapi.lib")

    ...

        DWORD status;
        ULONG ctx, inst, index;

        status = GetAdapterIndex(TEXT("ENET1"), &index);
        if (status != ERROR_SUCCESS) {
            RETAILMSG(1, (L"Cannot get adapter index for ENET1.\r\n"));
            goto END;
        }

        RETAILMSG(1, (L"Adding IP address...\r\n"));
        status = AddIPAddress(0x0201A8C0, 0x00ffffff, index, &ctx, &inst);
        if (status != ERROR_SUCCESS) {
            RETAILMSG(1, (L"AddIPAddress returned %d (%d)\r\n", status, GetLastError()));
            goto END;
        }
        RETAILMSG(1, (L"Adding IP address done...\r\n"));\

       ...

    END:

        ...

    Tuesday, July 29, 2014 12:36 PM
  • Mario,

    Thank you for your code!

    Walter,

    Mario's solution is very similar to what I'm doing in my code. Here is some more details on how I prepare the arguments of the AddIpAddress function:

            MIB_IPADDRTABLE ipAddrTable;
            DWORD dwSize = sizeof(ipAddrTable);
            DWORD dwRetVal = 0;
            DWORD dwIndex = 2;
            UINT nIPAddress = 0;
            UINT nMask = 0;
            ULONG nContext = 0;
            ULONG nInstance = 0;

            dwRetVal = GetIpAddrTable(&ipAddrTable, &dwSize, 0);

            if(dwRetVal == NO_ERROR) 
            {
                dwIndex = ipAddrTable.table[0].dwIndex;
            }

    ...

            nIPAddress = inet_addr(strValue.c_str());
            nMask = inet_addr(strValue.c_str());

    ...
            AddIPAddress(nIPAddress, nMask, dwIndex, &nContext, &nInstance)

    Best regards,

    Zack

    Tuesday, July 29, 2014 1:35 PM
  • All,

    There is one more thing worth to mention here. Even though we assign a second IP address, there are still some limitations there. Some OS features, like remote file sharing, works only for one IP address - the smaller one. So, if there are two IP addresses: 192.168.0.2 and 192.168.1.2 - remote file sharing will work only for the first one. For now, I don't have any solution for that other that just making sure that the IP address I want to use file sharing with has the lower IP.

    Please let me know if you have any ideas on that.

    Thank you!

    Zack

    Tuesday, July 29, 2014 1:43 PM