cancel
Showing results for 
Search instead for 
Did you mean: 

mapping multiple * IP addresses to one Ethernet interface (LWIP)

Melgh.1
Associate II

Hello,

I'm attempting to bind multiple IP addresses to a single Ethernet port using different struct netif logical interfaces. My current implementation does not works for the both IP addresses

Seeking guidance or resources on the correct approach. Any insights appreciated.

Thanks,

Melgh1_0-1707141797573.png

 




5 REPLIES 5
tjaekel
Lead

How can an IP receiver have several different IP addresses?

What you are looking for is "promiscuous mode":

https://en.wikipedia.org/wiki/Promiscuous_mode

An IP receiver might use a HW table to filter MAC addresses, IP addressed (using a Hashing Table).
To assign different IP addresses to a network device, in order to listen to both, sounds impossible to me.

in the world of Networking when one interface have more than one IP is called IP aliasing and is a very common practice

Andrew Neil
Evangelist III

@Melgh.1 wrote:

My current implementation does not works for the both IP addresses


What do you mean by that?

  • Neither works?
  • only one works?
  • other??

Do you have it working with just one address?

 

Use this button to properly post source code - as text, not an image:

AndrewNeil_0-1707212479217.png

 

To get that extra row of icons, press this button:

AndrewNeil_1-1707212479219.png

Melgh.1
Associate II

Both are not working,
but one works if you deactivate one of them:

//ethernetif_input(&netif);
ethernetif_input(&netif_0);

 

    IP4_ADDR(&netif_ipaddr, configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3);
    IP4_ADDR(&netif_netmask, configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3);
    IP4_ADDR(&netif_gw, configGW_ADDR0, configGW_ADDR1, configGW_ADDR2, configGW_ADDR3);

    IP4_ADDR(&netif_ipaddr_0, configIP_ADDR0_0, configIP_ADDR1_0, configIP_ADDR2_0, configIP_ADDR3_0);
    IP4_ADDR(&netif_netmask_0, configNET_MASK0_0, configNET_MASK1_0, configNET_MASK2_0, configNET_MASK3_0);
    IP4_ADDR(&netif_gw_0, configGW_ADDR0_0, configGW_ADDR1_0, configGW_ADDR2_0, configGW_ADDR3_0);



    lwip_init();
    snmp_example_init();


    netif_add(&netif, &netif_ipaddr, &netif_netmask, &netif_gw, &enet_config, EXAMPLE_NETIF_INIT_FN, ethernet_input);
    netif_add(&netif_0, &netif_ipaddr_0, &netif_netmask_0, &netif_gw_0, &enet_config_0, EXAMPLE_NETIF_INIT_FN_0, ethernet_input);


    netif_set_default(&netif);
    netif_set_up(&netif);

    netif_set_default(&netif_0);
    netif_set_up(&netif_0);






    while (1)
    {
        /* Poll the driver, get any outstanding frames */
        ethernetif_input(&netif);
        ethernetif_input(&netif_0);

        sys_check_timeouts(); /* Handle all system timeouts for all core protocols */
    }
GreenGuy
Lead

How many interfaces have you configured for?  By default the NetxDuo library defaults to 1.