2024-02-05 06:03 AM
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,
2024-02-05 10:50 PM
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.
2024-02-06 12:58 AM
in the world of Networking when one interface have more than one IP is called IP aliasing and is a very common practice
2024-02-06 01:41 AM
@Melgh.1 wrote:My current implementation does not works for the both IP addresses
What do you mean by that?
Do you have it working with just one address?
Use this button to properly post source code - as text, not an image:
To get that extra row of icons, press this button:
2024-02-06 01:52 AM
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 */
}
2024-04-03 08:53 AM
How many interfaces have you configured for? By default the NetxDuo library defaults to 1.